Ejemplo n.º 1
0
        private void UpdateOSVersionList()
        {
            OSVersion.SelectedIndex = -1;
            OSVersion.Items.Clear();

            IList <RegistryLocations> registryLocations = ConfigParser.GetDefaultRegistryLocations();

            if (File.Exists(locations.OSFileLocation))
            {
                string json = File.ReadAllText(locations.OSFileLocation);
                try
                {
                    registryLocations = JsonConvert.DeserializeObject <IList <RegistryLocations> >(json);
                }
                catch (JsonSerializationException)
                {
                    showErrorMessage("The OS file selected is not formatted properly. Will proceed with default OS configurations.",
                                     "Incorrect OS Configuration File Format");
                }
            }

            foreach (RegistryLocations location in registryLocations)
            {
                if (!OSVersion.Items.Contains(location.OperatingSystem))
                {
                    OSVersion.Items.Add(location.OperatingSystem);
                }
            }
        }