예제 #1
0
        public void ChangeSettings()
        {
            TextFileRedactor.SetValueOfLine(FileSettings, 0, "-", ";", ValueShowWrods + "");
            TextFileRedactor.SetValueOfLine(FileSettings, 1, "-", ";", ValueMustTrueAnswer + "");
            FileSettings[2] = strFI;
            FileSettings[3] = StrFIsafe;

            File.Delete("Settings.txt");
            File.WriteAllLines("Settings.txt", FileSettings);
        }
예제 #2
0
        void GenerateStatisticFile()
        {
            List <string> generateFile = TextFileRedactor.GenerateFileStatistic(new List <string>(File.ReadAllLines(openFileDialog.FileName)), this);

            if (TextFileRedactor.work)
            {
                generateFile = TextFileRedactor.Sorting(generateFile, "-", ";");
                Dispatcher.Invoke(() => { SetValueProgress(100, true); });
                Dispatcher.Invoke(() => { File.WriteAllLines("Statistic/" + textBoxEnterNameStatisticF.Text + ".txt", generateFile); });
            }
        }
예제 #3
0
        void ShowStatistics()
        {
            int AllPercent = 0;

            foreach (string el in FileWords)
            {
                AllPercent += TextFileRedactor.GetPercentOfLine(el);
            }

            ProgBarOfWord.Value  = TextFileRedactor.GetPercentOfNF(FileWords, labelWord.Content.ToString());
            ProgBarOfWords.Value = (int)Math.Round(((float)AllPercent) / FileWords.Count);
        }
예제 #4
0
        public void ClikResetProgrees(object sender, RoutedEventArgs e)
        {
            for (int i = 0; i < FileWords.Count; i++)
            {
                FileWords = TextFileRedactor.SetValueOfLine(FileWords, i, ";", ",", "0");
                FileWords = TextFileRedactor.SetValueOfLine(FileWords, i, ",", ":", "0");
                FileWords = TextFileRedactor.SetValueOfLine(FileWords, i, ":", "/", "" + ValueMustTrueAnswer);
            }

            File.Delete(strFI);
            File.WriteAllLines(strFI, FileWords);

            GenerateShowWords();
            GenerateQuestion();
        }
예제 #5
0
        void GenerateQuestion()
        {
            CountAnswer = 0;

            if (TextFileRedactor.GetCountLinesOfValue(FileWords, 2) == FileWords.Count)
            {
                ActivBtn = false;
                ShowEndStady();
            }
            else
            {
                ResetProgress.Visibility = Visibility.Hidden;

                foreach (Button item in ButtonsAns)
                {
                    item.Visibility = Visibility.Visible;
                }

                ActivBtn = true;
                Random rand = new Random();

                for (int i = 1; i < 7; i++)
                {
                    int r = rand.Next(TextFileRedactor.GetCountLinesOfValue(FileWords, 2), FileWords.Count - 1 - TextFileRedactor.GetCountLinesOfValue(FileWords, 0));

                    if (TextFileRedactor.IsEmptyString(TextFileRedactor.GetValueOfLine(FileWords[r])) == true)
                    {
                        MessageBox.Show("В файле иморта допущена ошибка! Номер строки: " + r, "Ошибка");
                    }

                    ButtonsAns[i].Content    = TextFileRedactor.GetValueOfLine(FileWords[r]);
                    ButtonsAns[i].Foreground = new SolidColorBrush(Color.FromRgb(0, 0, 0));
                    ButtonsAns[i].Background = new LinearGradientBrush(Color.FromRgb(90, 90, 90), Color.FromRgb(190, 190, 190), new Point(0, 0.5), new Point(0.5, 1));
                    labelMain.Foreground     = new SolidColorBrush(Color.FromRgb(255, 255, 255));
                    labelMain.Background     = new SolidColorBrush(Color.FromRgb(55, 55, 55));
                    labelMain.Content        = "";
                    labelAnswer.Content      = "";
                }

                int minRand = TextFileRedactor.GetCountLinesOfValue(FileWords, 2);
                int maxRand = minRand + (TextFileRedactor.GetCountLinesOfValue(FileWords, 1));

                labelWord.Content = TextFileRedactor.GetNameOfLine(FileWords[rand.Next(minRand, maxRand)]);
                ButtonsAns[rand.Next(1, 6)].Content = TextFileRedactor.GetValueNF(FileWords, labelWord.Content.ToString());

                ShowStatistics();
            }
        }
