Пример #1
0
        public static void Main(string[] args)
        {
            if (args.Length != 2)
            {
                Console.WriteLine(@"Usage: WinAVFS.CLI.exe <path to archive> <mount point>");
                Console.WriteLine(@"Example: WinAVFS.CLI.exe D:\1.zip Z:\");
                return;
            }

            var fs = new ReadOnlyAVFS(new SevenZipProvider(args[0]));

            fs.Mount(args[1]);
        }
Пример #2
0
        /// <summary>
        ///     1. Only one argument <path> supported by use the default config mount point.
        ///     2. Support password.
        /// </summary>
        /// <param name="argDict"></param>
        public static void HandleDictionaryArguments(ConcurrentDictionary <String, String> argDict)
        {
            if (argDict == null)
            {
                Console.WriteLine("[Warning] No arguments. Do nothing.");
                return;
            }

            ReadOnlyAVFS fs = null;

            string outPathValue = "";

            if (!argDict.ContainsKey("path"))
            {
                Console.WriteLine("[ERROR] You must specify the <path> argument.");
                ShowUsage();
                return;
            }
            else if (argDict.TryGetValue("path", out outPathValue) && outPathValue == "")
            {
                Console.WriteLine(@"[ERROR] The <path> argument is """".");
                return;
            }

            string outPasswordValue = "";

            if (!argDict.ContainsKey("password"))
            {
                fs = new ReadOnlyAVFS(new SevenZipProvider(outPathValue));
            }
            // ignore null password
            else if (argDict.TryGetValue("password", out outPasswordValue) && outPasswordValue != "")
            {
                fs = new ReadOnlyAVFS(new SevenZipProvider(outPathValue, outPasswordValue));
            }

            string outMountPointValue = "";

            if (!argDict.ContainsKey("mount_point"))
            {
                string defaultMountPoint = FileSystemUtils.GetEmptyDirectory(outPathValue, "_[WinAVFS]");
                fs.Mount(defaultMountPoint);
                Console.WriteLine("[Info] Mounted:", defaultMountPoint);
            }
            else if (argDict.TryGetValue("mount_point", out outMountPointValue))
            {
                fs.Mount(outMountPointValue);
                Console.WriteLine("[Info] Mounted:", outMountPointValue);
            }
        }