public static void FillBinaryParse(MutagenFrame frame, IAvailableMorphs item) { for (int i = 0; i < 4; i++) { if (!frame.Reader.TryReadSubrecordFrame(RecordTypes.MPAI, out var indexFrame)) { break; } if (indexFrame.Content.Length != 4) { throw new ArgumentException($"Unexpected Morphs index length: {indexFrame.Content.Length} != 4"); } if (!frame.Reader.TryReadSubrecordFrame(MPAV, out var dataFrame)) { throw new ArgumentException($"Did not read in expected morph data record MPAI"); } if (dataFrame.Content.Length != 32) { throw new ArgumentException($"Morph data length unexpected: {dataFrame.Content.Length} != 32"); } var index = (MorphEnum)BinaryPrimitives.ReadInt32LittleEndian(indexFrame.Content); var morph = new Morph() { Data = dataFrame.Content.Span.ToArray() }; switch (index) { case MorphEnum.Nose: item.Nose = morph; break; case MorphEnum.Brow: item.Brow = morph; break; case MorphEnum.Eye: item.Eye = morph; break; case MorphEnum.Lip: item.Lip = morph; break; default: throw new ArgumentException($"Unexpected morph index: {index}"); } } }
public static partial void FillBinaryParseCustom(MutagenFrame frame, IAvailableMorphs item) { FillBinaryParse(frame, item); }
public static partial ParseResult FillBinaryParseCustom(MutagenFrame frame, IAvailableMorphs item, PreviousParse lastParsed) { FillBinaryParse(frame, item); return(lastParsed); }