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

            Server = server;
            RemoveColumn(Props.System.ItemType);
            RemoveColumn(Props.System.Size);
            RemoveColumn(Props.System.DateModified);
            RemoveColumn(Props.System.PerceivedType);
            RemoveColumn(Props.System.Kind);

            InitializeOptions |= ShellFolderInitializationOptions.AddSelfToContextMenu;
        }
Example #2
0
        static void Run()
        {
            // we may display some UI, let's do like regular winforms apps do
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            using (var server = new RegistryShellFolderServer())
            {
                var config = new ShellFolderConfiguration();

#if DEBUG
                // add a logger that outputs to current console
                config.Logger = new ConsoleLogger {
                    AddThreadId = true
                };
#endif

                server.Start(config);
                Console.WriteLine("Started listening on proxy id " + ShellFolderServer.ProxyId + ". Press ESC key to stop serving folders.");
                Console.WriteLine("Folder class id " + ShellFolderServer.FolderId + ".");
                Console.WriteLine("If you open Windows Explorer and have registered, you should now see the extension.");
                do
                {
                    var key = Console.ReadKey(true);
                    if (key.Key == ConsoleKey.Escape)
                    {
                        break;
                    }

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