private void LoadStaticFilesSettings(IConfiguration config)
        {
            var staticFilesEnabled = config[nameof(StaticFilesEnabled)];

            if (!string.IsNullOrEmpty(staticFilesEnabled))
            {
                if (bool.TryParse(staticFilesEnabled, out var buffer))
                {
                    StaticFilesEnabled = buffer;
                }
            }

            var staticFilesPaths = config[nameof(StaticFilesPaths)];

            if (!string.IsNullOrEmpty(staticFilesPaths))
            {
                StaticFilesPaths.Clear();
                var items = staticFilesPaths.Replace(" ", "").Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries);

                foreach (var item in items)
                {
                    StaticFilesPaths.Add(item);
                }
            }
        }
Beispiel #2
0
        private void LoadOtherSettings(NameValueCollection config)
        {
            if (!string.IsNullOrEmpty(config["DataPath"]))
            {
                DataPath = config["DataPath"];
            }

            if (!string.IsNullOrEmpty(config["StaticFilesPaths"]))
            {
                StaticFilesPaths.Clear();
                var items = config["StaticFilesPaths"].Replace(" ", "").Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries);

                foreach (var item in items)
                {
                    StaticFilesPaths.Add(item);
                }
            }

            if (!string.IsNullOrEmpty(config["StringTableFiles"]))
            {
                StringTableFiles.Clear();
                var items = config["StringTableFiles"].Replace(" ", "").Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries);

                foreach (var item in items)
                {
                    StringTableFiles.Add(item);
                }
            }
        }
        private void LoadOtherSettings(IConfiguration config)
        {
            var dataPath = config["DataPath"];

            if (!string.IsNullOrEmpty(dataPath))
            {
                DataPath = dataPath;
            }

            var staticFilesEnabled = config["StaticFilesEnabled"];

            if (!string.IsNullOrEmpty(staticFilesEnabled))
            {
                if (bool.TryParse(staticFilesEnabled, out var buffer))
                {
                    StaticFilesEnabled = buffer;
                }
            }

            var staticFilesPaths = config["StaticFilesPaths"];

            if (!string.IsNullOrEmpty(staticFilesPaths))
            {
                StaticFilesPaths.Clear();
                var items = staticFilesPaths.Replace(" ", "").Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries);

                foreach (var item in items)
                {
                    StaticFilesPaths.Add(item);
                }
            }

            var stringTableFiles = config["StringTableFiles"];

            if (string.IsNullOrEmpty(stringTableFiles))
            {
                return;
            }

            {
                StringTableFiles.Clear();
                var items = stringTableFiles.Replace(" ", "").Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries);

                foreach (var item in items)
                {
                    StringTableFiles.Add(item);
                }
            }
        }