Пример #1
0
        private void CreateNewTopicsConfigurationFile(TopicsConfiguration topicsConfiguration)
        {
            var text = JsonSerializer.Serialize(topicsConfiguration, new JsonSerializerOptions {
                WriteIndented = true
            });

            File.WriteAllText(configFileNew, text, Encoding.UTF8);
        }
Пример #2
0
        public void Update(TopicsConfiguration topicsConfiguration)
        {
            CreateNewTopicsConfigurationFile(topicsConfiguration);

            if (File.Exists(configFile))
            {
                File.Delete(configFile);
            }

            File.Move(configFileNew, configFile);
        }
Пример #3
0
        private void UpdateTopicsConfiguration()
        {
            var newConfig = new TopicsConfiguration
            {
                Topics = topics.Keys.Select(x => new TopicConfiguration
                {
                    Name = x
                }).ToList()
            };

            topicsConfigurationStorage.Update(newConfig);
        }