public void CanLoadConfigFileWithMissingSettings()
        {
            var configFile = ConfigFileLoader.LoadAndMergeConfigFile(Path.GetFullPath(@"Options\Assets\Folder2"));

            Assert.Empty(configFile.HlslPreprocessorDefinitions);
            Assert.Empty(configFile.HlslAdditionalIncludeDirectories);
        }
Example #2
0
 public void CanReadBootstrapConfig()
 {
     var loader = new ConfigFileLoader<ConfigFileLocator>("Bootstrap");
     var section = loader.GetSection<AppSettingsSection>("appSettings");
     Assert.IsNotNull(section);
     Assert.AreEqual("value", section.Settings["Test"].Value);
 }
Example #3
0
        public void CanReadBootstrapConfig()
        {
            var loader  = new ConfigFileLoader <ConfigFileLocator>("Bootstrap");
            var section = loader.GetSection <AppSettingsSection>("appSettings");

            Assert.IsNotNull(section);
            Assert.AreEqual("value", section.Settings["Test"].Value);
        }
Example #4
0
        public void GetDefaultConfigFilePath_ShouldReturnCorrectResult()
        {
            var filePath = new ConfigFileLoader().GetDefaultConfigFilePath();
            var fileName = Path.GetFileName(filePath);

            Assert.AreEqual(fileName, ConfigFileLoader.DefaultConfigFileName);
            Assert.AreNotEqual(filePath.Length, fileName.Length);
        }
Example #5
0
 public static ConfigFile GetConfigFile(this ITextBuffer textBuffer)
 {
     return(textBuffer.Properties.GetOrCreateSingletonProperty(ConfigFileKey,
                                                               () =>
     {
         var filePath = textBuffer.GetTextDocument()?.FilePath;
         if (filePath != null)
         {
             filePath = Path.GetDirectoryName(filePath);
         }
         return ConfigFileLoader.LoadAndMergeConfigFile(filePath);
     }));
 }
Example #6
0
        // TODO: Refactor this.
        public ConfigFile LoadConfigFile(SourceFile file)
        {
            var directory = Path.GetDirectoryName(file.FilePath);

            if (string.IsNullOrEmpty(directory))
            {
                return(new ConfigFile());
            }

            return(ImmutableInterlocked.GetOrAdd(
                       ref _configFiles,
                       directory.ToLower(),
                       x => ConfigFileLoader.LoadAndMergeConfigFile(x)));
        }
Example #7
0
        // TODO: Refactor this.
        public ConfigFile LoadConfigFile(SourceText sourceText)
        {
            var directory = Path.GetDirectoryName(sourceText.FilePath);

            if (directory == null)
            {
                return(new ConfigFile());
            }

            return(ImmutableInterlocked.GetOrAdd(
                       ref _configFiles,
                       directory.ToLower(),
                       x => ConfigFileLoader.LoadAndMergeConfigFile(x)));
        }
Example #8
0
        protected override async Task ExecuteAsync(CancellationToken stoppingToken)
        {
            var basePath         = Path.GetDirectoryName(Assembly.GetEntryAssembly().Location);
            var configFilePath   = Path.Combine(basePath, "SWSConfig.xml");
            var configFileLoader = new ConfigFileLoader(configFilePath);

            var configData = configFileLoader.GetConfigData();

            while (!stoppingToken.IsCancellationRequested)
            {
                _logger.LogInformation("Worker running at: {time}", DateTimeOffset.Now);
                _logger.LogInformation("InstallDate: {0} ", configData.InstallDate);
                _logger.LogInformation("JulianDate: {0}", configData.FromJulianDate);



                //InsertRecord();

                await Task.Delay(10000, stoppingToken);
            }
        }
Example #9
0
        private void ConfigLoad()
        {
            ConfigFileLoader configFileLoader = new ConfigFileLoader();
            var configPath = AppDomain.CurrentDomain.BaseDirectory.CombinePath(@"config.xml");

            DbConnectionInfoList = configFileLoader.GetConfigInfo(configPath);
            DatabaseSelectedList = DbConnectionInfoList.Select(t => t.ConnectionDatabase).Distinct().Select(t => new CheckboxSelectItem {
                Name = t, Checked = true
            }).ToList();
            PurposeSelectedList     = GetPurposeSelectedList();
            DescriptionSelectedList = GetDescriptionSelectedList();


            dbConnectionListView.ItemsSource = DbConnectionInfoList;
            databaseListBox.ItemsSource      = DatabaseSelectedList;
            purposeListBox.ItemsSource       = PurposeSelectedList;
            descriptionListBox.ItemsSource   = DescriptionSelectedList;

            CollectionView view = (CollectionView)CollectionViewSource.GetDefaultView(dbConnectionListView.ItemsSource);

            view.Filter = UserFilter;
        }
        public void CanLoadConfigFile()
        {
            var configFile = ConfigFileLoader.LoadAndMergeConfigFile(Path.GetFullPath(@"Options\Assets\ChildFolder\GrandchildFolder"));

            Assert.Equal(
                new Dictionary <string, string>
            {
                { "MY_DEFINE", "1" },
                { "MY_OTHER_DEFINE", "2" }
            },
                configFile.HlslPreprocessorDefinitions);

            var workingDirectory = Path.GetFullPath(@"Options\Assets");

            Assert.Equal(
                new string[]
            {
                Path.Combine(workingDirectory, "ChildFolder", "Bar"),
                Path.Combine(workingDirectory, "ChildFolder", "Foo"),
                Path.Combine(workingDirectory, "ChildFolder"),
                workingDirectory
            },
                configFile.HlslAdditionalIncludeDirectories);
        }
 public ConfigFileLoaderTest()
 {
     fileLoader = ConfigFileLoaderFactory.Make();
     arguments  = new CompilerArguments();
 }