public static Config LoadConfigFromRegistry() { Config config = new Config(); RegistryKey regkey = Registry.CurrentUser.CreateSubKey(REGISTRY_KEY); config.scriptEditorCommand = (string)regkey.GetValue("ScriptEditorCommand", ""); config.scriptEditorArgumentsFilename = (string)regkey.GetValue("ScriptEditorArgumentsFilename", ""); config.scriptEditorArgumentsLine = (string)regkey.GetValue("ScriptEditorArgumentsLine", ""); regkey.Close(); return config; }
private bool IsChanged(Config c) { if (c.scriptEditorCommand != ScriptEditorCommandTextBox.Text || c.scriptEditorArgumentsFilename != ScriptEditorArgumentsFilenameTextBox.Text || c.scriptEditorArgumentsLine != ScriptEditorArgumentsLineTextBox.Text) { return true; } return false; }
public static bool SaveConfigToRegistry(Config config) { try { RegistryKey regkey = Registry.CurrentUser.CreateSubKey(REGISTRY_KEY); regkey.SetValue("ScriptEditorCommand", config.scriptEditorCommand); regkey.SetValue("ScriptEditorArgumentsFilename", config.scriptEditorArgumentsFilename); regkey.SetValue("ScriptEditorArgumentsLine", config.scriptEditorArgumentsLine); regkey.Close(); } catch { return false; } return true; }
public Form1() { InitializeComponent(); config = API.LoadConfigFromRegistry(); PushConfig(config); }
private void PushConfig(Config c) { ScriptEditorCommandTextBox.Text = c.scriptEditorCommand; ScriptEditorArgumentsFilenameTextBox.Text = c.scriptEditorArgumentsFilename; ScriptEditorArgumentsLineTextBox.Text = c.scriptEditorArgumentsLine; }
private void PullConfig(Config c) { c.scriptEditorCommand = ScriptEditorCommandTextBox.Text; c.scriptEditorArgumentsFilename = ScriptEditorArgumentsFilenameTextBox.Text; c.scriptEditorArgumentsLine = ScriptEditorArgumentsLineTextBox.Text; }