public static void updateRegistryValue(SettingData userSetting) { try { RegistryKey keyValue = Registry.CurrentUser.OpenSubKey(@"SOFTWARE\EventViewerVisualizer", true); if (keyValue != null) { keyValue.SetValue("SystemName", Encryption.Encrypt(userSetting.SystemName.ToString(), "EventViewerVisualizer")); keyValue.SetValue("TXNPath", Encryption.Encrypt(userSetting.TXNPath, "EventViewerVisualizer")); keyValue.SetValue("TellerFilter", userSetting.UserFilter); keyValue.SetValue("TXNFilter", userSetting.TXNFilter); keyValue.SetValue("CustomFilter", userSetting.DBDetails); keyValue.SetValue("LogName", userSetting.LogName); keyValue.SetValue("Source", userSetting.Source); //key.SetValue("DecryptPassword", passwordDecrypt(passwordEncrypt("*****@*****.**", "ProgrammingUtility"), "ProgrammingUtility")); keyValue.Close(); } else { RegistryKey key = Registry.CurrentUser.CreateSubKey(@"SOFTWARE\EventViewerVisualizer"); key.SetValue("SystemName", Encryption.Encrypt(userSetting.SystemName.ToString(), "EventViewerVisualizer")); key.SetValue("TXNPath", Encryption.Encrypt(userSetting.TXNPath, "EventViewerVisualizer")); key.SetValue("TellerFilter", userSetting.UserFilter); key.SetValue("TXNFilter", userSetting.TXNFilter); key.SetValue("CustomFilter", userSetting.DBDetails); key.SetValue("LogName", userSetting.LogName); key.SetValue("Source", userSetting.Source); //key.SetValue("DecryptPassword", passwordDecrypt(passwordEncrypt("*****@*****.**", "ProgrammingUtility"), "ProgrammingUtility")); key.Close(); } } catch (Exception ex) { } }
public void fillSettingsDetails() { settingData = new SettingData(); settingData = Utility.getSettingDetails(); textBoxSystem.Text = settingData.SystemName; textBoxTXNLocation.Text = settingData.TXNPath; textBoxTeller.Text = settingData.UserFilter; textBoxTXN.Text = settingData.TXNFilter; textBoxDBDetails.Text = settingData.DBDetails; textBoxLogName.Text = settingData.LogName; textBoxSource.Text = settingData.Source; }
public static SettingData getSettingDetails() { SettingData settingData = new SettingData(); RegistryKey key = Registry.CurrentUser.OpenSubKey(@"SOFTWARE\EventViewerVisualizer"); if (key != null) { settingData.SystemName = Decryption.Decrypt(key.GetValue("SystemName").ToString(), "EventViewerVisualizer"); settingData.TXNPath = Decryption.Decrypt(key.GetValue("TXNPath").ToString(), "EventViewerVisualizer"); settingData.UserFilter = key.GetValue("TellerFilter").ToString(); settingData.TXNFilter = key.GetValue("TXNFilter").ToString(); settingData.DBDetails = key.GetValue("CustomFilter").ToString(); settingData.LogName = key.GetValue("LogName").ToString(); settingData.Source = key.GetValue("Source").ToString(); key.Close(); } else { settingData = null; } return(settingData); }