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 void Main() { Initializer = new callback.CBFSShell.Cbshellboost(); Initializer.ProductGUID = ProductID; Console.WriteLine("CBFS Shell Samples - Device Manager Folder - " + (IntPtr.Size == 4 ? "32" : "64") + "-bit - Copyright (C) 2021-2022 Callback Technologies, Inc. All rights reserved."); Console.WriteLine("Version: " + Initializer.About); Console.WriteLine(); Console.WriteLine("Press a key:"); Console.WriteLine(); Console.WriteLine(" '1' Register the native proxy, run this sample, and unregister on exit."); Console.WriteLine(" '2' Register the native proxy."); Console.WriteLine(" '3' Run this sample (the native proxy will need to be registered somehow for Explorer to display something)."); Console.WriteLine(" '4' Unregister the native proxy."); Console.WriteLine(); Console.WriteLine(" Any other key will exit."); Console.WriteLine(); var key = Console.ReadKey(true); switch (key.KeyChar) { case '1': Register(true); // Important - Initialize must be called before using ShellBoost (except the calls to Install and Uninstall methods) Initializer.Initialize(); Run(); Initializer.PerUserInstallation = true; Initializer.Uninstall(); break; case '2': Register(true); break; case '3': // Important - Initialize must be called before using ShellBoost (except the calls to Install and Uninstall methods) Initializer.Initialize(); Run(); break; case '4': Initializer.PerUserInstallation = true; try { Initializer.Uninstall(); Console.WriteLine("Unregistered"); } catch (Exception ex) { Console.WriteLine("EXCEPTION: "); Console.WriteLine(ex.Message); } break; } }
static void Main(string[] args) { Initializer = new callback.CBFSShell.Cbshellboost(); Initializer.ProductGUID = ProductID; Console.WriteLine("ShellBoost Samples - Physical Overview - " + (IntPtr.Size == 4 ? "32" : "64") + "-bit - Copyright (C) 2021-2022 Callback Technologies, Inc. All rights reserved."); Console.WriteLine("ShellBoost Runtime Version " + typeof(ShellContext).Assembly.GetInformationalVersion()); Console.WriteLine(); Console.WriteLine("Press a key:"); Console.WriteLine(); Console.WriteLine(" '1' Register the native proxy, run this sample, and unregister on exit."); Console.WriteLine(" '2' Register the native proxy."); Console.WriteLine(" '3' Run this sample (the native proxy will need to be registered somehow for Explorer to display something)."); Console.WriteLine(" '4' Unregister the native proxy."); Console.WriteLine(); Console.WriteLine(" Any other key will exit."); Console.WriteLine(); do { var key = Console.ReadKey(true); switch (key.KeyChar) { case '1': Register(true); // Important - Initialize must be called before using ShellBoost (except the calls to Install and Uninstall methods) Initializer.Initialize(); Run(); Initializer.PerUserInstallation = true; Initializer.Uninstall(); return; case '2': Register(true); break; case '3': // Important - Initialize must be called before using ShellBoost (except the calls to Install and Uninstall methods) Initializer.Initialize(); Run(); return; case '4': Initializer.PerUserInstallation = true; try { Initializer.Uninstall(); Console.WriteLine("Unregistered"); } catch (Exception ex) { Console.WriteLine("EXCEPTION: "); Console.WriteLine(ex.Message); } break; } } while (true); }
static void Main() { Initializer = new callback.CBFSShell.Cbshellboost(); Initializer.ProductGUID = ProductID; Console.WriteLine("CBFS Shell Samples - SevenZip Folder - Copyright (C) 2021-2022 Callback Technologies, Inc. All rights reserved."); Console.WriteLine("CBFS Shell Runtime Version " + typeof(ShellContext).Assembly.GetInformationalVersion()); Console.WriteLine(); Console.WriteLine("Press a key:"); Console.WriteLine(); Console.WriteLine(" '1' Register the native proxy, file associations, and run this sample."); Console.WriteLine(" '2' Unregister the native proxy and file associations."); Console.WriteLine(" '3' Restart Windows Explorer."); Console.WriteLine(); Console.WriteLine(" Any other key will exit."); Console.WriteLine(); var key = Console.ReadKey(true); switch (key.KeyChar) { case '1': Register(true); // Important - Initialize must be called before using ShellBoost (except the calls to Install and Uninstall methods) Initializer.Initialize(); Run(); break; case '2': Initializer.PerUserInstallation = true; Initializer.Uninstall(); UnregisterAsVirtualFolder(".7z"); Console.WriteLine("Unregistered"); break; case '3': var rm = new RestartManager(); rm.RestartExplorerProcesses((state) => { Console.WriteLine("Explorer was stopped. Press any key to restart it ..."); Console.ReadKey(true); }, false, out Exception error); if (error != null) { Console.WriteLine("An error has occurred in restart manager: " + error); } break; } }
public MainWindow() { InitializeComponent(); Initializer = new callback.CBFSShell.Cbshellboost(); Initializer.ProductGUID = ProductID; Open.IsEnabled = false; _serverStopEvent = new AutoResetEvent(false); _serverThread = new Thread(WebDriveThread); _serverThread.IsBackground = true; _serverThread.Start(); // NOTE: icon resource must be named same as namespace + icon Icon = AppParameters.IconSource; _nicon.Icon = AppParameters.Icon; _nicon.Text = Assembly.GetEntryAssembly().GetTitle(); _nicon.ContextMenu = new System.Windows.Forms.ContextMenu(); _nicon.ContextMenu.MenuItems.Add("Show", Show); _nicon.ContextMenu.MenuItems.Add("-"); _nicon.ContextMenu.MenuItems.Add("Quit", Close); _nicon.Visible = true; _nicon.DoubleClick += Show; Restart.IsEnabled = IntPtr.Size == (Environment.Is64BitOperatingSystem ? 8 : 4); if (!Restart.IsEnabled) { Restart.ToolTip = "Windows Explorer on this machine can only be restarted from a " + (Environment.Is64BitOperatingSystem ? "64" : "32") + "-bit process."; } TB.Text = "CBFS Shell Samples - Copyright (C) 2021-2022 Callback Technologies, Inc. All rights reserved." + Environment.NewLine; TB.Text += "CBFS Shell Runtime Version " + typeof(ShellContext).Assembly.GetInformationalVersion() + Environment.NewLine + Environment.NewLine; TB.Text += "Web Drive Folder - " + (IntPtr.Size == 8 ? "64" : "32") + "bit - V" + Assembly.GetExecutingAssembly().GetInformationalVersion() + Environment.NewLine; AppendText(); Task.Run(async() => await PingServer()); }
static void Main() { Initializer = new callback.CBFSShell.Cbshellboost(); Initializer.ProductGUID = ProductID; const string testProperty = "ShellBoost.Samples.LocalFolder.IconUI"; string already = PropertySystem.GetPropertyDescription(testProperty, false) != null ? " (note: they are already registered)." : "."; Console.WriteLine("CBFS Shell Samples - Local Folder - Copyright (C) 2021-2022 Callback Technologies, Inc. All rights reserved."); Console.WriteLine("CBFS Shell Runtime Version " + typeof(ShellContext).Assembly.GetInformationalVersion()); Console.WriteLine(); Console.WriteLine("Press a key:"); Console.WriteLine(); Console.WriteLine(" '1' Register the native proxy, run this sample, and unregister on exit."); Console.WriteLine(" '2' Register the native proxy."); Console.WriteLine(" '3' Run this sample (the native proxy will need to be registered somehow for Explorer to display something)."); Console.WriteLine(" '4' Unregister the native proxy."); Console.WriteLine(" '5' Restart Windows Explorer."); Console.WriteLine(" '6' Register Custom Properties for this sample" + already + (DiagnosticsInformation.GetTokenElevationType() == TokenElevationType.Full ? string.Empty : " You need to restart as admin.")); Console.WriteLine(" '7' Unregister Custom Properties for this sample." + (DiagnosticsInformation.GetTokenElevationType() == TokenElevationType.Full ? string.Empty : " You need to restart as admin.")); Console.WriteLine(); Console.WriteLine(" Any other key will exit."); Console.WriteLine(); string schemaLocation = new ShellFolderConfiguration().ExtractAssemblyResource(typeof(Program).Namespace + ".Resources.LocalFolder.propdesc"); do { var key = Console.ReadKey(true); if (key.Key == ConsoleKey.Escape) { return; } switch (key.KeyChar) { case '1': Register(true); // Important - Initialize must be called before using ShellBoost (except the calls to Install and Uninstall methods) Initializer.Initialize(); Run(); Initializer.PerUserInstallation = true; Initializer.Uninstall(); return; case '2': Register(true); break; case '3': // Important - Initialize must be called before using ShellBoost (except the calls to Install and Uninstall methods) Initializer.Initialize(); Run(); return; case '4': Initializer.PerUserInstallation = true; try { Initializer.Uninstall(); Console.WriteLine("Unregistered"); } catch (Exception ex) { Console.WriteLine("EXCEPTION: "); Console.WriteLine(ex.Message); } break; case '5': var rm = new RestartManager(); rm.RestartExplorerProcesses((state) => { Console.WriteLine("Explorer was stopped. Press any key to restart it ..."); Console.ReadKey(true); }, false, out Exception error); if (error != null) { Console.WriteLine("An error has occurred in restart manager: " + error); } break; case '6': try { PropertySystem.RegisterPropertySchema(schemaLocation); Console.WriteLine("Properties are registered. Schema location is: " + schemaLocation); } catch (Exception e) { Console.WriteLine("Properties cannot be registered: " + e.Message); } if (PropertySystem.GetPropertyDescription(testProperty, false) != null) { Console.WriteLine("Properties can be successfully retrieved from database."); } break; case '7': try { PropertySystem.UnregisterPropertySchema(schemaLocation); Console.WriteLine("Properties are unregistered."); } catch (Exception e) { Console.WriteLine("Properties cannot be unregistered: " + e.Message); } if (PropertySystem.GetPropertyDescription(testProperty, false) != null) { Console.WriteLine("Properties can be successfully retrieved from database. They should not."); } break; } }while (true); }
static void Main(string[] args) { Initializer = new callback.CBFSShell.Cbshellboost(); Initializer.ProductGUID = ProductID; Console.WriteLine("ShellBoost Samples - Registry Folder - Copyright (C) 2021-2022 Callback Technologies, Inc. All rights reserved."); Console.WriteLine("ShellBoost Runtime Version " + typeof(ShellContext).Assembly.GetInformationalVersion()); Console.WriteLine(); Console.WriteLine("Press a key:"); Console.WriteLine(); Console.WriteLine(" '0' Register Custom Properties for this sample." + (DiagnosticsInformation.GetTokenElevationType() == TokenElevationType.Full ? string.Empty : " You need to restart as admin.")); Console.WriteLine(" '1' Register the native proxy, run this sample, and unregister on exit."); Console.WriteLine(" '2' Register the native proxy."); Console.WriteLine(" '3' Run this sample (the native proxy will need to be registered somehow for Explorer to display something)."); Console.WriteLine(" '4' Unregister the native proxy."); Console.WriteLine(" '5' Restart Windows Explorer."); Console.WriteLine(); Console.WriteLine(" Any other key will exit."); Console.WriteLine(); var key = Console.ReadKey(true); switch (key.KeyChar) { case '1': Register(true); // Important - Initialize must be called before using ShellBoost (except the calls to Install and Uninstall methods) Initializer.Initialize(); Run(); Initializer.PerUserInstallation = true; Initializer.Uninstall(); return; case '2': Register(true); break; case '3': // Important - Initialize must be called before using ShellBoost (except the calls to Install and Uninstall methods) Initializer.Initialize(); Run(); return; case '4': Initializer.PerUserInstallation = true; try { Initializer.Uninstall(); Console.WriteLine("Unregistered"); } catch (Exception ex) { Console.WriteLine("EXCEPTION: "); Console.WriteLine(ex.Message); } break; case '5': var rm = new RestartManager(); rm.RestartExplorerProcesses((state) => { Console.WriteLine("Explorer was stopped. Press any key to restart it ..."); Console.ReadKey(true); }, false, out Exception error); if (error != null) { Console.WriteLine("An error has occurred in restart manager: " + error); } break; case '0': string location = new ShellFolderConfiguration().ExtractAssemblyResource(typeof(registryfolderDemo).Namespace + ".RegistryFolder.propdesc"); try { PropertySystem.RegisterPropertySchema(location); } catch (Exception e) { Console.WriteLine("Properties cannot be registered: " + e.Message); break; } Console.WriteLine("Properties are registered. Schema location: " + location); break; } }