Ejemplo n.º 1
0
        private void DriveThread(object state)
        {
            var logger = new Logger(this);
            var config = new ShellFolderConfiguration();

            config.Logger = logger;

            ShellFolderServer.RegisterNativeDll(RegistrationMode.User);
            ShellUtilities.RefreshShellViews();

            do
            {
                try
                {
                    using (_server = new OnDemandShellFolderServer(new DirectoryInfo(DriveService.AllRootsPath)))
                    {
                        _server.Start(config);
                        AppendText("Started listening on proxy id " + ShellFolderServer.ProxyId);
                        _serverStopEvent.WaitOne();
                        _server = null;
                        return;
                    }
                }
                catch (Exception e)
                {
                    logger.Log(TraceLevel.Error, "An error occurred: " + e);
                    Thread.Sleep(1000);
                }
            }while (true);
        }
Ejemplo n.º 2
0
        static void Main()
        {
            Console.WriteLine("ShellBoost Samples - CloudFolder" + (Core.Client.Installer.IsNetCore ? null : "Fx") + " - " + (IntPtr.Size == 4 ? "32" : "64") + "-bit - Copyright (C) 2017-" + DateTime.Now.Year + " Aelyo Softworks. All rights reserved.");
            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':
                    Run(true);
                    ShellFolderServer.UnregisterNativeDll(RegistrationMode.User);
                    break;

                case '2':
                    ShellFolderServer.RegisterNativeDll(new ShellFolderRegistration(RegistrationMode.User)
                    {
                        EnumerationBatchSize = 1000
                    });
                    Console.WriteLine("Registered");
                    break;

                case '3':
                    Run(false);
                    break;

                case '4':
                    ShellFolderServer.UnregisterNativeDll(RegistrationMode.User);
                    Console.WriteLine("Unregistered");
                    break;

                default:
                    return;
                }
            } while (true);
        }
Ejemplo n.º 3
0
        static void Main(string[] args)
        {
            Console.WriteLine("ShellBoost Samples - Physical Overview - " + (IntPtr.Size == 4 ? "32" : "64") + "-bit - Copyright (C) 2017-" + DateTime.Now.Year + " Aelyo Softworks. 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':
                    Run(true);
                    ShellFolderServer.UnregisterNativeDll(RegistrationMode.User);
                    break;

                case '2':
                    ShellFolderServer.RegisterNativeDll(RegistrationMode.User);
                    Console.WriteLine("Registered");
                    break;

                case '3':
                    Run(false);
                    break;

                case '4':
                    ShellFolderServer.UnregisterNativeDll(RegistrationMode.User);
                    Console.WriteLine("Unregistered");
                    break;

                default:
                    return;
                }
            } while (true);
        }
Ejemplo n.º 4
0
        static void Main()
        {
            Console.WriteLine("ShellBoost Samples - SevenZip Folder - Copyright (C) 2017-" + DateTime.Now.Year + " Aelyo Softworks. 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, 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':
                Run();
                break;

            case '2':
                ShellFolderServer.UnregisterNativeDll(RegistrationMode.User);
                UnregisterAsVirtualFolder(".7z");
                Console.WriteLine("Unregistered");
                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;
            }
        }
Ejemplo n.º 5
0
        static void Main()
        {
            // this source is used by two projects: Overview (.NET Framework) and CoreOverview (.NET Core 3+)
            Console.WriteLine("ShellBoost Samples - " + (Core.Client.Installer.IsNetCore? "Core" : null) + "Overview - " + (IntPtr.Size == 4 ? "32" : "64") + "-bit - Copyright (C) 2017-" + DateTime.Now.Year + " Aelyo Softworks. 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();
            var key = Console.ReadKey(true);

            switch (key.KeyChar)
            {
            case '1':
                Run(true);
                ShellFolderServer.UnregisterNativeDll(RegistrationMode.User);
                break;

            case '2':
                ShellFolderServer.RegisterNativeDll(RegistrationMode.User);
                Console.WriteLine("Registered");
                break;

            case '3':
                Run(false);
                break;

            case '4':
                ShellFolderServer.UnregisterNativeDll(RegistrationMode.User);
                Console.WriteLine("Unregistered");
                break;
            }
        }
Ejemplo n.º 6
0
        static void Main()
        {
            const string testProperty = "ShellBoost.Samples.LocalFolder.IconUI";
            string       already      = PropertySystem.GetPropertyDescription(testProperty, false) != null ? " (note: they are already registered)." : ".";

            Console.WriteLine("ShellBoost Samples - Local Folder - Copyright (C) 2017-" + DateTime.Now.Year + " Aelyo Softworks. 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("   '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':
                    Run(true);
                    ShellFolderServer.UnregisterNativeDll(RegistrationMode.User);
                    return;

                case '2':
                    ShellFolderServer.RegisterNativeDll(RegistrationMode.User);
                    Console.WriteLine("Registered");
                    break;

                case '3':
                    Run(false);
                    return;

                case '4':
                    ShellFolderServer.UnregisterNativeDll(RegistrationMode.User);
                    Console.WriteLine("Unregistered");
                    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);
        }
Ejemplo n.º 7
0
        static void Main(string[] args)
        {
            Console.WriteLine("ShellBoost Samples - Registry Folder - Copyright (C) 2017-" + DateTime.Now.Year + " Aelyo Softworks. 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("   '5' Restart Windows Explorer.");
            Console.WriteLine("   '6' Register 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();
            var key = Console.ReadKey(true);

            switch (key.KeyChar)
            {
            case '1':
                Run(true);
                ShellFolderServer.UnregisterNativeDll(RegistrationMode.User);
                break;

            case '2':
                ShellFolderServer.RegisterNativeDll(RegistrationMode.User);
                Console.WriteLine("Registered");
                break;

            case '3':
                Run(false);
                break;

            case '4':
                ShellFolderServer.UnregisterNativeDll(RegistrationMode.User);
                Console.WriteLine("Unregistered");
                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':
                string location = new ShellFolderConfiguration().ExtractAssemblyResource(typeof(Program).Namespace + ".Resources.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;
            }
        }
Ejemplo n.º 8
0
 private void Unregister_Click(object sender, RoutedEventArgs e)
 {
     ShellFolderServer.UnregisterNativeDll(RegistrationMode.User);
     ShellUtilities.RefreshShellViews();
     AppendText("Native proxy was unregistered from HKCU.");
 }