Exemple #1
0
 private static bool ConsoleCtrlCheck(CtrlTypes ctrlType)
 {
     if (ctrlType == CtrlTypes.CTRL_CLOSE_EVENT)
     {
         if (deleteTempDirOnClose != null)
         {
             Directory.Delete(deleteTempDirOnClose, true);
         }
         Dokan.Shutdown();
     }
     return(true);
 }
Exemple #2
0
 private static void Main()
 {
     try
     {
         var rfs = new RFS();
         Dokan.Init();
         rfs.Mount("r:\\", DokanOptions.DebugMode | DokanOptions.StderrOutput);
         Dokan.Shutdown();
         Console.WriteLine(@"Success");
     }
     catch (DokanException ex)
     {
         Console.WriteLine(@"Error: " + ex.Message);
     }
 }
Exemple #3
0
        private static void Main(string[] args)
        {
            try
            {
                var arguments = args
                                .Select(x => x.Split(new char[] { '=' }, 2, StringSplitOptions.RemoveEmptyEntries))
                                .ToDictionary(x => x[0], x => x.Length > 1 ? x[1] as object : true, StringComparer.OrdinalIgnoreCase);

                var mirrorPath = arguments.ContainsKey(MirrorKey)
                   ? arguments[MirrorKey] as string
                   : @"C:\";

                var mountPath = arguments.ContainsKey(MountKey)
                   ? arguments[MountKey] as string
                   : @"N:\";

                var unsafeReadWrite = arguments.ContainsKey(UseUnsafeKey);

                Console.WriteLine($"Using unsafe methods: {unsafeReadWrite}");
                var mirror = unsafeReadWrite
                    ? new UnsafeMirror(mirrorPath)
                    : new Mirror(mirrorPath);

                Dokan.Init();

                using (DokanInstance dokanInstance = mirror.CreateFileSystem(mountPath, DokanOptions.DebugMode | DokanOptions.EnableNotificationAPI))
                {
                    var notify = new Notify();
                    notify.Start(mirrorPath, mountPath, dokanInstance);
                    dokanInstance.WaitForFileSystemClosed(uint.MaxValue);
                }

                Dokan.Shutdown();

                Console.WriteLine(@"Success");
            }
            catch (DokanException ex)
            {
                Console.WriteLine(@"Error: " + ex.Message);
            }
        }
Exemple #4
0
 public static void AssemblyCleanup()
 {
     safeMount.Dispose();
     unsafeMount.Dispose();
     Dokan.Shutdown();
 }