Witam,
Chciałbym napisać program, który będzie obsługiwał komendy takie jak
add: I prosi o podanie imię nazwisko wiek
list: wyswietla listę osób w katalogu
remove: usuwa
detail : wyświetla szczegóły osoby
open : otwiera plik. (z json i xml)
save : zapisuje plik (w json i xml)
jestem póki co na takim etapie
i moje pytanie jest następujące....
w codzie ponizej jest File i on nie posiada opcji jak np remove lub detail, add
Potrzebuje podpowiedzi typu jaka metoda, link itp
Będę wdzięczny
string path2 = @"logowanie6.txt";
Console.WriteLine("Hej! Przedstaw się. Twoje dane będą zapisane w pliku o nazwie logowanie6.txt");
if (!File.Exists(path2))
{
using (StreamWriter sw = File.CreateText(path2))
{
sw.WriteLine("Osoby, które logowały się: ");
}
}
using (StreamWriter sw = File.AppendText(path2))
{
string namesurname = Console.ReadLine();
sw.WriteLine(namesurname);
}
using (StreamReader sr = File.OpenText(path2))
{
string s = "";
while ((s = sr.ReadLine()) != null)
{
Console.WriteLine(s);
}
}