public static IEnumerable <SubrecordPinFrame> Masters(this ModHeaderFrame modHeader) { foreach (var pin in EnumerateSubrecords(modHeader)) { if (pin.RecordType == RecordTypes.MAST) { yield return(pin); } } }
public void ModHeaderOverflow() { byte[] b = new byte[] { 0x54, 0x45, 0x53, 0x34, 0x36, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x4D, 0x41, 0x53, 0x54, 0x0E, 0x00, 0x44, 0x61, 0x77, 0x6E, 0x67, 0x75, 0x61, 0x72, 0x64, 0x2E, 0x65, 0x73, 0x6D, 0x00, 0x44, 0x41, 0x54, 0x41, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x58, 0x58, 0x58, 0x58, 0x04, 0x00, 0x04, 0x00, 0x00, 0x00, 0x4F, 0x4E, 0x41, 0x4D, 0x00, 0x00, 0x01, 0x02, 0x03, 0x04 }; var modHeader = new ModHeaderFrame(GameConstants.SkyrimSE, b); var recs = modHeader.ToList(); recs.Should().HaveCount(3); recs[0].RecordType.Should().Be(RecordTypes.MAST); recs[1].RecordType.Should().Be(RecordTypes.DATA); recs[2].RecordType.Should().Be(RecordTypes.ONAM); recs[0].ContentLength.Should().Be(0x0E); recs[1].ContentLength.Should().Be(0x08); recs[2].ContentLength.Should().Be(0x04); recs[2].AsInt32().Should().Be(0x04030201); }
/// <summary> /// Enumerates locations of the contained subrecords.<br/> /// Locations are relative to the RecordType of the ModHeaderFrame. /// </summary> public static IEnumerable <SubrecordPinFrame> EnumerateSubrecords(this ModHeaderFrame modHeader) { return(EnumerateSubrecords(modHeader.HeaderAndContentData, modHeader.Meta, modHeader.HeaderLength, _headerOverflow)); }