简体   繁体   English

使用memoryStream的路径作为FilePath打开FileStream

[英]Open FileStream with path of memoryStream as FilePath

I have a question,a complicated one!!! 我有一个问题,一个复杂的问题!!!

I have some external class library that needs path of file. 我有一些需要文件路径的外部类库。 my application load the file to the memory stream. 我的应用程序将文件加载到内存流。

I want to give it some path (to the external dll) that will redirect it to the memory stream in order to get the file, instead of to the file system. 我想给它一些路径(到外部dll),它将其重定向到内存流以便获取文件,而不是文件系统。 (the dll working with FileStream). (与FileStream一起使用的dll)。

for example: If I have file (in fileSystem) with name : C:\\MyFile.txt I want to load the file to the memoryStream and provide the external dll somepath, something like "MyMemoryStreamPath" and it will load the file from the memory and not from the file system (it will "Think" that it's file system path, but actually its a path of memmoryStream). 例如:如果我有文件(在fileSystem中),其名称为:C:\\ MyFile.txt,我想将该文件加载到memoryStream并提供外部dll somepath,例如“ MyMemoryStreamPath”,它将从内存中加载该文件而不是来自文件系统(它将“认为”它是文件系统路径,但实际上是它的memmoryStream路径)。 just to remind you, the dll working with FileStream. 只是提醒您,dll与FileStream一起使用。 I know that it's a complicated question any idea will be accepted. 我知道这是一个复杂的问题,任何想法都会被接受。 :) :)

There's no way to do that. 无法做到这一点。 If you have permission issues, you can save your stream to an IsolatedStorage . 如果您有权限问题,可以将流保存到IsolatedStorage It has plenty of options and you can get path of the saved file through relfection. 它具有很多选项,您可以通过relfection获取保存文件的路径。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM