ZeroInstall.Publish.Capture.SnapshotDiff.GetInstallCommands C# (CSharp) Method

GetInstallCommands() private static method

Retrieves commands the application registered for use by Windows' "Set Program Access and Defaults".
There was an error accessing the registry. Read access to the registry was not permitted.
private static GetInstallCommands ( [ clientKey, [ installationDir ) : InstallCommands
clientKey [ The registry key containing the application's registration data.
installationDir [ The fully qualified path to the installation directory.
return InstallCommands
        private static InstallCommands GetInstallCommands([NotNull] RegistryKey clientKey, [NotNull] string installationDir)
        {
            #region Sanity checks
            if (clientKey == null) throw new ArgumentNullException(nameof(clientKey));
            if (string.IsNullOrEmpty(installationDir)) throw new ArgumentNullException(nameof(installationDir));
            #endregion

            using (var installInfoKey = clientKey.OpenSubKey(DesktopIntegration.Windows.DefaultProgram.RegSubKeyInstallInfo))
            {
                if (installInfoKey == null) return default(InstallCommands);

                string reinstallArgs;
                string reinstall = IsolateCommand(installInfoKey.GetValue(DesktopIntegration.Windows.DefaultProgram.RegValueReinstallCommand, "").ToString(), installationDir, out reinstallArgs);

                string showIconsArgs;
                string showIcons = IsolateCommand(installInfoKey.GetValue(DesktopIntegration.Windows.DefaultProgram.RegValueShowIconsCommand, "").ToString(), installationDir, out showIconsArgs);

                string hideIconsArgs;
                string hideIcons = IsolateCommand(installInfoKey.GetValue(DesktopIntegration.Windows.DefaultProgram.RegValueHideIconsCommand, "").ToString(), installationDir, out hideIconsArgs);

                return new InstallCommands
                {
                    Reinstall = reinstall, ReinstallArgs = reinstallArgs,
                    ShowIcons = showIcons, ShowIconsArgs = showIconsArgs,
                    HideIcons = hideIcons, HideIconsArgs = hideIconsArgs
                };
            }
        }