void CreateCarFile() //Saved_data_Dyna.csv 생성 { if (!System.IO.File.Exists(Dyna_Data.getPath()) || new FileInfo(Dyna_Data.getPath()).Length == 0) { string filePath = Dyna_Data.getPath(); StreamWriter outStream = System.IO.File.CreateText(filePath); Dyna temp = new Dyna { EyeLocation_x = "0", EyeLocation_y = "0" }; Dyna_Data.Dyna.Add(temp); string str = Dyna_Data.Dyna[0].EyeLocation_x + "," + Dyna_Data.Dyna[0].EyeLocation_y; outStream.WriteLine("EyeLocation_x,EyeLocation_y"); outStream.WriteLine(str); outStream.Close(); } else { List <Dictionary <string, object> > data = CSVReader.Read(@Dyna_Data.getPath()); for (var i = 0; i < data.Count; i++) { Dyna mt = new Dyna(); mt.EyeLocation_x = data[i]["EyeLocation_x"].ToString(); mt.EyeLocation_y = data[i]["EyeLocation_y"].ToString(); Dyna_Data.Dyna.Add(mt); } } }
void UpdateCarFile() //Saved_data_Dyna.csv에 값 덮어쓰기 { string filePath = Dyna_Data.getPath(); StreamWriter outStream = System.IO.File.CreateText(filePath); outStream.WriteLine("Time,EyeLocation_x,EyeLocation_y,CheckPoint,LightOn"); for (int i = 0; i < Dyna_Data.Dyna.Count; i++) { string str = Dyna_Data.Dyna[i].t_Time + "," + Dyna_Data.Dyna[i].EyeLocation_x + "," + Dyna_Data.Dyna[i].EyeLocation_y + "," + Dyna_Data.Dyna[i].CheckPoint + "," + Dyna_Data.Dyna2[i].LightOn; outStream.WriteLine(str); } outStream.Close(); }