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);
        }
Esempio n. 2
0
        static void Run()
        {
            Console.WriteLine("ShellBoost - Samples - SevenZip Folder - Copyright (C) 2018-" + DateTime.Now.Year + " Aelyo Softworks. 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();
                config.NativeDllRegistration = RegistrationMode.User;
#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");
            }
        }