Exemplo n.º 1
0
        private Byte[] CreateByteCode(
            MethodDefinition method,
            TinyBinaryWriter writer)
        {
            if (!method.HasBody)
            {
                return new Byte[0];
            }

            using(var stream = new MemoryStream())
            {
                var codeWriter = new  CodeWriter(
                    method, writer.GetMemoryBasedClone(stream),
                    _context.StringTable, _context);
                codeWriter.WriteMethodBody();
                return stream.ToArray();
            }
        }
Exemplo n.º 2
0
        private Byte[] CreateByteCode(
            MethodDefinition method)
        {
            if (!method.HasBody)
            {
                return new Byte[0];
            }

            using (var stream = new MemoryStream())
            using (var writer = new BinaryWriter(stream))
            {
                var codeWriter = new CodeWriter(
                    method, TinyBinaryWriter.CreateBigEndianBinaryWriter(writer),
                    _fakeStringTable, _context);
                codeWriter.WriteMethodBody();
                return stream.ToArray();
            }
        }