/// <summary> /// The copy constructor. /// </summary> /// <param name="gr">The group record to copy.</param> private GroupRecord(GroupRecord gr) { Name = "GRUP"; data = (byte[])gr.data.Clone(); groupType = gr.groupType; dateStamp = gr.dateStamp; flags = gr.flags; Records = new List<Rec>(gr.Records.Count); for (int i = 0; i < gr.Records.Count; i++) Records.Add((Rec)gr.Records[i].Clone()); Name = gr.Name; descriptiveName = gr.descriptiveName; }
/// <summary> /// A simple constructor that initializes the object with the given values. /// </summary> /// <param name="Size">The size of the groop record.</param> /// <param name="br">The reader caontaining the group record data.</param> /// <param name="Oblivion">Whether the record is in Oblivion format.</param> internal GroupRecord(uint Size, BinaryReader br, bool Oblivion) { Name = "GRUP"; data = br.ReadBytes(4); groupType = br.ReadUInt32(); dateStamp = br.ReadUInt32(); if (!Oblivion) flags = br.ReadUInt32(); uint AmountRead = 0; while (AmountRead < Size - (Oblivion ? 20 : 24)) { string s = TesPlugin.ReadRecName(br); uint recsize = br.ReadUInt32(); if (s == "GRUP") { GroupRecord gr = new GroupRecord(recsize, br, Oblivion); AmountRead += recsize; Records.Add(gr); } else { Record r = new Record(s, recsize, br, Oblivion); AmountRead += (uint)(recsize + (Oblivion ? 20 : 24)); Records.Add(r); } } if (AmountRead > (Size - (Oblivion ? 20 : 24))) { throw new TESParserException("Record block did not match the size specified in the group header"); } if (groupType == 0) { descriptiveName = " (" + (char)data[0] + (char)data[1] + (char)data[2] + (char)data[3] + ")"; } }