public static bool Load() { try { Language = (string)registry.GetValue("Language", null); Channel = (string)registry.GetValue("Channel", null); if (Language == null) { using (LanguagePrompt languagePrompt = new LanguagePrompt()) { languagePrompt.ShowDialog(); Language = languagePrompt.Result; } } if (Channel == null) { Channel = defaultChannel[Language]; } DisplayLocation = new Point((int)registry.GetValue("DisplayLocationX", 0), (int)registry.GetValue("DisplayLocationY", 0)); DisplaySize = new Size((int)registry.GetValue("DisplayWidth", 0), (int)registry.GetValue("DisplayHeight", 0)); AutoFaction = Convert.ToBoolean((string)registry.GetValue("AutoFaction", "True")); GameFaction = (string)registry.GetValue("GameFaction", "actor_stalker"); ManualFaction = (string)registry.GetValue("ManualFaction", "actor_stalker"); Name = (string)registry.GetValue("Name", CRCStrings.RandomIrcName(GetFaction())); SendDeath = Convert.ToBoolean((string)registry.GetValue("SendDeath", "True")); ReceiveDeath = Convert.ToBoolean((string)registry.GetValue("ReceiveDeath", "True")); DeathInterval = (int)registry.GetValue("DeathInterval", 0); ShowTimestamps = Convert.ToBoolean((string)registry.GetValue("ShowTimestamps", "True")); NewsDuration = (int)registry.GetValue("NewsDuration", 10); ChatKey = (string)registry.GetValue("ChatKey", "RETURN"); NewsSound = Convert.ToBoolean((string)registry.GetValue("NewsSound", "True")); CloseChat = Convert.ToBoolean((string)registry.GetValue("CloseChat", "True")); Save(); return(true); } catch (Exception ex) when(ex is SecurityException || ex is UnauthorizedAccessException) { return(false); } }
private void buttonRandom_Click(object sender, EventArgs e) { string faction = radioButtonFactionAuto.Checked ? CRCOptions.GameFaction : indexToFaction[comboBoxFaction.SelectedIndex]; textBoxName.Text = CRCStrings.RandomIrcName(faction); }