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); }
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(); }
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(); }