Create virtual file path from stream
Asked Answered
C

1

7

I have a general question concerning C# & Windows API:

My task is loading a file from a document management system (DMS) and create a byte array from this file. From the developer of the DMS I got a dll which provides a method like this:

loadFile(int DocId, string PathToSaveFile);

Unfortunately the given dll does not provide me a method to deliver the requested file as a byte array or any kind of stream. Now my question, is it possible with C# to create some kind of virtual path which does actually not exists on secondary storage. Instead all bits and bytes written to this path are forwarded to me in a stream? The goal of my intention is to increase the performance as I don't have to write data to a hard drive.

I already searched a lot, but actually don't know the keywords I have to look for. Perhaps someone can give me a hint or just tell me that it is not possible at all.

Calise answered 17/4, 2013 at 7:22 Comment(2)
a WEBDAV server? For ex, webdavsystem.comInterdigitate
Side note: "increase the performance as I don't have to write data to a hard drive." - requires you to plan memory/disk usage very well. Otherwise you'll endup with more data that can reasonably fit in physical memory of your machine and instead of improving performance you get slower and significantly more complicated code. Interesting to write, but not necessary faster.Cholecalciferol
V
2

It will depend somewhat on how the library will open the file and read the file. If it is using CreateFile then there is the potential that you could provide access via a named pipe. The path to a named pipe can be specified using \\.\pipe\PipeNameHere. In C# you can use NamedPipeServerStream.

However, I think the odds of the client application being compatible with this are relatively slim and would suggest creating a RAM drive that will be easier to implement and is more likely to work. A RAM drive will appear as a normal disk drive. You can save and load files to it, but it is all done in memory.

Vaenfila answered 17/4, 2013 at 8:14 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.