static void ParseTypical( MutagenFrame frame, ICellInternal obj, IList <IPlaced> coll, bool persistentParse) { var groupMeta = frame.ReadGroup(); var formKey = FormKey.Factory(frame.MetaData.MasterReferences !, BinaryPrimitives.ReadUInt32LittleEndian(groupMeta.ContainedRecordTypeData)); if (formKey != obj.FormKey) { throw new ArgumentException("Cell children group did not match the FormID of the parent cell."); } if (persistentParse) { obj.PersistentTimestamp = groupMeta.LastModifiedData.Int32(); } else { obj.VisibleWhenDistantTimestamp = groupMeta.LastModifiedData.Int32(); } coll.AddRange( ListBinaryTranslation <IPlaced> .Instance.Parse( reader: frame, transl: (MutagenFrame r, RecordType header, out IPlaced placed) => { switch (header.TypeInt) { case 0x45524341: // "ACRE": placed = PlacedCreature.CreateFromBinary(r); return(true); case 0x52484341: //"ACHR": placed = PlacedNpc.CreateFromBinary(r); return(true); case 0x52464552: // "REFR": placed = PlacedObject.CreateFromBinary(r); return(true); default: throw new NotImplementedException(); } })); }
static void ParseTemporary(MutagenFrame frame, ICellInternal obj) { var groupMeta = frame.ReadGroup(); var formKey = FormKey.Factory(frame.MetaData.MasterReferences !, BinaryPrimitives.ReadUInt32LittleEndian(groupMeta.ContainedRecordTypeData)); if (formKey != obj.FormKey) { throw new ArgumentException("Cell children group did not match the FormID of the parent cell."); } obj.TemporaryTimestamp = BinaryPrimitives.ReadInt32LittleEndian(groupMeta.LastModifiedData); var items = ListBinaryTranslation <IPlaced> .Instance.Parse( reader : frame, transl : (MutagenFrame r, RecordType header, out IPlaced placed) => { switch (header.TypeInt) { case 0x45524341: // "ACRE": placed = PlacedCreature.CreateFromBinary(r); return(true); case 0x52484341: //"ACHR": placed = PlacedNpc.CreateFromBinary(r); return(true); case 0x52464552: // "REFR": placed = PlacedObject.CreateFromBinary(r); return(true); default: if (ParseTemporaryOutliers(frame, obj)) { placed = null !; return(false); } throw new NotImplementedException(); } placed = null !; return(false); }); obj.Temporary.SetTo(new ExtendedList <IPlaced>(items)); }
static void ParseTemporary(MutagenFrame frame, ICellInternal obj) { var groupMeta = frame.ReadGroup(); var formKey = FormKey.Factory(frame.MetaData.MasterReferences !, BinaryPrimitives.ReadUInt32LittleEndian(groupMeta.ContainedRecordTypeData)); if (formKey != obj.FormKey) { throw new ArgumentException("Cell children group did not match the FormID of the parent cell."); } obj.TemporaryTimestamp = BinaryPrimitives.ReadInt32LittleEndian(groupMeta.LastModifiedData); obj.TemporaryUnknownGroupData = BinaryPrimitives.ReadInt32LittleEndian(groupMeta.HeaderData.Slice(groupMeta.HeaderData.Length - 4)); var items = ListBinaryTranslation <IPlaced> .Instance.Parse( reader : frame, transl : (MutagenFrame r, RecordType header, out IPlaced placed) => { switch (header.TypeInt) { case RecordTypeInts.ACHR: placed = PlacedNpc.CreateFromBinary(r); return(true); case RecordTypeInts.REFR: placed = PlacedObject.CreateFromBinary(r); return(true); case RecordTypeInts.PARW: placed = PlacedArrow.CreateFromBinary(r); return(true); case RecordTypeInts.PBAR: placed = PlacedBarrier.CreateFromBinary(r); return(true); case RecordTypeInts.PBEA: placed = PlacedBeam.CreateFromBinary(r); return(true); case RecordTypeInts.PCON: placed = PlacedCone.CreateFromBinary(r); return(true); case RecordTypeInts.PFLA: placed = PlacedFlame.CreateFromBinary(r); return(true); case RecordTypeInts.PHZD: placed = PlacedHazard.CreateFromBinary(r); return(true); case RecordTypeInts.PMIS: placed = PlacedMissile.CreateFromBinary(r); return(true); case RecordTypeInts.PGRE: placed = PlacedTrap.CreateFromBinary(r); return(true); default: if (ParseTemporaryOutliers(frame, obj)) { placed = null !; return(false); } throw new NotImplementedException(); } }); obj.Temporary.SetTo(new ExtendedList <IPlaced>(items)); }