/// <summary>
        /// Populate main configuration
        /// </summary>
        private void PopulateMainConfiguration()
        {
            var fp = Path.Combine(DirectoryManagement.sConfigurationFolderPath, SetupLibrary.Constants.AppConfigFileName);

            // Main configuration
            try
            {
                this.AppConfig = ConfigurationModel.LoadFromJSON(fp);
            }
            catch (Exception)
            {
                ConfigurationModel.RemoveConfiguration(fp);
                this.AppConfig = ConfigurationModel.GetDefaultConfigurationModel();
                this.AppConfig.SerializeInJSON(fp);
            }

            DesktopElementHelper.SetCorePropertiesList(this.AppConfig.CoreProperties);
        }
예제 #2
0
        public void ConfigurationModelTest()
        {
            string path = Path.Combine(testProvider.ConfigurationFolderPath, "config.test");

            var coreProps = DesktopElementHelper.GetDefaultCoreProperties();

            ConfigurationModel config = new ConfigurationModel
            {
                CoreProperties = coreProps,
                Version        = ConfigurationModel.CurrentVersion
            };

            config.SerializeInJSON(path);

            var newConfig = ConfigurationModel.LoadFromJSON(path, testProvider);

            File.Delete(path);

            Assert.IsTrue(coreProps.SequenceEqual(newConfig.CoreProperties));
        }
        /// <summary>
        /// Populate main configuration
        /// </summary>
        private void PopulateMainConfiguration()
        {
            var fp = Path.Combine(SettingsProvider.ConfigurationFolderPath, SetupLibrary.Constants.AppConfigFileName);

            // Main configuration
            try
            {
                this.AppConfig = ConfigurationModel.LoadFromJSON(fp, SettingsProvider);
            }
#pragma warning disable CA1031 // Do not catch general exception types
            catch (Exception e)
            {
                e.ReportException();
                ConfigurationModel.RemoveConfiguration(fp);
                this.AppConfig = ConfigurationModel.GetDefaultConfigurationModel(SettingsProvider);
                this.AppConfig.SerializeInJSON(fp);
            }
#pragma warning restore CA1031 // Do not catch general exception types

            DesktopElementHelper.SetCorePropertiesList(this.AppConfig.CoreProperties);
        }
 private IEnumerable <int> GetBasicPropertyList()
 {
     return(DesktopElementHelper.GetCorePropertiesList());
 }