iControl.ConnectionInfo.migrateOldSettings C# (CSharp) Method

migrateOldSettings() public method

public migrateOldSettings ( ) : void
return void
        public void migrateOldSettings()
        {
            Microsoft.Win32.RegistryKey cu = Microsoft.Win32.Registry.CurrentUser;
            Microsoft.Win32.RegistryKey f5Key = cu.CreateSubKey(CONFIG_KEY);
            if (null != f5Key)
            {
                Object obj = null;
                if (null != (obj = f5Key.GetValue("Hostname")))
                {
                    m_hostname = Convert.ToString(obj);
                    f5Key.DeleteValue("Hostname");

                    Microsoft.Win32.RegistryKey accountKey = f5Key.CreateSubKey("Accounts\\" + m_hostname);
                    if (null != accountKey)
                    {
                        accountKey.SetValue("Hostname", m_hostname);

                        // Create account and delete keys
                        if (null != (obj = f5Key.GetValue("Port")))
                        {
                            m_port = Convert.ToInt32(obj);
                            accountKey.SetValue("Port", m_port);
                            f5Key.DeleteValue("Port");

                        }
                        if (null != (obj = f5Key.GetValue("Username")))
                        {
                            m_username = Convert.ToString(obj);
                            accountKey.SetValue("Username", m_username);
                            f5Key.DeleteValue("Username");
                        }
                        accountKey.Close();
                    }
                }
                f5Key.Close();
            }
        }