public new static CilRawFatMethodBody FromReader(IBinaryStreamReader reader) { var body = new CilRawFatMethodBody { _header = reader.ReadUInt16(), MaxStack = reader.ReadUInt16() }; int codeSize = reader.ReadInt32(); body.LocalVarSigToken = reader.ReadUInt32(); body.Code = reader.ReadBytes(codeSize); if (body.HasSections) { reader.Align(4); CilExtraSection section; do { section = CilExtraSection.FromReader(reader); body.ExtraSections.Add(section); } while (section.HasMoreSections); } return(body); }
public static CilExtraSection FromReader(IBinaryStreamReader reader) { var section = new CilExtraSection { Attributes = (CilExtraSectionAttributes)reader.ReadByte() }; if (!section.IsExceptionHandler) { throw new NotSupportedException("Invalid or unsupported extra section."); } int dataSize; if (section.IsFat) { dataSize = reader.ReadByte() | (reader.ReadByte() << 0x08) | (reader.ReadByte() << 0x10); } else { dataSize = reader.ReadByte(); reader.ReadUInt16(); } section.Data = reader.ReadBytes(dataSize); return(section); }