private static void Main(string[] args) { var unmountOptions = new UnmountOptions(); if (CommandLine.Parser.Default.ParseArguments(args, unmountOptions)) { Dokan.RemoveMountPoint(unmountOptions.UnmountDirectory); return; } var options = new Options(); if (CommandLine.Parser.Default.ParseArguments(args, options)) { try { Console.WriteLine("DokanPbo booting..."); if (options.WriteableDirectory == null) { Console.WriteLine("Creating temporary write directory..."); options.WriteableDirectory = Path.Combine(Path.GetTempPath(), Path.GetRandomFileName()); //#TODO can throw exception and die if it creates a existing folder by accident Directory.CreateDirectory(options.WriteableDirectory); //Need to register handler to catch console exit to delete directory at end SetConsoleCtrlHandler(ConsoleCtrlCheck, true); deleteTempDirOnClose = options.WriteableDirectory; } if (!Directory.Exists(options.WriteableDirectory)) { Console.WriteLine("FATAL Writeable Directory doesn't exist: " + options.WriteableDirectory); Console.ReadKey(); } ArchiveManager archiveManager = new ArchiveManager(options.PboDirectories); PboFSTree fileTree = new PboFSTree(archiveManager, options.WriteableDirectory, options.ExcludePrefix); PboFS pboFS = new PboFS(fileTree, archiveManager, options.Prefix); #if DEBUG ILogger logger = new NullLogger(); //null; #else ILogger logger = new NullLogger(); #endif pboFS.Mount(options.MountDirectory, Program.MOUNT_OPTIONS, 1, logger); Console.WriteLine("Success"); } catch (DokanException ex) { Console.WriteLine("Error: " + ex.Message); } } }
public PboFS(PboFSTree fileTree, ArchiveManager archiveManager, string prefix) { this.archiveManager = archiveManager; this.fileTree = fileTree; this.prefix = prefix; }
public PboFS(PboFSTree fileTree, ArchiveManager archiveManager) : this(fileTree, archiveManager, "") { }
public PboFSTree(ArchiveManager archiveManager) { this.archiveManager = archiveManager; createFileTree(); }