public ArchiveRootShellFolder(SevenZipShellFolderServer server, ShellItemIdList idList)
            : base(idList)
        {
            if (server == null)
            {
                throw new ArgumentNullException(nameof(server));
            }

            Server      = server;
            Archive     = new ArchiveRootFolderInfo(idList.GetFileSystemPath());
            DisplayName = Path.GetFileName(Archive.FilePath);
        }
예제 #2
0
        static void Run()
        {
            Console.WriteLine("CBFS Shell Samples - SevenZip Folder - Copyright (C) 2021-2022 Callback Technologies, Inc. All rights reserved.");
            Console.WriteLine(new DiagnosticsInformation(assembly: null).AssemblyDisplayName);
            Console.WriteLine();
            if (CommandLine.HelpRequested)
            {
                Help();
                return;
            }

            SetSevenZipLibraryPath();
            using (var server = new SevenZipShellFolderServer())
            {
                var config = new ShellFolderConfiguration();
#if DEBUG
                config.Logger = new ConsoleLogger {
                    AddThreadId = true
                };
#endif
                server.Start(config);

                RegisterAsVirtualFolder(".7z", ShellFolderServer.FolderId);

                Console.WriteLine("Started listening on proxy id " + ShellFolderServer.ProxyId + ". Press ESC key to stop serving 7z files.");
                do
                {
                    var key = Console.ReadKey(true);
                    if (key.Key == ConsoleKey.Escape)
                    {
                        break;
                    }

                    if (key.Key == ConsoleKey.C)
                    {
                        Console.Clear();
                    }
                }while (true);
                Console.WriteLine("Stopped");
            }
        }