Beispiel #1
0
        public static int DokanMain(DokanOptions options, DokanOperations operations)
        {
            if (options == null)
            {
                return;
            }

            DOKAN_OPTIONS dokanOptions = new DOKAN_OPTIONS();

            if (dokanOptions.Version == 0)
            {
                dokanOptions.Version = DOKAN_VERSION;
            }

            if (options.VolumeLabel == null)
            {
                options.VolumeLabel = "DOKAN-NET";
            }

            dokanOptions.Version = options.Version;
            Proxy proxy = new Proxy(options, operations);

            dokanOptions.MountPoint  = options.MountPoint;
            dokanOptions.ThreadCount = options.ThreadCount;
            dokanOptions.Options    |= options.DebugMode ? DOKAN_OPTION_DEBUG : 0;
            dokanOptions.Options    |= options.UseStdErr ? DOKAN_OPTION_STDERR : 0;
            dokanOptions.Options    |= options.UseAltStream ? DOKAN_OPTION_ALT_STREAM : 0;
            dokanOptions.Options    |= options.UseKeepAlive ? DOKAN_OPTION_KEEP_ALIVE : 0;
            dokanOptions.Options    |= options.NetworkDrive ? DOKAN_OPTION_NETWORK : 0;
            dokanOptions.Options    |= options.RemovableDrive ? DOKAN_OPTION_REMOVABLE : 0;

            DOKAN_OPERATIONS dokanOperations = new DOKAN_OPERATIONS();

            dokanOperations.CreateFile           = proxy.CreateFileProxy;
            dokanOperations.OpenDirectory        = proxy.OpenDirectoryProxy;
            dokanOperations.CreateDirectory      = proxy.CreateDirectoryProxy;
            dokanOperations.Cleanup              = proxy.CleanupProxy;
            dokanOperations.CloseFile            = proxy.CloseFileProxy;
            dokanOperations.ReadFile             = proxy.ReadFileProxy;
            dokanOperations.WriteFile            = proxy.WriteFileProxy;
            dokanOperations.FlushFileBuffers     = proxy.FlushFileBuffersProxy;
            dokanOperations.FindFiles            = proxy.FindFilesProxy;
            dokanOperations.SetFileAttributes    = proxy.SetFileAttributesProxy;
            dokanOperations.SetFileTime          = proxy.SetFileTimeProxy;
            dokanOperations.DeleteFile           = proxy.DeleteFileProxy;
            dokanOperations.DeleteDirectory      = proxy.DeleteDirectoryProxy;
            dokanOperations.MoveFile             = proxy.MoveFileProxy;
            dokanOperations.SetEndOfFile         = proxy.SetEndOfFileProxy;
            dokanOperations.SetAllocationSize    = proxy.SetAllocationSizeProxy;
            dokanOperations.LockFile             = proxy.LockFileProxy;
            dokanOperations.UnlockFile           = proxy.UnlockFileProxy;
            dokanOperations.GetDiskFreeSpace     = proxy.GetDiskFreeSpaceProxy;
            dokanOperations.GetVolumeInformation = proxy.GetVolumeInformationProxy;
            dokanOperations.Unmount              = proxy.UnmountProxy;

            return(Dokan.DokanMain(ref dokanOptions, ref dokanOperations));
        }
Beispiel #2
0
 public static extern int DokanMain(ref DOKAN_OPTIONS options, ref DOKAN_OPERATIONS operations);
Beispiel #3
0
 public static extern int DokanMain(ref DOKAN_OPTIONS options, ref DOKAN_OPERATIONS operations);
Beispiel #4
0
        public static int DokanMain(DokanOptions options, DokanOperations operations)
        {
            if (options.VolumeLabel == null)
            {
                options.VolumeLabel = "DOKAN";
            }
            
            Proxy proxy = new Proxy(options, operations);

            DOKAN_OPTIONS dokanOptions = new DOKAN_OPTIONS();

            dokanOptions.Version = options.Version;
            if (dokanOptions.Version == 0)
            {
                dokanOptions.Version = DOKAN_VERSION;
            }
            dokanOptions.ThreadCount = options.ThreadCount;
            dokanOptions.Options |= options.DebugMode ? DOKAN_OPTION_DEBUG : 0;
            dokanOptions.Options |= options.UseStdErr ? DOKAN_OPTION_STDERR : 0;
            dokanOptions.Options |= options.UseAltStream ? DOKAN_OPTION_ALT_STREAM : 0;
            dokanOptions.Options |= options.UseKeepAlive ? DOKAN_OPTION_KEEP_ALIVE : 0;
            dokanOptions.Options |= options.NetworkDrive ? DOKAN_OPTION_NETWORK : 0;
            dokanOptions.Options |= options.RemovableDrive ? DOKAN_OPTION_REMOVABLE : 0;
            dokanOptions.MountPoint = options.MountPoint;

            DOKAN_OPERATIONS dokanOperations = new DOKAN_OPERATIONS();
            dokanOperations.CreateFile = proxy.CreateFileProxy;
            dokanOperations.OpenDirectory = proxy.OpenDirectoryProxy;
            dokanOperations.CreateDirectory = proxy.CreateDirectoryProxy;
            dokanOperations.Cleanup = proxy.CleanupProxy;
            dokanOperations.CloseFile = proxy.CloseFileProxy;
            dokanOperations.ReadFile = proxy.ReadFileProxy;
            dokanOperations.WriteFile = proxy.WriteFileProxy;
            dokanOperations.FlushFileBuffers = proxy.FlushFileBuffersProxy;
            dokanOperations.GetFileInformation = proxy.GetFileInformationProxy;
            dokanOperations.FindFiles = proxy.FindFilesProxy;
            dokanOperations.SetFileAttributes = proxy.SetFileAttributesProxy;
            dokanOperations.SetFileTime = proxy.SetFileTimeProxy;
            dokanOperations.DeleteFile = proxy.DeleteFileProxy;
            dokanOperations.DeleteDirectory = proxy.DeleteDirectoryProxy;
            dokanOperations.MoveFile = proxy.MoveFileProxy;
            dokanOperations.SetEndOfFile = proxy.SetEndOfFileProxy;
            dokanOperations.SetAllocationSize = proxy.SetAllocationSizeProxy;
            dokanOperations.LockFile = proxy.LockFileProxy;
            dokanOperations.UnlockFile = proxy.UnlockFileProxy;
            dokanOperations.GetDiskFreeSpace = proxy.GetDiskFreeSpaceProxy;           
            dokanOperations.GetVolumeInformation = proxy.GetVolumeInformationProxy;        
            dokanOperations.Unmount = proxy.UnmountProxy;

            return Dokan.DokanMain(ref dokanOptions, ref dokanOperations);
        }