Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

C#: Create a virtual drive in Computer

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.

like image 927
Seb Nilsson Avatar asked Sep 11 '08 15:09

Seb Nilsson


2 Answers

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.

like image 135
Coder Avatar answered Oct 08 '22 22:10

Coder


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

like image 36
Joel Lucsy Avatar answered Oct 08 '22 22:10

Joel Lucsy