// Token: 0x060001EE RID: 494 RVA: 0x000336C0 File Offset: 0x000318C0 public void WriteLoaiPhong2CSV(string strFilePath, LoaiPhong loaiPhong) { bool flag = !File.Exists(strFilePath); if (flag) { string[] strHeader = new string[] { "Tên loại phòng", "Màu chữ", "Màu nền", "Hiển thị", "Ghi chú" }; this.WriteHeaderFile(strFilePath, strHeader); } string[] value = new string[] { loaiPhong.strTenLoaiPhong, loaiPhong.iMauChu.ToString(), loaiPhong.iMauNen.ToString(), loaiPhong.strTenHienThi, loaiPhong.strGhiChu }; this.sbOutput = new StringBuilder(); this.sbOutput.AppendLine(string.Join(",", value)); File.AppendAllText(strFilePath, this.sbOutput.ToString(), Encoding.UTF8); }
// Token: 0x060001F1 RID: 497 RVA: 0x00033DE4 File Offset: 0x00031FE4 public List <LoaiPhong> ReadLoaiPhongFromCSV(string strFilePath) { List <LoaiPhong> result; try { List <LoaiPhong> list = new List <LoaiPhong>(); LoaiPhong loaiPhong = new LoaiPhong(); using (StreamReader streamReader = new StreamReader(strFilePath)) { string text = streamReader.ReadLine(); while (!streamReader.EndOfStream) { text = streamReader.ReadLine(); string[] array = text.Split(new char[] { ',' }); loaiPhong = new LoaiPhong(); int num = 0; loaiPhong.strTenLoaiPhong = array[num]; loaiPhong.iMauChu = Convert.ToInt32(array[num + 1]); loaiPhong.iMauNen = Convert.ToInt32(array[num + 2]); loaiPhong.strTenHienThi = array[num + 3]; loaiPhong.strGhiChu = array[num + 4]; bool flag = loaiPhong != null; if (flag) { list.Add(loaiPhong); } } } result = list; } catch { result = null; } return(result); }