public RootFolder(PhysicalOverviewShellFolderServer server, ShellItemIdList idList) : base(idList) { if (server == null) { throw new ArgumentNullException(nameof(server)); } Hello = new HelloWorldItem(this); // get a path like C:\Users\<user>\AppData\Local\ShellBoost.Samples.PhysicalOverview\Root RootPath = Path.Combine(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), GetType().Namespace), "Root"); // ensure it exists var di = new DirectoryInfo(RootPath); if (!di.Exists) { di.Create(); } RootPhysical = new PhysicalFolder(this, di); Server = server; // we want to know when something changes in the real folder so we can update ours // note we don't use .NET's FileSystemWatcher but a Shell-oriented ShellBoost-provider tool instead base on native Shell's APIs. ChangeNotifier = new ChangeNotifier(ShellUtilities.GetIdList(RootPath), true); ChangeNotifier.Notify += OnChangeNotifierNotify; }
static void Run() { using (var server = new PhysicalOverviewShellFolderServer()) { var config = new ShellFolderConfiguration(); #if DEBUG config.Logger = new callback.ShellBoost.Core.Utilities.ConsoleLogger(); #endif server.Start(config); Console.WriteLine("Folder id " + ShellFolderServer.FolderId); Console.WriteLine("Started listening on proxy id " + ShellFolderServer.ProxyId + ". Press ESC key to stop serving folders."); Console.WriteLine("If you open Windows Explorer and have registered, you should now see the extension."); while (Console.ReadKey(true).Key != ConsoleKey.Escape) { } Console.WriteLine("Stopped"); } }