/// <summary> /// レジストリ情報を読み込む /// </summary> private void LoadRegistry() { InternalHostsSaveTarget = RegistryUtility.StrRegistryReadValue(Microsoft.Win32.RegistryHive.LocalMachine, LocalResources.m_gstrAutoHostsUpdateServiceRegistryPath, LocalResources.m_gstrInternalHostsTargetRegistryName); ExternalHostsSaveTarget = RegistryUtility.StrRegistryReadValue(Microsoft.Win32.RegistryHive.LocalMachine, LocalResources.m_gstrAutoHostsUpdateServiceRegistryPath, LocalResources.m_gstrExternalHostsTargetRegistryName); NetworkAuthenticationUsername = RegistryUtility.StrRegistryReadValue(Microsoft.Win32.RegistryHive.LocalMachine, LocalResources.m_gstrAutoHostsUpdateServiceRegistryPath, LocalResources.m_gstrNetworkAuthenticationUsernameName); int value = 0; if (RegistryUtility.FRegistryReadDwordValue(Microsoft.Win32.RegistryHive.LocalMachine, LocalResources.m_gstrAutoHostsUpdateServiceRegistryPath, LocalResources.m_gstrIsApplyInExternalHostsRegistryName, out value) == true) { IsApplyInExternalHosts = (value == 0) ? false : true; } if (RegistryUtility.FRegistryReadDwordValue(Microsoft.Win32.RegistryHive.LocalMachine, LocalResources.m_gstrAutoHostsUpdateServiceRegistryPath, LocalResources.m_gstrIsUpdateInternalHostsRegistryName, out value) == true) { IsUpdateInternalHosts = (value == 0) ? false : true; } if (RegistryUtility.FRegistryReadDwordValue(Microsoft.Win32.RegistryHive.LocalMachine, LocalResources.m_gstrAutoHostsUpdateServiceRegistryPath, LocalResources.m_gstrIsNetworkAuthenticationName, out value) == true) { IsNetworkAuthentication = (value == 0) ? false : true; } internalHostsPathTextBox.Text = InternalHostsSaveTarget; externalHostsPathTextBox.Text = ExternalHostsSaveTarget; networkAuthenticationUsernameTextBox.Text = NetworkAuthenticationUsername; networkAuthenticationPasswordPasswordBox.Password = CryptUtility.DecryptString(RegistryUtility.RGBRegistryReadBinaryValue(Microsoft.Win32.RegistryHive.LocalMachine, LocalResources.m_gstrAutoHostsUpdateServiceRegistryPath, LocalResources.m_gstrNetworkAuthenticationPasswordName)); internalHostsPathCheckBox.IsChecked = IsUpdateInternalHosts; externalHostsPathCheckBox.IsChecked = IsApplyInExternalHosts; networkAuthenticationCheckBox.IsChecked = IsNetworkAuthentication; }
/// <summary> /// レジストリ情報を読み込む /// </summary> private void LoadRegistry() { string strInternalHostsSaveTarget = RegistryUtility.StrRegistryReadValue(Microsoft.Win32.RegistryHive.LocalMachine, LocalResources.m_gstrAutoHostsUpdateServiceRegistryPath, LocalResources.m_gstrInternalHostsTargetRegistryName); string strExternalHostsSaveTarget = RegistryUtility.StrRegistryReadValue(Microsoft.Win32.RegistryHive.LocalMachine, LocalResources.m_gstrAutoHostsUpdateServiceRegistryPath, LocalResources.m_gstrExternalHostsTargetRegistryName); internalHostsSaveTargetCollection = strInternalHostsSaveTarget.Split(new char[] { ';' }).Select(x => x.Trim()).Where(x => !string.IsNullOrWhiteSpace(x)); externalHostsSaveTargetCollection = strExternalHostsSaveTarget.Split(new char[] { ';' }).Select(x => x.Trim()).Where(x => !string.IsNullOrWhiteSpace(x)); NetworkAuthenticationUsername = RegistryUtility.StrRegistryReadValue(Microsoft.Win32.RegistryHive.LocalMachine, LocalResources.m_gstrAutoHostsUpdateServiceRegistryPath, LocalResources.m_gstrNetworkAuthenticationUsernameName); NetworkAuthenticationPassword = CryptUtility.DecryptString(RegistryUtility.RGBRegistryReadBinaryValue(Microsoft.Win32.RegistryHive.LocalMachine, LocalResources.m_gstrAutoHostsUpdateServiceRegistryPath, LocalResources.m_gstrNetworkAuthenticationPasswordName)); int value = 0; if (RegistryUtility.FRegistryReadDwordValue(Microsoft.Win32.RegistryHive.LocalMachine, LocalResources.m_gstrAutoHostsUpdateServiceRegistryPath, LocalResources.m_gstrIsApplyInExternalHostsRegistryName, out value) == true) { IsApplyInExternalHosts = (value == 0) ? false : true; } if (RegistryUtility.FRegistryReadDwordValue(Microsoft.Win32.RegistryHive.LocalMachine, LocalResources.m_gstrAutoHostsUpdateServiceRegistryPath, LocalResources.m_gstrIsUpdateInternalHostsRegistryName, out value) == true) { IsUpdateInternalHosts = (value == 0) ? false : true; } if (RegistryUtility.FRegistryReadDwordValue(Microsoft.Win32.RegistryHive.LocalMachine, LocalResources.m_gstrAutoHostsUpdateServiceRegistryPath, LocalResources.m_gstrIsNetworkAuthenticationName, out value) == true) { IsNetworkAuthentication = (value == 0) ? false : true; } }