public void Save() { // Proxy server HTTPHelper.ProxyStyle new_proxy_style = DirectConnectionRadioButton.Checked ? HTTPHelper.ProxyStyle.DirectConnection : UseIERadioButton.Checked ? HTTPHelper.ProxyStyle.SystemProxy : HTTPHelper.ProxyStyle.SpecifiedProxy; if (Properties.Settings.Default.ProxySetting != (int)new_proxy_style) { Properties.Settings.Default.ProxySetting = (int)new_proxy_style; } if (ProxyAddressTextBox.Text != Properties.Settings.Default.ProxyAddress && ProxyAddressTextBox.Text != "") { Properties.Settings.Default.ProxyAddress = ProxyAddressTextBox.Text; } if (new_proxy_style == HTTPHelper.ProxyStyle.SpecifiedProxy) { SetSpecifiedProxySettings(); } int timeout = (int)ConnectionTimeoutNud.Value; if (timeout * 1000 != Properties.Settings.Default.ConnectionTimeout) { Properties.Settings.Default.ConnectionTimeout = timeout * 1000; } Program.ReconfigureConnectionSettings(); }
public void UpdateProxy(string proxy) { log.Info("Receive proxy update message"); try { string[] proxySettings = proxy.Split(SEPARATOR); HTTPHelper.ProxyStyle proxyStyle = (HTTPHelper.ProxyStyle)Int32.Parse(proxySettings[1]); switch (proxyStyle) { case HTTPHelper.ProxyStyle.SpecifiedProxy: Properties.Settings.Default.ProxySetting = (Int32)proxyStyle; Properties.Settings.Default.ProxyAddress = proxySettings[2]; Properties.Settings.Default.ProxyPort = Int32.Parse(proxySettings[3]); Properties.Settings.Default.ConnectionTimeout = Int32.Parse(proxySettings[4]); Properties.Settings.Default.BypassProxyForLocal = bool.Parse(proxySettings[5]); return; case HTTPHelper.ProxyStyle.SystemProxy: Properties.Settings.Default.ProxySetting = (Int32)proxyStyle; return; default: Properties.Settings.Default.ProxySetting = (Int32)proxyStyle; return; } } catch (Exception e) { log.Error("Error parsing 'ProxySetting' from XenCenter", e); } }
public void Save() { // Proxy server settings HTTPHelper.ProxyStyle new_proxy_style = DirectConnectionRadioButton.Checked ? HTTPHelper.ProxyStyle.DirectConnection : UseIERadioButton.Checked ? HTTPHelper.ProxyStyle.SystemProxy : HTTPHelper.ProxyStyle.SpecifiedProxy; if (Properties.Settings.Default.ProxySetting != (int)new_proxy_style) { Properties.Settings.Default.ProxySetting = (int)new_proxy_style; } if (ProxyAddressTextBox.Text != Properties.Settings.Default.ProxyAddress && !string.IsNullOrEmpty(ProxyAddressTextBox.Text)) { Properties.Settings.Default.ProxyAddress = ProxyAddressTextBox.Text; } Properties.Settings.Default.ProxyUsername = EncryptionUtils.Protect(ProxyUsernameTextBox.Text); Properties.Settings.Default.ProxyPassword = EncryptionUtils.Protect(ProxyPasswordTextBox.Text); Properties.Settings.Default.ProvideProxyAuthentication = AuthenticationCheckBox.Checked; HTTP.ProxyAuthenticationMethod new_auth_method = BasicRadioButton.Checked ? HTTP.ProxyAuthenticationMethod.Basic : HTTP.ProxyAuthenticationMethod.Digest; if (Properties.Settings.Default.ProxyAuthenticationMethod != (int)new_auth_method) { Properties.Settings.Default.ProxyAuthenticationMethod = (int)new_auth_method; } try { int port = int.Parse(ProxyPortTextBox.Text); if (port != Properties.Settings.Default.ProxyPort) { Properties.Settings.Default.ProxyPort = port; } } catch { Properties.Settings.Default.ProxyPort = 80; } if (BypassForServersCheckbox.Checked != Properties.Settings.Default.BypassProxyForServers) { Properties.Settings.Default.BypassProxyForServers = BypassForServersCheckbox.Checked; } // timeout settings int timeout = (int)ConnectionTimeoutNud.Value; if (timeout * 1000 != Properties.Settings.Default.ConnectionTimeout) { Properties.Settings.Default.ConnectionTimeout = timeout * 1000; } Program.ReconfigureConnectionSettings(); Core.HealthCheck.SendProxySettingsToHealthCheck(); }
public TransferProxySettingsAction(HTTPHelper.ProxyStyle style, string address, int port, int timeout, bool bypassLocal, bool suppressHistory) : base(null, Messages.ACTION_TRANSFER_HEALTHCHECK_SETTINGS, Messages.ACTION_TRANSFER_HEALTHCHECK_SETTINGS, suppressHistory) { proxyStyle = style; proxyAddress = address; proxyPort = port; timeOut = timeout; bypassForLocal = bypassLocal; }
public TransferProxySettingsAction(HTTPHelper.ProxyStyle style, string address, int port, int timeout, bool bypassLocal, bool suppressHistory) : base(null, Messages.ACTION_TRANSFER_HEALTHCHECK_SETTINGS, Messages.ACTION_TRANSFER_HEALTHCHECK_SETTINGS, suppressHistory) { proxyStyle = style; proxyAddress = address; proxyPort = port; timeOut = timeout; bypassForLocal = bypassLocal; }
public TransferProxySettingsAction(HTTPHelper.ProxyStyle style, string address, int port, int timeout, bool suppressHistory, bool bypassForServer, bool provideCredentials, string username, string password, HTTP.ProxyAuthenticationMethod proxyAuthMethod) : base(null, Messages.ACTION_TRANSFER_HEALTHCHECK_SETTINGS, Messages.ACTION_TRANSFER_HEALTHCHECK_SETTINGS, suppressHistory) { proxyStyle = style; proxyAddress = address; proxyPort = port; timeOut = timeout; bypassProxyForServers = bypassForServer; provideProxyCredentials = provideCredentials; proxyUsername = username; proxyPassword = password; proxyAuthenticationMethod = proxyAuthMethod; }
public void UpdateProxy(string proxy) { log.Info("Receive proxy update message"); try { string[] proxySettings = proxy.Split(SEPARATOR); if (proxySettings.Length < 2) { return; } HTTPHelper.ProxyStyle proxyStyle = (HTTPHelper.ProxyStyle)Int32.Parse(proxySettings[1]); switch (proxyStyle) { case HTTPHelper.ProxyStyle.SpecifiedProxy: Properties.Settings.Default.ProxySetting = (Int32)proxyStyle; Properties.Settings.Default.ProxyAddress = proxySettings[2]; Properties.Settings.Default.ProxyPort = Int32.Parse(proxySettings[3]); Properties.Settings.Default.ConnectionTimeout = Int32.Parse(proxySettings[4]); Properties.Settings.Default.BypassProxyForServers = bool.Parse(proxySettings[5]); Properties.Settings.Default.ProvideProxyAuthentication = bool.Parse(proxySettings[6]); Properties.Settings.Default.ProxyUsername = EncryptionUtils.Protect(EncryptionUtils.UnprotectForLocalMachine(proxySettings[7])); Properties.Settings.Default.ProxyPassword = EncryptionUtils.Protect(EncryptionUtils.UnprotectForLocalMachine(proxySettings[8])); Properties.Settings.Default.ProxyAuthenticationMethod = Int32.Parse(proxySettings[9]); break; case HTTPHelper.ProxyStyle.SystemProxy: Properties.Settings.Default.ProxySetting = (Int32)proxyStyle; break; default: Properties.Settings.Default.ProxySetting = (Int32)proxyStyle; break; } Properties.Settings.Default.Save(); XenServerHealthCheckService.ReconfigureConnectionSettings(); } catch (Exception e) { log.Error("Error parsing 'ProxySetting' from XenCenter", e); } }