public void StartMethod() { SaveToFile saveFile = new SaveToFile(); string pathToFile = @"D:\test.txt"; bool isqutting = false; string command; string commandDo; string txt; while (isqutting == false) { txt = Console.ReadLine(); string[] splitInput = txt.Trim().Split(new char[] { ' ' }, 2); command = CleanText(splitInput[0]).ToLower(); if (splitInput.Length == 1) { if (command == "showall") { PrintList(OpenFileList(pathToFile)); } else if (command == "quit") { isqutting = true; } else if (command == "") { Console.WriteLine("You entered nothing"); } else { Console.WriteLine("Need more for this command"); } } else { commandDo = CleanText(splitInput[1]); switch (command) { case "addperson": Console.WriteLine("Name was has been added"); saveFile.SaveContent(pathToFile, commandDo, command); break; case "deleteperson": bool isDeleted = false; for (int i = 0; i < OpenFileList(pathToFile).Count; i += 1) { if (OpenFileList(pathToFile)[i] == commandDo) { saveFile.SaveContent(pathToFile, commandDo, command); Console.WriteLine("Name was has been deleted"); isDeleted = true; break; } } if (isDeleted == false) { Console.WriteLine("Name is not on the list"); } break; case "changeperson": bool matcthes = false; splitInput = commandDo.Trim().Split(new char[] { ' ' }, 2); for (int i = 0; i < OpenFileList(pathToFile).Count; i += 1) { if (OpenFileList(pathToFile)[i] == splitInput[0]) { saveFile.SaveContent(pathToFile, splitInput[0] + " " + splitInput[1], command); Console.WriteLine("Name has been changed"); matcthes = true; break; } } if (matcthes == false) { Console.WriteLine("Name is not on the list"); } break; case "changeage": saveFile.SaveContent(pathToFile, commandDo, command); break; default: Console.WriteLine("Not a command"); break; } } } }