Exemple #1
0
        /// <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;
        }
Exemple #2
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 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)
     {
     }
 }
Exemple #4
0
        /// <summary>
        /// Called to add a new Publisher to the list of those available to filter on.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void bnNewPublisher_Click(object sender, EventArgs e)
        {
            FormAskInput1 form = new FormAskInput1("Please enter a name for the new Publisher.", "New Publisher", "Name:");

            if (form.ShowDialog() == DialogResult.OK)
            {
                string newPublisher = form.ValueEntered();

                // Ensure that this value does not duplicate an existing publisher either in the available or selected lists
                foreach (string publisher in lbAvailablePublishers.Items)
                {
                    if (newPublisher == publisher)
                    {
                        MessageBox.Show("The Publisher Specified already exists an has not been added.", "Publisher Exists");
                        return;
                    }
                }

                // Ensure that this value does not duplicate an existing publisher in the selected lists
                foreach (string publisher in lbFilteredPublishers.Items)
                {
                    if (newPublisher == publisher)
                    {
                        MessageBox.Show("The publisher specified already exists and has not been added.", "Publisher Exists");
                        return;
                    }
                }

                // Ok this is a new Publisher so add it to the definitions file
                ApplicationDefinitionsFile definitionsFile = new ApplicationDefinitionsFile();
                definitionsFile.SetSection(ApplicationDefinitionsFile.PUBLISHERS_SECTION);
                definitionsFile.SetString(newPublisher, "", true);

                // ...and add it to the 'available' publishers list
                lbAvailablePublishers.Items.Add(newPublisher);
            }
        }