C#:在计算机中创建一个虚拟驱动器
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/56908/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
C#: Create a virtual drive in Computer
提问by Seb Nilsson
Is there any way to create a virtual drive in "(My) Computer" and manipulate it, somewhat like JungleDisk does it?
有没有办法在“(我的)电脑”中创建一个虚拟驱动器并对其进行操作,就像 JungleDisk 那样?
It probably does something like:
它可能会执行以下操作:
override OnRead(object sender, Event e) {
ShowFilesFromAmazon();
}
Are there any API:s for this? Maybe to write to an XML-file or a database, instead of a real drive.
是否有任何 API:s 用于此?也许写入 XML 文件或数据库,而不是真正的驱动器。
The Dokan Libraryseems to be the answer that mostly corresponds with my question, even though System.IO.IsolatedStorageseems to be the most standardized and most Microsoft-environment adapted.
该杜坎库似乎是大多与我的问题所对应的答案,即使System.IO.IsolatedStorage似乎是最规范的,最微软的环境适应。
采纳答案by Joel Lucsy
You can use the Dokan libraryto create a virtual drive. There is a .Net wrapper for interfacing with C#.
您可以使用Dokan 库来创建虚拟驱动器。有一个用于与 C# 交互的 .Net 包装器。
回答by Chris Wenham
Yes, use the classes in System.IO.IsolatedStorage
是的,使用System.IO.IsolatedStorage 中的类
回答by MSalters
The contents of My Computer can include Shell Namespace Extensions. These COM objects run inside the main Explorer process, as do many other shell extensions. Using C# for such extensions is a bad idea, since your extension cannot control which CLR version Explorer.exe can use. And Microsoft allows only one CLR per process.
我的电脑的内容可以包括 Shell 命名空间扩展。这些 COM 对象在主 Explorer 进程内运行,许多其他 shell 扩展也是如此。将 C# 用于此类扩展是一个坏主意,因为您的扩展无法控制 Explorer.exe 可以使用哪个 CLR 版本。并且 Microsoft 只允许每个进程使用一个 CLR。