void WriteResolvedMethodBody(MethodDefinition method) { body = method.Body; ComputeHeader(); if (RequiresFatHeader()) { WriteFatHeader(); } else { WriteByte((byte)(0x2 | (body.CodeSize << 2))); // tiny } WriteInstructions(); if (body.HasExceptionHandlers) { WriteExceptionHandlers(); } var symbol_writer = metadata.symbol_writer; /*Telerik Authorship*/ if (symbol_writer != null) { MetadataToken methodToken = CodeReader.GetOriginalToken(metadata, method); MetadataToken localVarToken = CodeReader.GetOriginalLocalVarToken(metadata, method); if (methodToken == MetadataToken.Zero) { throw new Exception("MethodDefinition original token not found."); } symbol_writer.Write(body, /*Telerik Authorship*/ methodToken, /*Telerik Authorship*/ localVarToken); } }
public ByteBuffer PatchRawMethodBody(MethodDefinition method, CodeWriter writer, out MethodSymbols symbols) { MetadataToken zero; ByteBuffer byteBuffer = new ByteBuffer(); symbols = new MethodSymbols(method.Name); this.method = method; this.reader.context = method; this.MoveTo(method.RVA); byte num = base.ReadByte(); int num1 = num & 3; if (num1 == 2) { byteBuffer.WriteByte(num); zero = MetadataToken.Zero; symbols.code_size = num >> 2; this.PatchRawCode(byteBuffer, symbols.code_size, writer); } else { if (num1 != 3) { throw new NotSupportedException(); } this.position--; this.PatchRawFatMethod(byteBuffer, symbols, writer, out zero); } ISymbolReader symbolReader = this.reader.module.symbol_reader; if (symbolReader != null && writer.metadata.write_symbols) { symbols.method_token = CodeReader.GetOriginalToken(writer.metadata, method); symbols.local_var_token = zero; symbolReader.Read(symbols); } return(byteBuffer); }