![]() |
VOOZH | about |
dotnet add package NC-DokanFsBase --version 0.1.1
NuGet\Install-Package NC-DokanFsBase -Version 0.1.1
<PackageReference Include="NC-DokanFsBase" Version="0.1.1" />
<PackageVersion Include="NC-DokanFsBase" Version="0.1.1" />Directory.Packages.props
<PackageReference Include="NC-DokanFsBase" />Project file
paket add NC-DokanFsBase --version 0.1.1
#r "nuget: NC-DokanFsBase, 0.1.1"
#:package NC-DokanFsBase@0.1.1
#addin nuget:?package=NC-DokanFsBase&version=0.1.1Install as a Cake Addin
#tool nuget:?package=NC-DokanFsBase&version=0.1.1Install as a Cake Tool
This library will help you create new Dokan User Mode File System quicker and easier.
When implementing new File System for Dokan, you would be implementing IDokanOperations interface and writing roughly 24 functions.
Although the functions in IDokanOperations seems trivial, you would face a lot of trouble creating a working file system because you do not know how to correctly respond to each calls made to your IDokanOperations.
Fortunately, Dokan-net has provided Mirror.cs which seems to have encapsulated the knowledge of creating a working file system in Dokan. The Mirror sample
use File/Directory/Path classes in System.IO namespace to handle the requests.
I have extracted those calls into an interface called IDokanDisk which is available to you in this Library. So you can implement a working File system without having an in-depth understanding of
why CreateFile function gets called when Windows Explorer trying to list files in a folder!
IDokanDisk. There are 22 functions to implement, just be patient and follow the guide in XML Comments.
Trust me, it's a lot more trivial than having to implement CreateFile function in IDokanOperations which does almost everything.using NC.DokanFS;
namespace NC.CrossDrive.App
{
public class CrossDriveDokanDisk : IDokanDisk
{
// implement the operations here
}
}
IDokanFileContext. Your IDokanDisk's CreateFileContext function should return a new instance of this class.This class is where you will perform read/write operations to your backend storage. If you do not want to support an operation, just throw IOException
Flush method will be called when the application request the write buffer to be flushed - so do that!
The Dispose method of this class will gets called when an application using the file close the file handle. So in Dispose, make sure to clean up everything related to the file.
using NC.DokanFS;
namespace NC.CrossDrive.App
{
public class CrossDriveFileContext : IDokanFileContext
{
// implement Read, Close, Flush Dispose
}
}
DokanFrontend and pass an instance of your IDokanDisk to it. DokanFrontend class is the modified Mirror.cs sample which calls to IDokanDisk instead of vairous System.IO.* classes.using NC.DokanFS;
namespace NC.CrossDrive.App
{
class Program
{
static void Main(string[] args)
{
var crossdrive = new CrossDriveDokanDisk();
var dokan = new DokanFrontend(crossdrive, "CrossDrive");
dokan.Mount(@"H:\");
Console.WriteLine("Press ENTER to Exit.");
Console.Read();
dokan.Unmount();
}
}
}
Run and enjoy your new file system!
There are few helpful classes in this namespace to help you get started even faster.
ReadOnlyDiskBase : inherit this class to create a read-only file systemReadOnlyFileContextBase : inherit this class for read-only file contextBlockBasedReadOnlyFileContextBase : inherit this class for read-only file context which fetch data from backend storage in blocksBlockBasedFileContextBase : inherit this class for file context which fetch/write data from backend storage in blocksMIT License.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 net5.0 is compatible. net5.0-windows net5.0-windows was computed. net6.0 net6.0 was computed. net6.0-android net6.0-android was computed. net6.0-ios net6.0-ios was computed. net6.0-maccatalyst net6.0-maccatalyst was computed. net6.0-macos net6.0-macos was computed. net6.0-tvos net6.0-tvos was computed. net6.0-windows net6.0-windows was computed. net7.0 net7.0 was computed. net7.0-android net7.0-android was computed. net7.0-ios net7.0-ios was computed. net7.0-maccatalyst net7.0-maccatalyst was computed. net7.0-macos net7.0-macos was computed. net7.0-tvos net7.0-tvos was computed. net7.0-windows net7.0-windows was computed. net8.0 net8.0 was computed. net8.0-android net8.0-android was computed. net8.0-browser net8.0-browser was computed. net8.0-ios net8.0-ios was computed. net8.0-maccatalyst net8.0-maccatalyst was computed. net8.0-macos net8.0-macos was computed. net8.0-tvos net8.0-tvos was computed. net8.0-windows net8.0-windows was computed. net9.0 net9.0 was computed. net9.0-android net9.0-android was computed. net9.0-browser net9.0-browser was computed. net9.0-ios net9.0-ios was computed. net9.0-maccatalyst net9.0-maccatalyst was computed. net9.0-macos net9.0-macos was computed. net9.0-tvos net9.0-tvos was computed. net9.0-windows net9.0-windows was computed. net10.0 net10.0 was computed. net10.0-android net10.0-android was computed. net10.0-browser net10.0-browser was computed. net10.0-ios net10.0-ios was computed. net10.0-maccatalyst net10.0-maccatalyst was computed. net10.0-macos net10.0-macos was computed. net10.0-tvos net10.0-tvos was computed. net10.0-windows net10.0-windows was computed. |
This package is not used by any NuGet packages.
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 0.1.1 | 699 | 3/26/2021 |
Initial Release