예제 #1
0
 /// <summary>
 /// 创建文件
 /// </summary>
 public static void Create(DataFileEntity model)
 {
     FileStream fs = new FileStream(model.FilePath, FileMode.CreateNew);
     model.FileStream = fs;
     model.MaxPageID = 2;
     //写入0页
     DataPageManage.Write(new DataPageEntity { DataFile = model, ID = Config.DATABASE_PAGE_ID, Content = model.Database.ToBytes() });
     //写入1页
     DataPageManage.Write(new DataPageEntity { DataFile = model, ID = Config.DATAFILE_PAGE_ID, Content = model.ToBytes() });
     //写入2页
     TablePageEntity modelTP = new TablePageEntity { Tables = new List<DataTable.DataTableEntity>() };
     DataPageEntity modelDP= new DataPageEntity { DataFile = model, ID = Config.DATATABLE_PAGE_ID, Content = modelTP.ToBytes() };
     DataPageManage.Write(modelDP);
     //赋值
     modelTP.DataPage = modelDP;
     model.TablePage = modelTP;
 }
예제 #2
0
 /// <summary>
 /// 修改
 /// </summary>
 public static void Update(DataFileEntity model)
 {
     DataPageManage.Write(new DataPageEntity { DataFile = model, ID = Config.DATAFILE_PAGE_ID, Content = model.ToBytes() });
 }