public void loadFromRegistry(String sRequestedHostname)
{
migrateOldSettings();
Microsoft.Win32.RegistryKey cu = Microsoft.Win32.Registry.CurrentUser;
String accountKey = CONFIG_KEY;
if (sRequestedHostname.Length > 0)
{
accountKey = ACCOUNTS_KEY + "\\" + sRequestedHostname;
}
Microsoft.Win32.RegistryKey f5Key = cu.OpenSubKey(accountKey);
if (null != f5Key)
{
Object obj = null;
if (null != (obj = f5Key.GetValue("Hostname")))
{
m_hostname = Convert.ToString(obj);
}
if (null != (obj = f5Key.GetValue("Port")))
{
m_port = Convert.ToInt32(obj);
}
if (null != (obj = f5Key.GetValue("Username")))
{
m_username = Convert.ToString(obj);
}
if (null != (obj = f5Key.GetValue("UseProxy")))
{
if (null != (obj = f5Key.GetValue("ProxyHost")))
{
String address = Convert.ToString(obj);
int port = 8080;
if (null != (obj = f5Key.GetValue("ProxyPort")))
{
port = Convert.ToInt32(obj);
}
m_proxy = new System.Net.WebProxy(address, port);
if (null != (obj = f5Key.GetValue("ProxyUser")))
{
m_proxy.Credentials = new System.Net.NetworkCredential();
((System.Net.NetworkCredential)m_proxy.Credentials).UserName = Convert.ToString(obj);
}
else
{
m_proxy.UseDefaultCredentials = true;
}
}
}
else
{
m_proxy = null;
}
f5Key.Close();
}
}