36

Is there any way to create a virtual drive in "(My) Computer" and manipulate it, somewhat like JungleDisk does it?

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.


The Dokan Library seems to be the answer that mostly corresponds with my question, even though System.IO.IsolatedStorage seems to be the most standardized and most Microsoft-environment adapted.

jjnguy
  • 136,852
  • 53
  • 295
  • 323
Seb Nilsson
  • 26,200
  • 30
  • 103
  • 130

4 Answers4

18

Depending on what type of virtual drive you wish to build, here are some new OS API recently introduced in Windows, macOS and iOS.

Some of the below API is available as managed .NET code on Windows but many are a native Windows / macOS / iOS API. Even though, I was able to consume many of the below API in .NET and Xamarin applications and build entire Virtual Drive in C# for Windows, macOS and iOS.

For Remote Cloud Storage

On Windows. Windows 10 provides Cloud Sync Engine API for creating virtual drives that publish data from a remote location. It is also known under the “Cloud Filter API” name or “Windows Cloud Provider”. Here are its major features:

  • On-demand folders listing. Folder listing is made only when the first requested by the client application to the file system is made. File content is not downloaded, but all file properties including file size are available on the client via regular files API.
  • On-demand file content loading. File content can be downloaded in several modes (progressive, streaming mode, allow background download, etc) and made available to OS when application makes first file content reading request.
  • Offline files support. Files can be edited in the offline mode, pinned/unpinned and synched to/from the server.
  • Windows shell integration. Windows File Manager shows file status (modified, in-sync, conflict) and file download progress.
  • Metadata and properties support. Custom columns can be displayed in Windows File Manager as well as some binary metadata can be associated with each file and folder.

On macOS and iOS. MacOS Big Sur and iOS 11+ provides similar API called File Provider API. Its features are similar to what Windows API provides:

  • On-demand folders listing.
  • On-demand files content loading.
  • Offline files support.
  • File Manager Integration. In macOS Finder and iOS Files application you can can show file status (in the cloud, local).

I am not sure currently if files/folders and can show custom columns in macOS Finder and store any metadata.

For High-Speed Local Storage

On Windows. Windows provides ProjFS API. Its main difference from the Cloud Sync Engine API and macOS/iOS File Provider API is that it hides the fact that it is a remote storage. It does not provide any indication of the file status, download progress, ets. The documentation says it is intended for “projecting” hierarchical data in the form of file system.

Coder
  • 220
  • 2
  • 10
8

You can use the Dokan library to create a virtual drive. There is a .Net wrapper for interfacing with C#.

caesay
  • 16,932
  • 15
  • 95
  • 160
Joel Lucsy
  • 8,520
  • 1
  • 29
  • 35
  • 1
    As far as I know there is no way to use it in a commercial project, it is under LGPL license. I would suggest using WebDAV server + built-in Windows/Mac OS X drive mounting functionality. Probably this is the fastest way to achieve the result. –  Sep 05 '10 at 22:12
  • 11
    I think you mix things: LGPL is not incompatible with a commercial usage. You can link against the dll (reference it) and only if you make changes to the Dokan dll itself you must release the source: but the source of the modified Dokan library ONLY! THIS IS NOT THE CASE FOR **GPL** CODE, FOR GPL YOU MUST RELEASE THE SOURCE OF **YOUR** WHOLE APPLICATION. – jdehaan Sep 06 '10 at 04:51
  • 2
    Dokan is long dead and buggy with no hope for bug fixes. – Eugene Mayevski 'Callback Jul 29 '13 at 09:09
2

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.

MSalters
  • 173,980
  • 10
  • 155
  • 350
2

Yes, use the classes in System.IO.IsolatedStorage

Chris Wenham
  • 23,679
  • 13
  • 59
  • 69
  • 4
    I don't understand how IsloatedStorage can add an `OnRead` event and do `ShowFilesFromAmazon()`? Could you give me an example? Thanks! – Alex Yeung Apr 19 '11 at 00:06