private static void AddFreddyToRegistry() { _key = Registry.CurrentUser.CreateSubKey("SpringIocQuickStartVariableSources"); _key.SetValue("freddy_name", "Freddy Rumsen"); _key.SetValue("freddy_age", 44, RegistryValueKind.DWord); _key.Flush(); }
private static void AddFreddyToRegistry() { _key = Registry.CurrentUser.CreateSubKey(_subkey); _key.SetValue("freddy_name", "Freddy Rumsen"); _key.SetValue("freddy_age", 44, RegistryValueKind.DWord); _key.Flush(); }
public Configuration() { OperatingSystem os = Environment.OSVersion; Console.WriteLine ("OS platform: " + os.Platform); this.platform = os.Platform.ToString (); if (this.platform.StartsWith ("Win")) { RegistryKey CurrentUserKey = Microsoft.Win32.Registry.CurrentUser; string OurAppKeyStr = @"SOFTWARE\moNotationalVelocity"; OurAppRootKey = CurrentUserKey.CreateSubKey (OurAppKeyStr); ConfigKey = OurAppRootKey.CreateSubKey ("config"); this.notesDirPath = ConfigKey.GetValue ("notesDirPath") as string; if (this.notesDirPath == null) { Console.WriteLine ("No configuration"); this.notesDirPath = defaulNotesDirtPath; ConfigKey.SetValue ("notesDirPath", this.notesDirPath, RegistryValueKind.String); } ConfigKey.Flush (); } else { this.notesDirPath = defaulNotesDirtPath; } }
public void SetUp() { key = Registry.CurrentUser.CreateSubKey("RegistryVariableSourceTests"); key.SetValue("name", "Aleks Seovic"); key.SetValue("computer_name", "%COMPUTERNAME% is the name of my computer", RegistryValueKind.ExpandString); key.SetValue("age", 32, RegistryValueKind.DWord); key.SetValue("family", new string[] {"Marija", "Ana", "Nadja"}); key.SetValue("bday", new byte[] {24, 8, 74}); key.Flush(); }
private void DisableService(RegistryKey regkey, System.Windows.Forms.ComboBox serviceComboBox, System.Windows.Forms.CheckBox enableCheckBox) { serviceComboBox.Enabled = false; if (regkey.ValueCount > 0) { string[] names = regkey.GetValueNames(); serviceComboBox.Text = names[0]; foreach (string service in names) { regkey.SetValue(service, "False"); } regkey.Flush(); } }
private void saveConfigurationData() { try { regConnectionDetails = Registry.CurrentUser.OpenSubKey("Software\\OyRemote\\ConnectionDetails", true); regConnectionDetails.SetValue("AmplifierIP", txtIP.Text); regConnectionDetails.SetValue("AmplifierPort", txtPort.Text); regConnectionDetails.SetValue("BatchDelay", batchDelay); regConnectionDetails.SetValue("Autoconnect", checkBoxAutoConnect.Checked); regConnectionDetails.SetValue("CheckVolume", checkBoxVolumeContinuous.Checked); regBatchCommands = Registry.CurrentUser.OpenSubKey("Software\\OyRemote\\BatchCommands", true); regBatchCommands.SetValue("Batch1Name", textBoxBatchName1.Text); regBatchCommands.SetValue("Batch1Command", textBoxBatchCommand1.Text); regBatchCommands.SetValue("Batch1Autorun", checkBoxAutorunBatch1.Checked); regBatchCommands.SetValue("Batch2Name", textBoxBatchName2.Text); regBatchCommands.SetValue("Batch2Command", textBoxBatchCommand2.Text); regBatchCommands.SetValue("Batch2Autorun", checkBoxAutorunBatch2.Checked); regBatchCommands.SetValue("Batch3Name", textBoxBatchName3.Text); regBatchCommands.SetValue("Batch3Command", textBoxBatchCommand3.Text); regBatchCommands.SetValue("Batch3Autorun", checkBoxAutorunBatch3.Checked); regBatchCommands.SetValue("Batch4Name", textBoxBatchName4.Text); regBatchCommands.SetValue("Batch4Command", textBoxBatchCommand4.Text); regBatchCommands.SetValue("Batch4Autorun", checkBoxAutorunBatch4.Checked); regBatchCommands.SetValue("Batch5Name", textBoxBatchName5.Text); regBatchCommands.SetValue("Batch5Command", textBoxBatchCommand5.Text); regBatchCommands.SetValue("Batch5Autorun", checkBoxAutorunBatch5.Checked); regBatchCommands.SetValue("Batch6Name", textBoxBatchName6.Text); regBatchCommands.SetValue("Batch6Command", textBoxBatchCommand6.Text); regBatchCommands.SetValue("Batch6Autorun", checkBoxAutorunBatch6.Checked); for (int i = 0; i < numberOfLMDPresets; i++) { regLMDpresets.SetValue(("LMD" + i + "Label"), lmdPreset[i].getLabel()); regLMDpresets.SetValue(("LMD" + i + "Preset"), lmdPreset[i].getCommand()); } } catch (Exception e) { Console.WriteLine(e.Message); } regConnectionDetails.Flush(); regConnectionDetails.Close(); }
//Calls the flush method, to make the write effective. public void PersistKeyChanges(RegistryKey parentKey) { log("Flushing contents of key: " + parentKey.Name +"."); //parentKey.Close(); ///When the key is closed, it is automatically flushed. parentKey.Flush(); }