Exemple #1
0
        private void CommonStart(string ipcFormat = null)
        {
            _server?.Stop();

            Initializer             = new callback.CBFSShell.Cbshellboost();
            Initializer.ProductGUID = ProductID;

            Register();

            // Important - Initialize must be called before using ShellBoost (except the calls to Install and Uninstall methods)
            Initializer.Initialize();

            _server = new OverviewShellFolderServer();
            var config = new ShellFolderConfiguration();

            // we're not impersonating client
            config.ImpersonateClient = false;

            // this will fix an endpoint for clients connecting to a service:
            // they *must* install ShellBoost with "ShellBoost.Samples.FolderService.ShellFolderService" as IpcFormat.
            //
            // clients from interactive run (console) don't need that.
            config.IpcFormat = ipcFormat;

            _server.Start(config);
        }
        static ConsoleKeyInfo Run()
        {
            ConsoleKeyInfo key;

            using (var server = new OverviewShellFolderServer())
            {
                var config = new ShellFolderConfiguration();
#if DEBUG
                config.Logger = new ShellBoost.Core.Utilities.ConsoleLogger {
                    AddCounter = true
                };
#endif
                server.Start(config);
                Console.WriteLine("Started listening on proxy id " + ShellFolderServer.ProxyId + ". Press ESC key to stop serving folders.");
                Console.WriteLine("If you open Windows Explorer, you should now see the extension under the ShellBoost.Overview folder.");
                try
                {
                    do
                    {
                        key = Console.ReadKey(true);
                        switch (key.Key)
                        {
                        case ConsoleKey.Escape:
                            break;

                        case ConsoleKey.C:
                            Console.Clear();
                            break;

                        default:
                            return(key);
                        }
                    }while (key.Key != ConsoleKey.Escape);
                }
                finally
                {
                    server.Stop();
                    Console.WriteLine("Stopped");
                }
            }
            return(key);
        }