<commit_before>﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Diagnostics;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Xml.Serialization;

namespace RussianVocabularyHelper
{
    public partial class Main : Form
    {
        #region Vars/Properties
        private List<Word> wordList;
        private Config appConfig;
        private string configFilename;
        #endregion

        #region Constructor(s)
        public Main()
        {
            InitializeComponent();

            wordList = new List<Word>();
            configFilename = "config.xml";
        }
        #endregion

        #region Methods
        private void clearFields()
        {
            tbEnglish.Text = tbRussian.Text = string.Empty;
        }

        private void loadWordList()
        {
            if(!File.Exists(appConfig.DBFilePath))
            {
                return;
            }

            wordList = null;
            DeserializeObject<List<Word>>(ref wordList, appConfig.DBFilePath);

            dgv.DataSource = null;
            dgv.DataSource = wordList;
        }

        private void saveWordList()
        {
            SerializeObject(wordList, appConfig.DBFilePath);
        }

        private void saveConfig()
        {
            SerializeObject(appConfig, configFilename);
        }

        private void loadConfig()
        {
            if (!File.Exists(configFilename))
            {
                var config = new Config();
                config.DBFilePath = "words.xml";
                saveConfig();
            }
            DeserializeObject<Config>(ref appConfig, configFilename);
        }

        private void showRandomWord(RandomWord.Mode mode)
        {
            var randomWordForm = new RandomWord(wordList);
            randomWordForm.SelectedMode = mode;
            this.Visible = false;
            randomWordForm.ShowDialog();
            this.Visible = true;
        }
        #endregion

        #region Events
        private void Main_Shown(object sender, EventArgs e)
        {
            loadConfig();
            loadWordList();
        }

        private void Submit_Click(object sender, EventArgs e)
        {<commit_msg>*code cleanup<commit_after>﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Diagnostics;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Xml.Serialization;

namespace RussianVocabularyHelper
{
    public partial class Main : Form
    {
        #region Vars/Properties
        private List<Word> wordList;
        private Config appConfig;
        private string configFilename;
        #endregion

        #region Constructor(s)
        public Main()
        {
            InitializeComponent();

            wordList = new List<Word>();
            configFilename = "config.xml";
        }
        #endregion

        #region Methods
        private void clearFields()
        {
            tbEnglish.Text = tbRussian.Text = string.Empty;
        }

        private void loadWordList()
        {
            if(!File.Exists(appConfig.DBFilePath))
            {
                return;
            }

            wordList = null;
            DeserializeObject(ref wordList, appConfig.DBFilePath);

            dgv.DataSource = null;
            dgv.DataSource = wordList;
        }

        private void saveWordList()
        {
            SerializeObject(wordList, appConfig.DBFilePath);
        }

        private void saveConfig()
        {
            SerializeObject(appConfig, configFilename);
        }

        private void loadConfig()
        {
            if (!File.Exists(configFilename))
            {
                var config = new Config();
                config.DBFilePath = "words.xml";
                saveConfig();
            }
            DeserializeObject(ref appConfig, configFilename);
        }

        private void showRandomWord(RandomWord.Mode mode)
        {
            var randomWordForm = new RandomWord(wordList);
            randomWordForm.SelectedMode = mode;
            this.Visible = false;
            randomWordForm.ShowDialog();
            this.Visible = true;
        }
        #endregion

        #region Events
        private void Main_Shown(object sender, EventArgs e)
        {
            loadConfig();
            loadWordList();
        }

        private void Submit_Click(object sender, EventArgs e)
        {
{'fraction_non_alphanumeric': 0.08147989734816082, 'fraction_numerical': 0.0, 'mean_word_length': 1.7034682080924854, 'pattern_counts': {'":': 0, '<': 10, '<?xml version=': 0, '>': 10, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 4}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4706408', 'n_tokens_mistral': 1168, 'n_tokens_neox': 1145, 'n_words': 267}