コード例 #1
0
        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();
        }
コード例 #2
0
        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);
        }
コード例 #3
0
 public frmMezzi()
 {
     listMezzi = new Mezzi();
     InitializeComponent();
 }