예제 #6
0
        void InspectionAnswer(string answer, int NumberBtn)
        {
            if (TextFileRedactor.GetValueNF(FileWords, labelWord.Content.ToString()) == answer)
            {
                ActivBtn             = false;
                labelMain.Background = new SolidColorBrush(Color.FromRgb(22, 95, 22));
                labelMain.Content    = "Верно!";
            }
            else
            {
                ActivBtn             = false;
                labelMain.Background = new SolidColorBrush(Color.FromRgb(95, 22, 22));
                labelMain.Content    = "Не верно!";
                labelAnswer.Content  = labelWord.Content + " - " + TextFileRedactor.GetValueNF(FileWords, labelWord.Content.ToString());
            }

            ResoultCount();
        }
예제 #7
0
        void PostClick(int NumberBtn)
        {
            if (CountAnswer < 0)
            {
                CountAnswer = 0;
            }

            if (TextFileRedactor.GetValueNF(FileWords, labelWord.Content.ToString()) == ButtonsAns[NumberBtn].Content.ToString())
            {
                for (int i = 1; i < 7; i++)
                {
                    ButtonsAns[i].Foreground = new SolidColorBrush(Color.FromRgb(0, 0, 0));
                    ButtonsAns[i].Background = new LinearGradientBrush(Color.FromRgb(90, 90, 90), Color.FromRgb(190, 190, 190), new Point(0, 0.5), new Point(0.5, 1));
                }

                ButtonsAns[NumberBtn].Background = new LinearGradientBrush(Color.FromRgb(0, 210, 0), Color.FromRgb(0, 150, 0), new Point(0.5, 1), new Point(0.5, 0));
                ButtonsAns[NumberBtn].Foreground = new SolidColorBrush(Color.FromRgb(0, 0, 0));

                CountAnswer += 1;
            }
            else if (TextFileRedactor.GetValueNF(FileWords, labelWord.Content.ToString()) != ButtonsAns[NumberBtn].Content.ToString())
            {
                for (int i = 1; i < 7; i++)
                {
                    ButtonsAns[i].Foreground = new SolidColorBrush(Color.FromRgb(0, 0, 0));
                    ButtonsAns[i].Background = new LinearGradientBrush(Color.FromRgb(90, 90, 90), Color.FromRgb(190, 190, 190), new Point(0, 0.5), new Point(0.5, 1));
                }

                ButtonsAns[NumberBtn].Background = new LinearGradientBrush(Color.FromRgb(80, 10, 10), Color.FromRgb(120, 40, 40), new Point(0.5, 1), new Point(0.5, 0));
                ButtonsAns[NumberBtn].Foreground = new SolidColorBrush(Color.FromRgb(250, 250, 250));

                CountAnswer -= 1;
            }

            if (ActivBtn)
            {
                InspectionAnswer(ButtonsAns[NumberBtn].Content.ToString(), NumberBtn);
            }

            if (CountAnswer == 2)
            {
                GenerateQuestion();
            }
        }
