Пример #1
0
 public Header(RecordGroup group, BinaryFileReader r, GameFormat format)
 {
     Group          = group;
     HeaderPosition = r.Position;
     Type           = r.ReadASCIIString(4);
     if (Type == "GRUP")
     {
         DataSize  = (uint)(r.ReadUInt32() - (format == GameFormat.TES4 ? 20 : 24));
         Label     = RecordGroup.ToLabel(Group.Depth == 0, r.ReadBytes(4));
         GroupType = (HeaderGroupType)r.ReadInt32();
         r.ReadUInt32(); // stamp | stamp + uknown
         if (format != GameFormat.TES4)
         {
             r.ReadUInt32(); // version + uknown
         }
         Position = r.Position;
         return;
     }
     DataSize = r.ReadUInt32();
     if (format == GameFormat.TES3)
     {
         r.ReadUInt32(); // unknown
     }
     Flags = (HeaderFlags)r.ReadUInt32();
     if (format == GameFormat.TES3)
     {
         Position = r.Position;
         return;
     }
     // tes4
     FormId = r.ReadUInt32();
     r.ReadUInt32();
     if (format == GameFormat.TES4)
     {
         Position = r.Position;
         return;
     }
     // tes5
     r.ReadUInt32();
     Position = r.Position;
 }
Пример #2
0
 public Header(UnityBinaryReader r, GameFormatId format, Header parent)
 {
     Parent = parent;
     Type   = r.ReadASCIIString(4);
     if (Type == "GRUP")
     {
         DataSize  = (uint)(r.ReadLEUInt32() - (format == GameFormatId.TES4 ? 20 : 24));
         Label     = r.ReadBytes(4);
         GroupType = (HeaderGroupType)r.ReadLEInt32();
         r.ReadLEUInt32(); // stamp | stamp + uknown
         if (format != GameFormatId.TES4)
         {
             r.ReadLEUInt32(); // version + uknown
         }
         Position = r.BaseStream.Position;
         return;
     }
     DataSize = r.ReadLEUInt32();
     if (format == GameFormatId.TES3)
     {
         r.ReadLEUInt32(); // Unknown
     }
     Flags = (HeaderFlags)r.ReadLEUInt32();
     if (format == GameFormatId.TES3)
     {
         Position = r.BaseStream.Position;
         return;
     }
     // tes4
     FormId = r.ReadLEUInt32();
     r.ReadLEUInt32();
     if (format == GameFormatId.TES4)
     {
         Position = r.BaseStream.Position;
         return;
     }
     // tes5
     r.ReadLEUInt32();
     Position = r.BaseStream.Position;
 }