// 保存磁盘信息 private void SaveDiskInfo() { using (dpz3.File.BinaryFile file = new File.BinaryFile(workPath, System.IO.FileMode.OpenOrCreate)) { file.Position = 0; // 输出Sign file.Write(diskInfo.Sign); // 输出Version file.Write(GetBytesFromInt(diskInfo.Version)); // 输出DataBlocks file.Write(GetBytesFromLong(diskInfo.DataBlocks)); } }
// 保存数据信息 private void SaveDataInfo(Types.VirtualDataInfo info) { using (dpz3.File.BinaryFile file = new File.BinaryFile(workPath, System.IO.FileMode.OpenOrCreate)) { file.Position = info.Position * Data_Info_Size; // 读取Sign try { // 输出NextPosition file.Write(GetBytesFromLong(info.NextPosition)); // 输出Length file.Write(GetBytesFromInt(info.Length)); } catch (Exception ex) { throw new Exception("磁盘数据损坏", ex); } } }
// 保存路径信息 private void SavePathInfo(Types.VirtualPathInfo info) { using (dpz3.File.BinaryFile file = new File.BinaryFile(workPath, System.IO.FileMode.OpenOrCreate)) { file.Position = info.Position * Data_Info_Size; // 输出NextPosition file.Write(GetBytesFromLong(info.NextPosition)); // 输出FirstChildPosition file.Write(GetBytesFromLong(info.FirstChildPosition)); // 读取Type file.Write(new byte[] { info.Type }); // 读取Name file.Write(info.Name); } }