Пример #1
0
        private void ParseV1(BinaryReader reader)
        {
            VERSION = 1;
            name    = reader.ReadString();
            int count = reader.ReadInt32();

            for (int i = 0; i < count; ++i)
            {
                ulong key = reader.ReadUInt64();
                files[key] = new DeltaRecord {
                    Size = reader.ReadInt32()
                };
            }
        }
Пример #2
0
 public void Save()
 {
     using (BinaryWriter writer = new BinaryWriter(baseFile, System.Text.Encoding.ASCII, true)) {
         baseFile.Position = 0;
         writer.Write(DELTAHEADER_V2);
         writer.Write(name);
         writer.Write(files.Count);
         foreach (KeyValuePair <ulong, DeltaRecord> pair in files)
         {
             writer.Write(pair.Key);
             writer.Write(pair.Value.Size);
             unsafe {
                 DeltaRecord record = pair.Value;
                 byte *      offset = record.Hash.Value;
                 writer.Write(*(ulong *)offset);
                 offset += 8;
                 writer.Write(*(ulong *)offset);
             }
         }
         writer.Flush();
     }
 }