public Form1() { InitializeComponent(); autoCopyPwd.Checked = bool.Parse(ConfigAppSettings.GetValue("AutoCopyPwd", "false")); msPath.Text = ConfigAppSettings.GetValue("msPath", ""); if (msPath.Text == "") { string dir_reg_0 = dir_reg.Replace("HKEY_LOCAL_MACHINE\\", "").Replace("HKEY_CURRENT_USER\\", ""); try { ModifyRegistry myRegistry = new ModifyRegistry(); myRegistry.BaseRegistryKey = Registry.CurrentUser; myRegistry.SubKey = dir_reg_0; if (myRegistry.Read(dir_value_name) != "") { ConfigAppSettings.SetValue("msPath", myRegistry.Read(dir_value_name)); msPath.Text = myRegistry.Read(dir_value_name); } else { myRegistry.BaseRegistryKey = Registry.LocalMachine; myRegistry.SubKey = dir_reg_0; if (myRegistry.Read(dir_value_name) != "") { ConfigAppSettings.SetValue("msPath", myRegistry.Read(dir_value_name)); msPath.Text = myRegistry.Read(dir_value_name); } } } catch { } } }
private void autoCopyPwd_CheckedChanged(object sender, EventArgs e) { bool config = bool.Parse(ConfigAppSettings.GetValue("AutoCopyPwd", "false")); if (autoCopyPwd.Checked != config) { ConfigAppSettings.SetValue("AutoCopyPwd", autoCopyPwd.Checked.ToString()); } }
private void msPath_Click(object sender, EventArgs e) { OpenFileDialog ofd = new OpenFileDialog(); ofd.Title = "請選擇楓之谷主程式"; ofd.Filter = "楓之谷主程式|MapleStory.exe"; if (ofd.ShowDialog() == System.Windows.Forms.DialogResult.OK) { msPath.Text = ofd.FileName; ConfigAppSettings.SetValue("msPath", msPath.Text); } }