public static void StoreMezzi(Mezzi myMezzi) { FileStream fs = new FileStream(FileNameMezzi, FileMode.Create); StreamWriter sw = new StreamWriter(fs); string jsonData = JsonConvert.SerializeObject(myMezzi); sw.WriteLine(jsonData); sw.Close(); fs.Close(); }
public static List <Mezzo> GetMezzi() { Mezzi ret = new Mezzi(); try { FileStream fs = new FileStream(FileNameMezzi, FileMode.Open); StreamReader sr = new StreamReader(fs); string jsonData = sr.ReadToEnd(); ret = JsonConvert.DeserializeObject <Mezzi>(jsonData); sr.Close(); fs.Close(); } catch (Exception ex) { Console.WriteLine(ex.Message); } return(ret.listMezzi); }
public frmMezzi() { listMezzi = new Mezzi(); InitializeComponent(); }