예제 #8
0
        void ResoultCount()
        {
            string lineOfFile   = "";
            int    LineIdOfFile = 0;

            foreach (var item in FileWords)
            {
                if (labelWord.Content.ToString() == TextFileRedactor.GetNameOfLine(item))
                {
                    lineOfFile = item;
                    break;
                }
                LineIdOfFile++;
            }

            float tAns = (float)Convert.ToInt32(TextFileRedactor.GetValueOfLine(lineOfFile, ",", ":"));
            float fAns = (float)Convert.ToInt32(TextFileRedactor.GetValueOfLine(lineOfFile, ":", "/"));

            //Console.WriteLine(Math.Round(tAns/fAns * 100));

            if (labelAnswer.Content.ToString().Length == 0 && (Math.Round(tAns / fAns * 100)) >= 100)
            {
                //Console.WriteLine(LineIdOfFile);
                FileWords = TextFileRedactor.SetValueOfLine(FileWords, LineIdOfFile, ",", ":", ((int)tAns) + 1 + "");
                FileWords = TextFileRedactor.SetValueOfLine(FileWords, LineIdOfFile, ";", ",", 2 + "");
                GenerateShowWords();
            }
            else if (labelAnswer.Content.ToString().Length == 0 && (Math.Round(tAns / fAns * 100)) < 100)
            {
                FileWords = TextFileRedactor.SetValueOfLine(FileWords, LineIdOfFile, ",", ":", ((int)tAns) + 1 + "");
            }
            else if (labelAnswer.Content.ToString().Length > 0)
            {
                FileWords = TextFileRedactor.SetValueOfLine(FileWords, LineIdOfFile, ":", "/", ((int)fAns) + 1 + "");
            }

            Sorting();

            File.Delete(strFI);
            File.WriteAllLines(strFI, FileWords);

            ShowStatistics();
        }
예제 #9
0
        public void LoadFile()
        {
            if (File.Exists("Settings.txt"))
            {
                FileSettings = new List <string>(File.ReadAllLines("Settings.txt"));

                string nameLine = "";

                nameLine            = TextFileRedactor.GetNameOfLine(FileSettings[0]);
                ValueShowWrods      = Convert.ToInt32(TextFileRedactor.DeleteSpace(TextFileRedactor.GetValueNF(FileSettings, nameLine)));
                nameLine            = TextFileRedactor.GetNameOfLine(FileSettings[1]);
                ValueMustTrueAnswer = Convert.ToInt32(TextFileRedactor.DeleteSpace(TextFileRedactor.GetValueNF(FileSettings, nameLine)));
                strFI     = FileSettings[2];
                strFIsafe = FileSettings[3];
            }
            else
            {
                FileSettings.Add("ValueShowWrods-" + ValueShowWrods + ";");
                FileSettings.Add("ValeMustTrueAnswer-" + ValueMustTrueAnswer + ";");
                FileSettings.Add(strFI);
                FileSettings.Add(strFIsafe);

                File.WriteAllLines("Settings.txt", FileSettings);
            }

            StrFI     = FileSettings[2];
            FileWords = new List <string>(File.ReadAllLines(strFI));

            for (int i = 0; i < FileWords.Count; i++)
            {
                FileWords[i] = TextFileRedactor.LineConctructor(FileWords[i], ValueMustTrueAnswer);
            }

            File.Delete(strFI);
            File.WriteAllLines(strFI, FileWords);
        }
예제 #10
0
        private void test()
        {
            List <string> worbook  = new List <string>(File.ReadAllLines("WordBookAll.wordbok"));
            List <string> words    = new List <string>(File.ReadAllLines("Statistic/16 тысяч строк.txt"));
            List <string> worbook2 = new List <string>();

            string str = TextFileRedactor.GetValueNF(worbook, TextFileRedactor.GetNameOfLine(words[3] + " "));

            WindowProgress wndp = new WindowProgress(new WindowSettings(this));

            wndp.Show();

            for (int i = 0; i < words.Count; i++)
            {
                wndp.ProgBar.Value = Math.Round((double)i / (double)words.Count * (double)100);
                for (int j = 0; j < worbook.Count; j++)
                {
                    if (TextFileRedactor.DeleteSpace(TextFileRedactor.GetNameOfLine(words[i])) == TextFileRedactor.DeleteSpace(TextFileRedactor.GetNameOfLine(worbook[j])))
                    {
                        Console.WriteLine(TextFileRedactor.DeleteSpace(TextFileRedactor.GetNameOfLine(words[i])) + "\n" + TextFileRedactor.DeleteSpace(TextFileRedactor.GetNameOfLine(worbook[j])));
                        break;
                    }
                }
            }
        }
예제 #11
0
 void Sorting()
 {
     FileWords = TextFileRedactor.Sorting(FileWords);
     File.Delete(strFI);
     File.WriteAllLines(strFI, FileWords);
 }