Bloom.WebLibraryIntegration.BookDownloadSupport.RegisterForBloomUrlProtocol C# (CSharp) Method

RegisterForBloomUrlProtocol() public static method

Make sure this instance is registered (at least for this user) as the program to handle bloom:// urls. If we are installing for all users we can make it in a shared place.
public static RegisterForBloomUrlProtocol ( bool allUsers ) : void
allUsers bool
return void
        public static void RegisterForBloomUrlProtocol(bool allUsers)
        {
            if (SIL.PlatformUtilities.Platform.IsLinux)
            {
                // This will be done by the package installer.
                // To manually install it:
                // sudo cp debian/bloom.desktop /usr/share/applications
                // sudo update-desktop-database
                // (and bloom startup wrapper needs to be in the path)
                return;
            }
            var whereToInstall = allUsers ? Registry.LocalMachine : Registry.CurrentUser;
            var root = whereToInstall.CreateSubKey(@"Software\Classes");

            if (AlreadyRegistered(root))
                return;
            var key = root.CreateSubKey(@"bloom\shell\open\command");
            key.SetValue("", CommandToLaunchBloomOnWindows);

            key = root.CreateSubKey("bloom");
            key.SetValue("", "BLOOM:URL Protocol");
            key.SetValue("URL Protocol", "");
        }