private static void saveValues()
 {
     try {
         RegistryKey root = Registry.CurrentUser.CreateSubKey(Constants.PAZU_REG_KEY);
         if (root == null)
         {
             throw new Exception();
         }
         root.SetValue(REG_ISSUE_BATCH_SIZE, JiraIssuesBatch);
         root.SetValue(REG_AUTOUPDATE, AutoupdateEnabled ? 1 : 0);
         root.SetValue(REG_CHECK_SNAPSHOTS, AutoupdateSnapshots ? 1 : 0);
         root.SetValue(REG_REPORT_USAGE, ReportUsage ? 1 : 0);
         root.SetValue(REG_MANUAL_UPDATE_STABLE_ONLY, CheckStableOnlyNow ? 1 : 0);
         root.SetValue(REG_BAMBOO_POLLING_INTERVAL, BambooPollingInterval);
         root.SetValue(REG_JIRA_SERVER_EXPLORER, JiraServerExplorerEnabled ? 1 : 0);
         root.SetValue(REG_ANKH_SNV_ENABLED, AnkhSvnIntegrationEnabled ? 1 : 0);
         root.SetValue(REG_NETWORK_TIMEOUT, NetworkTimeout);
         root.SetValue(REG_PROXY_TYPE, proxyTypeToSave.GetStringValue());
         root.SetValue(REG_PROXY_HOST, proxyHost);
         root.SetValue(REG_PROXY_PORT, proxyPort);
         root.SetValue(REG_PROXY_USE_AUTH, proxyUseAuth ? 1 : 0);
         root.SetValue(REG_PROXY_USER, proxyUser);
         root.SetValue(REG_PROXY_PASSWORD, DPApi.encrypt(proxyPassword, PASSWORD_ENTROPY));
         int issueLinksDisabled = IssueLinksInEditorDisabled
                                      ? (IssueLinksInEditorDisabledForAllFiles ? 2 : 1)
                                      : 0;
         root.SetValue(REG_ISSUE_LINKS_DISABLED, issueLinksDisabled);
         root.SetValue(REG_ISSUE_LINKS_MAX_FILE_LENGTH, MaxIssueLinksInEditorFileSize);
     } catch (Exception e) {
         MessageBox.Show("Unable to save values to registry: " + e.Message, Constants.ERROR_CAPTION,
                         MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
        static GlobalSettings()
        {
            try {
                RegistryKey root = Registry.CurrentUser.CreateSubKey(Constants.PAZU_REG_KEY);
                if (root == null)
                {
                    throw new Exception();
                }
                JiraIssuesBatch                       = (int)root.GetValue(REG_ISSUE_BATCH_SIZE, DEFAULT_ISSUE_BATCH_SIZE);
                AutoupdateEnabled                     = (int)root.GetValue(REG_AUTOUPDATE, 1) > 0;
                AutoupdateSnapshots                   = (int)root.GetValue(REG_CHECK_SNAPSHOTS, 0) > 0;
                ReportUsage                           = (int)root.GetValue(REG_REPORT_USAGE, 1) > 0;
                CheckStableOnlyNow                    = (int)root.GetValue(REG_MANUAL_UPDATE_STABLE_ONLY, 1) > 0;
                BambooPollingInterval                 = (int)root.GetValue(REG_BAMBOO_POLLING_INTERVAL, DEFAULT_BAMBOO_POLLING_INTERVAL);
                JiraServerExplorerEnabled             = (int)root.GetValue(REG_JIRA_SERVER_EXPLORER, 0) > 0;
                AnkhSvnIntegrationEnabled             = (int)root.GetValue(REG_ANKH_SNV_ENABLED, 0) > 0;
                NetworkTimeout                        = (int)root.GetValue(REG_NETWORK_TIMEOUT, 10);
                IssueLinksInEditorDisabled            = (int)root.GetValue(REG_ISSUE_LINKS_DISABLED, 0) > 0;
                IssueLinksInEditorDisabledForAllFiles = (int)root.GetValue(REG_ISSUE_LINKS_DISABLED, 0) > 1;
                MaxIssueLinksInEditorFileSize         = (int)root.GetValue(REG_ISSUE_LINKS_MAX_FILE_LENGTH, DEFAULT_MAX_ISSUE_LINKS_FILE_LEN);

                string proxy = (string)root.GetValue(REG_PROXY_TYPE, ProxyType.SYSTEM.GetStringValue());
                if (proxy.Equals(ProxyType.CUSTOM.GetStringValue()))
                {
                    currentProxyType = ProxyType.CUSTOM;
                }
                else if (proxy.Equals(ProxyType.NONE.GetStringValue()))
                {
                    currentProxyType = ProxyType.NONE;
                }
                else
                {
                    currentProxyType = ProxyType.SYSTEM;
                }
                proxyHost     = (string)root.GetValue(REG_PROXY_HOST, "");
                proxyPort     = (int)root.GetValue(REG_PROXY_PORT, 0);
                proxyUseAuth  = ((int)root.GetValue(REG_PROXY_USE_AUTH, 0)) == 1;
                proxyUser     = (string)root.GetValue(REG_PROXY_USER, "");
                proxyPassword = DPApi.decrypt((string)root.GetValue(REG_PROXY_PASSWORD, ""), PASSWORD_ENTROPY);
            } catch (Exception) {
                JiraIssuesBatch                       = DEFAULT_ISSUE_BATCH_SIZE;
                AutoupdateEnabled                     = true;
                AutoupdateSnapshots                   = false;
                ReportUsage                           = true;
                CheckStableOnlyNow                    = true;
                BambooPollingInterval                 = DEFAULT_BAMBOO_POLLING_INTERVAL;
                JiraServerExplorerEnabled             = false;
                AnkhSvnIntegrationEnabled             = false;
                NetworkTimeout                        = DEFAULT_JIRA_TIMEOUT;
                IssueLinksInEditorDisabled            = false;
                IssueLinksInEditorDisabledForAllFiles = false;
                MaxIssueLinksInEditorFileSize         = DEFAULT_MAX_ISSUE_LINKS_FILE_LEN;
                currentProxyType                      = ProxyType.SYSTEM;
                proxyHost     = "";
                proxyPort     = 0;
                proxyUseAuth  = false;
                proxyUser     = "";
                proxyPassword = "";
            }

            proxyTypeToSave = currentProxyType;
        }