Exemplo n.º 1
0
        private void WriteNewData(string filename)
        {
            ReadTxt readTxt = new ReadTxt()
            {
                FileName = filename
            };
            var items = readTxt.GetWords();

            if (items != null)
            {
                Config config = new Config();

                if (File.Exists("words.json"))
                {
                    config.ForbiddenWords = config.DeserializeWordsFromJson();
                    config.ForbiddenWords.AddRange(items);
                    config.SeriailizeWordsToJson();
                }
                else
                {
                    config.ForbiddenWords = items;
                }
                config.SeriailizeWordsToJson();
                wordViewModel.AllWords.AddRange(items);
            }
        }