/// <summary> /// Load data into the controls /// </summary> private void InitializeRegistryMappings() { // Populate the combo box with each of the applications for which we have already got // a registry mapping _applicationsFile = new ApplicationDefinitionsFile(); List <string> listRegistryMappings = new List <string>(); _applicationsFile.SetSection(ApplicationDefinitionsFile.APPLICATION_MAPPINGS_SECTION); _applicationsFile.EnumerateKeys(ApplicationDefinitionsFile.APPLICATION_MAPPINGS_SECTION, listRegistryMappings); // Iterate through the keys and create an application mapping object cbApplications.BeginUpdate(); cbApplications.Items.Clear(); // foreach (string thisKey in listRegistryMappings) { // The key is the application name, the value the registry mapping ApplicationRegistryMapping applicationMapping = new ApplicationRegistryMapping(thisKey); String mappings = _applicationsFile.GetString(thisKey, ""); if (thisKey == "Travel") { int a = 0; } applicationMapping.AddMapping(mappings); // Add this entry to the combo box noting that we store the object with it to make // it easier to display the registry keys when selected ValueListItem newItem = cbApplications.Items.Add(applicationMapping.ApplicationName); newItem.Tag = applicationMapping; } cbApplications.EndUpdate(); // Select the first entry cbApplications.SelectedIndex = 0; }
private void UpdateSerialNumberMappings() { List <SerialNumberMapping> lSerialNumberMappingsList = new List <SerialNumberMapping>(); ApplicationDefinitionsFile _applicationDefinitionsFile = new ApplicationDefinitionsFile(); List <string> listRegistryMappings = new List <string>(); _applicationDefinitionsFile.SetSection(ApplicationDefinitionsFile.APPLICATION_MAPPINGS_SECTION); _applicationDefinitionsFile.EnumerateKeys(ApplicationDefinitionsFile.APPLICATION_MAPPINGS_SECTION, listRegistryMappings); // Iterate through the keys and create an application mapping object foreach (string thisKey in listRegistryMappings) { // The key is the application name, the value the registry mapping ApplicationRegistryMapping applicationMapping = new ApplicationRegistryMapping(thisKey); string mappings = _applicationDefinitionsFile.GetString(thisKey, ""); applicationMapping.AddMapping(mappings); SerialNumberMapping lSerialNumberMapping = new SerialNumberMapping(); lSerialNumberMapping.ApplicationName = applicationMapping.ApplicationName; foreach (RegistryMapping lMapping in applicationMapping) { SerialNumberMappingsRegistryKey lSerialNumberMappingRegKey = new SerialNumberMappingsRegistryKey(); lSerialNumberMappingRegKey.RegistryKeyName = lMapping.RegistryKey; lSerialNumberMappingRegKey.RegistryKeyValue = lMapping.ValueName; lSerialNumberMapping.RegistryKeysList.Add(lSerialNumberMappingRegKey); } lSerialNumberMappingsList.Add(lSerialNumberMapping); } auditAgentScannerDefinition.SerialNumberMappingsList = lSerialNumberMappingsList; }
/// <summary> /// Read the mapping of publisher names and aliases from the ini file /// </summary> protected void ReadPublisherMappings() { try { // Select the PUBLISHERS section within the definitions file _definitionsFile.SetSection(PUBLISHERALIASES_SECTION); // ...and recover a list of the publishers List <string> listPublishers = new List <string>(); _definitionsFile.EnumerateKeys(PUBLISHERALIASES_SECTION, listPublishers); foreach (string thisKey in listPublishers) { if (thisKey != "") { string value = _definitionsFile.GetString(thisKey, ""); if (value != "") { this._publisherMappings.Add(thisKey, value); } } } } catch (Exception) { } }
/// <summary> /// Read the application serial numbers section of the configuration file /// </summary> /// <param name="rootKey"></param> protected void ReadSerials(RegistryKey rootKey) { try { ApplicationDefinitionsFile definitionsFile = new ApplicationDefinitionsFile(); definitionsFile.SetSection(APPLICATIONS_SECTION); List <string> listApplications = new List <string>(); definitionsFile.EnumerateKeys(APPLICATIONS_SECTION, listApplications); foreach (string thisKey in listApplications) { this.ProcessSerialsLine(rootKey, thisKey + "=" + definitionsFile.GetString(thisKey, "")); } } catch (Exception) { } }