示例#1
0
        internal Switch(global::Truesight.Parser.Impl.MethodBody source, global::System.IO.BinaryReader reader, global::System.Collections.ObjectModel.ReadOnlyCollection <global::Truesight.Parser.Impl.ILOp> prefixes)
            : base(source, AssertSupportedOpCode(reader), (int)reader.BaseStream.Position - global::System.Linq.Enumerable.Sum(global::System.Linq.Enumerable.Select(prefixes ?? global::XenoGears.Functional.EnumerableExtensions.ToReadOnly(global::System.Linq.Enumerable.Empty <global::Truesight.Parser.Impl.ILOp>()), prefix => prefix.Size)), prefixes ?? global::XenoGears.Functional.EnumerableExtensions.ToReadOnly(global::System.Linq.Enumerable.Empty <global::Truesight.Parser.Impl.ILOp>()))
        {
            // this is necessary for further verification
            var origPos = reader.BaseStream.Position;

            // initializing _targetOffsets
            _targetOffsets = ((global::System.Func <global::System.Collections.ObjectModel.ReadOnlyCollection <global::System.Tuple <int, int> > >)(() =>
            {
                var n = ReadI4(reader);
                var pivot = (int)reader.BaseStream.Position + sizeof(int) * n;

                return(global::XenoGears.Functional.EnumerableExtensions.ToReadOnly(global::System.Linq.Enumerable.Select(
                                                                                        global::System.Linq.Enumerable.Range(1, n), _ =>
                {
                    var relative = ReadI4(reader);
                    var absolute = pivot + relative;
                    return global::System.Tuple.Create(relative, absolute);
                })));
            }))();

            // verify that we've read exactly the amount of bytes we should
            var bytesRead = reader.BaseStream.Position - origPos;

            global::XenoGears.Assertions.AssertionHelper.AssertTrue(bytesRead == SizeOfOperand);

            // now when the initialization is completed verify that we've got only prefixes we support
            global::XenoGears.Assertions.AssertionHelper.AssertAll(Prefixes, prefix =>
            {
                return(false);
            });
        }
示例#2
0
 public static uint smethod_6(global::System.IO.BinaryReader reader, global::ARC_Studio.Workers.ARC.FileUtils.ByteOrder byteOrder)
 {
     if (byteOrder == global::ARC_Studio.Workers.ARC.FileUtils.ByteOrder.LittleEndian)
     {
         return((uint)reader.ReadInt32());
     }
     return(global::System.BitConverter.ToUInt32(global::ARC_Studio.Workers.ARC.FileUtils.ReadBytes(reader, 4, global::ARC_Studio.Workers.ARC.FileUtils.ByteOrder.BigEndian), 0));
 }
示例#3
0
 // Token: 0x060004F5 RID: 1269 RVA: 0x000196E8 File Offset: 0x000178E8
 public static global::VRGIN.Helpers.JSONNode LoadFromStream(global::System.IO.Stream aData)
 {
     global::VRGIN.Helpers.JSONNode result;
     using (global::System.IO.BinaryReader binaryReader = new global::System.IO.BinaryReader(aData))
     {
         result = global::VRGIN.Helpers.JSONNode.Deserialize(binaryReader);
     }
     return(result);
 }
示例#4
0
        // Token: 0x060004F1 RID: 1265 RVA: 0x00019588 File Offset: 0x00017788
        public static global::VRGIN.Helpers.JSONNode Deserialize(global::System.IO.BinaryReader aReader)
        {
            global::VRGIN.Helpers.JSONBinaryTag jsonbinaryTag = (global::VRGIN.Helpers.JSONBinaryTag)aReader.ReadByte();
            global::VRGIN.Helpers.JSONNode      result;
            switch (jsonbinaryTag)
            {
            case global::VRGIN.Helpers.JSONBinaryTag.Array:
            {
                int num = aReader.ReadInt32();
                global::VRGIN.Helpers.JSONArray jsonarray = new global::VRGIN.Helpers.JSONArray();
                for (int i = 0; i < num; i++)
                {
                    jsonarray.Add(global::VRGIN.Helpers.JSONNode.Deserialize(aReader));
                }
                result = jsonarray;
                break;
            }

            case global::VRGIN.Helpers.JSONBinaryTag.Class:
            {
                int num2 = aReader.ReadInt32();
                global::VRGIN.Helpers.JSONClass jsonclass = new global::VRGIN.Helpers.JSONClass();
                for (int j = 0; j < num2; j++)
                {
                    string aKey = aReader.ReadString();
                    global::VRGIN.Helpers.JSONNode aItem = global::VRGIN.Helpers.JSONNode.Deserialize(aReader);
                    jsonclass.Add(aKey, aItem);
                }
                result = jsonclass;
                break;
            }

            case global::VRGIN.Helpers.JSONBinaryTag.Value:
                result = new global::VRGIN.Helpers.JSONData(aReader.ReadString());
                break;

            case global::VRGIN.Helpers.JSONBinaryTag.IntValue:
                result = new global::VRGIN.Helpers.JSONData(aReader.ReadInt32());
                break;

            case global::VRGIN.Helpers.JSONBinaryTag.DoubleValue:
                result = new global::VRGIN.Helpers.JSONData(aReader.ReadDouble());
                break;

            case global::VRGIN.Helpers.JSONBinaryTag.BoolValue:
                result = new global::VRGIN.Helpers.JSONData(aReader.ReadBoolean());
                break;

            case global::VRGIN.Helpers.JSONBinaryTag.FloatValue:
                result = new global::VRGIN.Helpers.JSONData(aReader.ReadSingle());
                break;

            default:
                throw new global::System.Exception("Error deserializing JSON. Unknown tag: " + jsonbinaryTag.ToString());
            }
            return(result);
        }
示例#5
0
 public static short ReadShort(global::System.IO.BinaryReader reader)
 {
     byte[] array = new byte[2];
     array = reader.ReadBytes(2);
     if (global::System.BitConverter.IsLittleEndian)
     {
         global::System.Array.Reverse(array);
     }
     return(global::System.BitConverter.ToInt16(array, 0));
 }
示例#6
0
        private static global::System.Reflection.Emit.OpCode AssertSupportedOpCode(global::System.IO.BinaryReader reader)
        {
            var opcode = global::Truesight.Parser.Impl.Reader.OpCodeReader.ReadOpCode(reader);

            global::XenoGears.Assertions.AssertionHelper.AssertNotNull(opcode);
            // br.s, brfalse.s, brtrue.s, beq.s, bge.s, bgt.s, ble.s, blt.s, bne.un.s, bge.un.s, bgt.un.s, ble.un.s, blt.un.s, br, brfalse, brtrue, beq, bge, bgt, ble, blt, bne.un, bge.un, bgt.un, ble.un, blt.un, leave, leave.s
            global::XenoGears.Assertions.AssertionHelper.AssertTrue(global::System.Linq.Enumerable.Contains(new ushort[] { 0x2b, 0x2c, 0x2d, 0x2e, 0x2f, 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f, 0x40, 0x41, 0x42, 0x43, 0x44, 0xdd, 0xde }, (ushort)opcode.Value.Value));

            return(opcode.Value);
        }
示例#7
0
        private static global::System.Reflection.Emit.OpCode AssertSupportedOpCode(global::System.IO.BinaryReader reader)
        {
            var opcode = global::Truesight.Parser.Impl.Reader.OpCodeReader.ReadOpCode(reader);

            global::XenoGears.Assertions.AssertionHelper.AssertNotNull(opcode);
            // conv.i1, conv.i2, conv.i4, conv.i8, conv.r4, conv.r8, conv.u4, conv.u8, castclass, conv.r.un, unbox, conv.ovf.i1.un, conv.ovf.i2.un, conv.ovf.i4.un, conv.ovf.i8.un, conv.ovf.u1.un, conv.ovf.u2.un, conv.ovf.u4.un, conv.ovf.u8.un, conv.ovf.i.un, conv.ovf.u.un, box, unbox.any, conv.ovf.i1, conv.ovf.u1, conv.ovf.i2, conv.ovf.u2, conv.ovf.i4, conv.ovf.u4, conv.ovf.i8, conv.ovf.u8, conv.u2, conv.u1, conv.i, conv.ovf.i, conv.ovf.u, conv.u
            global::XenoGears.Assertions.AssertionHelper.AssertTrue(global::System.Linq.Enumerable.Contains(new ushort[] { 0x67, 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x74, 0x76, 0x79, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, 0x89, 0x8a, 0x8b, 0x8c, 0xa5, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7, 0xb8, 0xb9, 0xba, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xe0 }, (ushort)opcode.Value.Value));

            return(opcode.Value);
        }
示例#8
0
        private static global::System.Reflection.Emit.OpCode AssertSupportedOpCode(global::System.IO.BinaryReader reader)
        {
            var opcode = global::Truesight.Parser.Impl.Reader.OpCodeReader.ReadOpCode(reader);

            global::XenoGears.Assertions.AssertionHelper.AssertNotNull(opcode);
            // ldnull, ldc.i4.m1, ldc.i4.0, ldc.i4.1, ldc.i4.2, ldc.i4.3, ldc.i4.4, ldc.i4.5, ldc.i4.6, ldc.i4.7, ldc.i4.8, ldc.i4.s, ldc.i4, ldc.i8, ldc.r4, ldc.r8, ldstr, ldtoken
            global::XenoGears.Assertions.AssertionHelper.AssertTrue(global::System.Linq.Enumerable.Contains(new ushort[] { 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, 0x20, 0x21, 0x22, 0x23, 0x72, 0xd0 }, (ushort)opcode.Value.Value));

            return(opcode.Value);
        }
示例#9
0
        private static global::System.Reflection.Emit.OpCode AssertSupportedOpCode(global::System.IO.BinaryReader reader)
        {
            var opcode = global::Truesight.Parser.Impl.Reader.OpCodeReader.ReadOpCode(reader);

            global::XenoGears.Assertions.AssertionHelper.AssertNotNull(opcode);
            // stelem.i, stelem.i1, stelem.i2, stelem.i4, stelem.i8, stelem.r4, stelem.r8, stelem.ref, stelem
            global::XenoGears.Assertions.AssertionHelper.AssertTrue(global::System.Linq.Enumerable.Contains(new ushort[] { 0x9b, 0x9c, 0x9d, 0x9e, 0x9f, 0xa0, 0xa1, 0xa2, 0xa4 }, (ushort)opcode.Value.Value));

            return(opcode.Value);
        }
示例#10
0
        private static global::System.Reflection.Emit.OpCode AssertSupportedOpCode(global::System.IO.BinaryReader reader)
        {
            var opcode = global::Truesight.Parser.Impl.Reader.OpCodeReader.ReadOpCode(reader);

            global::XenoGears.Assertions.AssertionHelper.AssertNotNull(opcode);
            // throw
            global::XenoGears.Assertions.AssertionHelper.AssertTrue(global::System.Linq.Enumerable.Contains(new ushort[] { 0x7a }, (ushort)opcode.Value.Value));

            return(opcode.Value);
        }
示例#11
0
        private static global::System.Reflection.Emit.OpCode AssertSupportedOpCode(global::System.IO.BinaryReader reader)
        {
            var opcode = global::Truesight.Parser.Impl.Reader.OpCodeReader.ReadOpCode(reader);

            global::XenoGears.Assertions.AssertionHelper.AssertNotNull(opcode);
            // add, sub, mul, div, div.un, rem, rem.un, and, or, xor, shl, shr, shr.un, neg, not, add.ovf, add.ovf.un, mul.ovf, mul.ovf.un, sub.ovf, sub.ovf.un, ceq, cgt, cgt.un, clt, clt.un
            global::XenoGears.Assertions.AssertionHelper.AssertTrue(global::System.Linq.Enumerable.Contains(new ushort[] { 0x58, 0x59, 0x5a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f, 0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0xd6, 0xd7, 0xd8, 0xd9, 0xda, 0xdb, 0xfe01, 0xfe02, 0xfe03, 0xfe04, 0xfe05 }, (ushort)opcode.Value.Value));

            return(opcode.Value);
        }
示例#12
0
        private static global::System.Reflection.Emit.OpCode AssertSupportedOpCode(global::System.IO.BinaryReader reader)
        {
            var opcode = global::Truesight.Parser.Impl.Reader.OpCodeReader.ReadOpCode(reader);

            global::XenoGears.Assertions.AssertionHelper.AssertNotNull(opcode);
            // stind.ref, stind.i1, stind.i2, stind.i4, stind.i8, stind.r4, stind.r8, stobj, stind.i
            global::XenoGears.Assertions.AssertionHelper.AssertTrue(global::System.Linq.Enumerable.Contains(new ushort[] { 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, 0x81, 0xdf }, (ushort)opcode.Value.Value));

            return(opcode.Value);
        }
示例#13
0
        private static global::System.Reflection.Emit.OpCode AssertSupportedOpCode(global::System.IO.BinaryReader reader)
        {
            var opcode = global::Truesight.Parser.Impl.Reader.OpCodeReader.ReadOpCode(reader);

            global::XenoGears.Assertions.AssertionHelper.AssertNotNull(opcode);
            // ldind.i1, ldind.u1, ldind.i2, ldind.u2, ldind.i4, ldind.u4, ldind.i8, ldind.i, ldind.r4, ldind.r8, ldind.ref, ldobj
            global::XenoGears.Assertions.AssertionHelper.AssertTrue(global::System.Linq.Enumerable.Contains(new ushort[] { 0x46, 0x47, 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, 0x50, 0x71 }, (ushort)opcode.Value.Value));

            return(opcode.Value);
        }
示例#14
0
        private static global::System.Reflection.Emit.OpCode AssertSupportedOpCode(global::System.IO.BinaryReader reader)
        {
            var opcode = global::Truesight.Parser.Impl.Reader.OpCodeReader.ReadOpCode(reader);

            global::XenoGears.Assertions.AssertionHelper.AssertNotNull(opcode);
            // ldelem.i1, ldelem.u1, ldelem.i2, ldelem.u2, ldelem.i4, ldelem.u4, ldelem.i8, ldelem.i, ldelem.r4, ldelem.r8, ldelem.ref, ldelem
            global::XenoGears.Assertions.AssertionHelper.AssertTrue(global::System.Linq.Enumerable.Contains(new ushort[] { 0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, 0x98, 0x99, 0x9a, 0xa3 }, (ushort)opcode.Value.Value));

            return(opcode.Value);
        }
示例#15
0
 public static byte[] ReadBytes(global::System.IO.BinaryReader reader, int fieldSize, global::ARC_Studio.Workers.ARC.FileUtils.ByteOrder byteOrder)
 {
     byte[] array = new byte[fieldSize];
     if (byteOrder == global::ARC_Studio.Workers.ARC.FileUtils.ByteOrder.LittleEndian)
     {
         return(reader.ReadBytes(fieldSize));
     }
     for (int i = fieldSize - 1; i > -1; i--)
     {
         array[i] = reader.ReadByte();
     }
     return(array);
 }
示例#16
0
        internal Call(global::Truesight.Parser.Impl.MethodBody source, global::System.IO.BinaryReader reader, global::System.Collections.ObjectModel.ReadOnlyCollection <global::Truesight.Parser.Impl.ILOp> prefixes)
            : base(source, AssertSupportedOpCode(reader), (int)reader.BaseStream.Position - global::System.Linq.Enumerable.Sum(global::System.Linq.Enumerable.Select(prefixes ?? global::XenoGears.Functional.EnumerableExtensions.ToReadOnly(global::System.Linq.Enumerable.Empty <global::Truesight.Parser.Impl.ILOp>()), prefix => prefix.Size)), prefixes ?? global::XenoGears.Functional.EnumerableExtensions.ToReadOnly(global::System.Linq.Enumerable.Empty <global::Truesight.Parser.Impl.ILOp>()))
        {
            // this is necessary for further verification
            var origPos = reader.BaseStream.Position;

            // initializing _methodToken
            switch ((ushort)OpSpec.OpCode.Value)
            {
            case 0x28:     //call
            case 0x6f:     //callvirt
                _methodToken = ReadMetadataToken(reader);
                break;

            case 0x29:     //calli
                _methodToken = default(int);
                break;

            default:
                throw global::XenoGears.Assertions.AssertionHelper.Fail();
            }

            // initializing _signatureToken
            switch ((ushort)OpSpec.OpCode.Value)
            {
            case 0x28:     //call
            case 0x6f:     //callvirt
                _signatureToken = default(int);
                break;

            case 0x29:     //calli
                _signatureToken = ReadMetadataToken(reader);
                break;

            default:
                throw global::XenoGears.Assertions.AssertionHelper.Fail();
            }

            // verify that we've read exactly the amount of bytes we should
            var bytesRead = reader.BaseStream.Position - origPos;

            global::XenoGears.Assertions.AssertionHelper.AssertTrue(bytesRead == SizeOfOperand);

            // now when the initialization is completed verify that we've got only prefixes we support
            global::XenoGears.Assertions.AssertionHelper.AssertAll(Prefixes, prefix =>
            {
                var constrained_ok = prefix is Constrained;
                var tail_ok        = prefix is Tail;
                return(constrained_ok || tail_ok || false);
            });
        }
示例#17
0
        public LanguagesContainer Parse(string path)
        {
            LanguagesContainer languagesContainer = new LanguagesContainer();

            if (global::System.IO.File.Exists(path))
            {
                using (global::System.IO.BinaryReader binaryReader = new global::System.IO.BinaryReader(global::System.IO.File.Open(path, global::System.IO.FileMode.Open)))
                {
                    global::System.IO.Stream baseStream = binaryReader.BaseStream;
                    languagesContainer = this.Parse(languagesContainer, baseStream);
                }
            }
            return(languagesContainer);
        }
示例#18
0
 internal static byte[] smethod_0(string string_0)
 {
     byte[] array = null;
     if (global::System.IO.File.Exists(string_0))
     {
         using (global::System.IO.BinaryReader binaryReader = new global::System.IO.BinaryReader(global::System.IO.File.Open(string_0, global::System.IO.FileMode.Open)))
         {
             long length = binaryReader.BaseStream.Length;
             binaryReader.BaseStream.Seek(0L, global::System.IO.SeekOrigin.Begin);
             array = new byte[length];
             binaryReader.Read(array, 0, (int)length);
         }
     }
     return(array);
 }
示例#19
0
        internal Throw(global::Truesight.Parser.Impl.MethodBody source, global::System.IO.BinaryReader reader, global::System.Collections.ObjectModel.ReadOnlyCollection <global::Truesight.Parser.Impl.ILOp> prefixes)
            : base(source, AssertSupportedOpCode(reader), (int)reader.BaseStream.Position - global::System.Linq.Enumerable.Sum(global::System.Linq.Enumerable.Select(prefixes ?? global::XenoGears.Functional.EnumerableExtensions.ToReadOnly(global::System.Linq.Enumerable.Empty <global::Truesight.Parser.Impl.ILOp>()), prefix => prefix.Size)), prefixes ?? global::XenoGears.Functional.EnumerableExtensions.ToReadOnly(global::System.Linq.Enumerable.Empty <global::Truesight.Parser.Impl.ILOp>()))
        {
            // this is necessary for further verification
            var origPos = reader.BaseStream.Position;

            // verify that we've read exactly the amount of bytes we should
            var bytesRead = reader.BaseStream.Position - origPos;

            global::XenoGears.Assertions.AssertionHelper.AssertTrue(bytesRead == SizeOfOperand);

            // now when the initialization is completed verify that we've got only prefixes we support
            global::XenoGears.Assertions.AssertionHelper.AssertAll(Prefixes, prefix =>
            {
                return(false);
            });
        }
示例#20
0
        internal Ldind(global::Truesight.Parser.Impl.MethodBody source, global::System.IO.BinaryReader reader, global::System.Collections.ObjectModel.ReadOnlyCollection <global::Truesight.Parser.Impl.ILOp> prefixes)
            : base(source, AssertSupportedOpCode(reader), (int)reader.BaseStream.Position - global::System.Linq.Enumerable.Sum(global::System.Linq.Enumerable.Select(prefixes ?? global::XenoGears.Functional.EnumerableExtensions.ToReadOnly(global::System.Linq.Enumerable.Empty <global::Truesight.Parser.Impl.ILOp>()), prefix => prefix.Size)), prefixes ?? global::XenoGears.Functional.EnumerableExtensions.ToReadOnly(global::System.Linq.Enumerable.Empty <global::Truesight.Parser.Impl.ILOp>()))
        {
            // this is necessary for further verification
            var origPos = reader.BaseStream.Position;

            // initializing _typeToken
            switch ((ushort)OpSpec.OpCode.Value)
            {
            case 0x46:     //ldind.i1
            case 0x47:     //ldind.u1
            case 0x48:     //ldind.i2
            case 0x49:     //ldind.u2
            case 0x4a:     //ldind.i4
            case 0x4b:     //ldind.u4
            case 0x4c:     //ldind.i8
            case 0x4d:     //ldind.i
            case 0x4e:     //ldind.r4
            case 0x4f:     //ldind.r8
            case 0x50:     //ldind.ref
                _typeToken = default(int);
                break;

            case 0x71:     //ldobj
                _typeToken = ReadMetadataToken(reader);
                break;

            default:
                throw global::XenoGears.Assertions.AssertionHelper.Fail();
            }

            // verify that we've read exactly the amount of bytes we should
            var bytesRead = reader.BaseStream.Position - origPos;

            global::XenoGears.Assertions.AssertionHelper.AssertTrue(bytesRead == SizeOfOperand);

            // now when the initialization is completed verify that we've got only prefixes we support
            global::XenoGears.Assertions.AssertionHelper.AssertAll(Prefixes, prefix =>
            {
                var unaligned_ok = prefix is Unaligned;
                var volatile_ok  = prefix is Volatile;
                return(unaligned_ok || volatile_ok || false);
            });
        }
示例#21
0
        internal Ldfld(global::Truesight.Parser.Impl.MethodBody source, global::System.IO.BinaryReader reader, global::System.Collections.ObjectModel.ReadOnlyCollection <global::Truesight.Parser.Impl.ILOp> prefixes)
            : base(source, AssertSupportedOpCode(reader), (int)reader.BaseStream.Position - global::System.Linq.Enumerable.Sum(global::System.Linq.Enumerable.Select(prefixes ?? global::XenoGears.Functional.EnumerableExtensions.ToReadOnly(global::System.Linq.Enumerable.Empty <global::Truesight.Parser.Impl.ILOp>()), prefix => prefix.Size)), prefixes ?? global::XenoGears.Functional.EnumerableExtensions.ToReadOnly(global::System.Linq.Enumerable.Empty <global::Truesight.Parser.Impl.ILOp>()))
        {
            // this is necessary for further verification
            var origPos = reader.BaseStream.Position;

            // initializing _fieldToken
            _fieldToken = ReadMetadataToken(reader);

            // verify that we've read exactly the amount of bytes we should
            var bytesRead = reader.BaseStream.Position - origPos;

            global::XenoGears.Assertions.AssertionHelper.AssertTrue(bytesRead == SizeOfOperand);

            // now when the initialization is completed verify that we've got only prefixes we support
            global::XenoGears.Assertions.AssertionHelper.AssertAll(Prefixes, prefix =>
            {
                var unaligned_ok = prefix is Unaligned && OpSpec.OpCode.Value != 0x7e /* ldsfld */;
                var volatile_ok  = prefix is Volatile;
                return(unaligned_ok || volatile_ok || false);
            });
        }
示例#22
0
        internal Starg(global::Truesight.Parser.Impl.MethodBody source, global::System.IO.BinaryReader reader, global::System.Collections.ObjectModel.ReadOnlyCollection <global::Truesight.Parser.Impl.ILOp> prefixes)
            : base(source, AssertSupportedOpCode(reader), (int)reader.BaseStream.Position - global::System.Linq.Enumerable.Sum(global::System.Linq.Enumerable.Select(prefixes ?? global::XenoGears.Functional.EnumerableExtensions.ToReadOnly(global::System.Linq.Enumerable.Empty <global::Truesight.Parser.Impl.ILOp>()), prefix => prefix.Size)), prefixes ?? global::XenoGears.Functional.EnumerableExtensions.ToReadOnly(global::System.Linq.Enumerable.Empty <global::Truesight.Parser.Impl.ILOp>()))
        {
            // this is necessary for further verification
            var origPos = reader.BaseStream.Position;

            // initializing _constValue
            _constValue = default(int?);

            // initializing _useConstValue
            _useConstValue = default(bool);

            // initializing _value
            switch ((ushort)OpSpec.OpCode.Value)
            {
            case 0x10:     //starg.s
                _value = _useConstValue ? _constValue.Value : ReadI1(reader);
                break;

            case 0xfe0b:     //starg
                _value = _useConstValue ? _constValue.Value : ReadI4(reader);
                break;

            default:
                throw global::XenoGears.Assertions.AssertionHelper.Fail();
            }

            // verify that we've read exactly the amount of bytes we should
            var bytesRead = reader.BaseStream.Position - origPos;

            global::XenoGears.Assertions.AssertionHelper.AssertTrue(bytesRead == SizeOfOperand);

            // now when the initialization is completed verify that we've got only prefixes we support
            global::XenoGears.Assertions.AssertionHelper.AssertAll(Prefixes, prefix =>
            {
                return(false);
            });
        }
示例#23
0
 internal Stelem(global::Truesight.Parser.Impl.MethodBody source, global::System.IO.BinaryReader reader)
     : this(source, reader, global::XenoGears.Functional.EnumerableExtensions.ToReadOnly(global::System.Linq.Enumerable.Empty <global::Truesight.Parser.Impl.ILOp>()))
 {
 }
示例#24
0
        internal Cast(global::Truesight.Parser.Impl.MethodBody source, global::System.IO.BinaryReader reader, global::System.Collections.ObjectModel.ReadOnlyCollection <global::Truesight.Parser.Impl.ILOp> prefixes)
            : base(source, AssertSupportedOpCode(reader), (int)reader.BaseStream.Position - global::System.Linq.Enumerable.Sum(global::System.Linq.Enumerable.Select(prefixes ?? global::XenoGears.Functional.EnumerableExtensions.ToReadOnly(global::System.Linq.Enumerable.Empty <global::Truesight.Parser.Impl.ILOp>()), prefix => prefix.Size)), prefixes ?? global::XenoGears.Functional.EnumerableExtensions.ToReadOnly(global::System.Linq.Enumerable.Empty <global::Truesight.Parser.Impl.ILOp>()))
        {
            // this is necessary for further verification
            var origPos = reader.BaseStream.Position;

            // initializing _typeToken
            switch ((ushort)OpSpec.OpCode.Value)
            {
            case 0x67:     //conv.i1
            case 0x68:     //conv.i2
            case 0x69:     //conv.i4
            case 0x6a:     //conv.i8
            case 0x6b:     //conv.r4
            case 0x6c:     //conv.r8
            case 0x6d:     //conv.u4
            case 0x6e:     //conv.u8
            case 0x76:     //conv.r.un
            case 0x82:     //conv.ovf.i1.un
            case 0x83:     //conv.ovf.i2.un
            case 0x84:     //conv.ovf.i4.un
            case 0x85:     //conv.ovf.i8.un
            case 0x86:     //conv.ovf.u1.un
            case 0x87:     //conv.ovf.u2.un
            case 0x88:     //conv.ovf.u4.un
            case 0x89:     //conv.ovf.u8.un
            case 0x8a:     //conv.ovf.i.un
            case 0x8b:     //conv.ovf.u.un
            case 0xb3:     //conv.ovf.i1
            case 0xb4:     //conv.ovf.u1
            case 0xb5:     //conv.ovf.i2
            case 0xb6:     //conv.ovf.u2
            case 0xb7:     //conv.ovf.i4
            case 0xb8:     //conv.ovf.u4
            case 0xb9:     //conv.ovf.i8
            case 0xba:     //conv.ovf.u8
            case 0xd1:     //conv.u2
            case 0xd2:     //conv.u1
            case 0xd3:     //conv.i
            case 0xd4:     //conv.ovf.i
            case 0xd5:     //conv.ovf.u
            case 0xe0:     //conv.u
                _typeToken = default(int);
                break;

            case 0x74:     //castclass
            case 0x79:     //unbox
            case 0x8c:     //box
            case 0xa5:     //unbox.any
                _typeToken = ReadMetadataToken(reader);
                break;

            default:
                throw global::XenoGears.Assertions.AssertionHelper.Fail();
            }

            // verify that we've read exactly the amount of bytes we should
            var bytesRead = reader.BaseStream.Position - origPos;

            global::XenoGears.Assertions.AssertionHelper.AssertTrue(bytesRead == SizeOfOperand);

            // now when the initialization is completed verify that we've got only prefixes we support
            global::XenoGears.Assertions.AssertionHelper.AssertAll(Prefixes, prefix =>
            {
                return(false);
            });
        }
示例#25
0
        internal Branch(global::Truesight.Parser.Impl.MethodBody source, global::System.IO.BinaryReader reader, global::System.Collections.ObjectModel.ReadOnlyCollection <global::Truesight.Parser.Impl.ILOp> prefixes)
            : base(source, AssertSupportedOpCode(reader), (int)reader.BaseStream.Position - global::System.Linq.Enumerable.Sum(global::System.Linq.Enumerable.Select(prefixes ?? global::XenoGears.Functional.EnumerableExtensions.ToReadOnly(global::System.Linq.Enumerable.Empty <global::Truesight.Parser.Impl.ILOp>()), prefix => prefix.Size)), prefixes ?? global::XenoGears.Functional.EnumerableExtensions.ToReadOnly(global::System.Linq.Enumerable.Empty <global::Truesight.Parser.Impl.ILOp>()))
        {
            // this is necessary for further verification
            var origPos = reader.BaseStream.Position;

            // initializing _relativeTargetOffset
            switch ((ushort)OpSpec.OpCode.Value)
            {
            case 0x2b:     //br.s
            case 0x2c:     //brfalse.s
            case 0x2d:     //brtrue.s
            case 0x2e:     //beq.s
            case 0x2f:     //bge.s
            case 0x30:     //bgt.s
            case 0x31:     //ble.s
            case 0x32:     //blt.s
            case 0x33:     //bne.un.s
            case 0x34:     //bge.un.s
            case 0x35:     //bgt.un.s
            case 0x36:     //ble.un.s
            case 0x37:     //blt.un.s
            case 0xde:     //leave.s
                _relativeTargetOffset = ReadI1(reader);
                break;

            case 0x38:     //br
            case 0x39:     //brfalse
            case 0x3a:     //brtrue
            case 0x3b:     //beq
            case 0x3c:     //bge
            case 0x3d:     //bgt
            case 0x3e:     //ble
            case 0x3f:     //blt
            case 0x40:     //bne.un
            case 0x41:     //bge.un
            case 0x42:     //bgt.un
            case 0x43:     //ble.un
            case 0x44:     //blt.un
            case 0xdd:     //leave
                _relativeTargetOffset = ReadI4(reader);
                break;

            default:
                throw global::XenoGears.Assertions.AssertionHelper.Fail();
            }

            // initializing _absoluteTargetOffset
            switch ((ushort)OpSpec.OpCode.Value)
            {
            case 0x2b:     //br.s
            case 0x2c:     //brfalse.s
            case 0x2d:     //brtrue.s
            case 0x2e:     //beq.s
            case 0x2f:     //bge.s
            case 0x30:     //bgt.s
            case 0x31:     //ble.s
            case 0x32:     //blt.s
            case 0x33:     //bne.un.s
            case 0x34:     //bge.un.s
            case 0x35:     //bgt.un.s
            case 0x36:     //ble.un.s
            case 0x37:     //blt.un.s
            case 0xde:     //leave.s
                _absoluteTargetOffset = (int)origPos + sizeof(sbyte) + _relativeTargetOffset;
                break;

            case 0x38:     //br
            case 0x39:     //brfalse
            case 0x3a:     //brtrue
            case 0x3b:     //beq
            case 0x3c:     //bge
            case 0x3d:     //bgt
            case 0x3e:     //ble
            case 0x3f:     //blt
            case 0x40:     //bne.un
            case 0x41:     //bge.un
            case 0x42:     //bgt.un
            case 0x43:     //ble.un
            case 0x44:     //blt.un
            case 0xdd:     //leave
                _absoluteTargetOffset = (int)origPos + sizeof(int) + _relativeTargetOffset;
                break;

            default:
                throw global::XenoGears.Assertions.AssertionHelper.Fail();
            }

            // verify that we've read exactly the amount of bytes we should
            var bytesRead = reader.BaseStream.Position - origPos;

            global::XenoGears.Assertions.AssertionHelper.AssertTrue(bytesRead == SizeOfOperand);

            // now when the initialization is completed verify that we've got only prefixes we support
            global::XenoGears.Assertions.AssertionHelper.AssertAll(Prefixes, prefix =>
            {
                return(false);
            });
        }
示例#26
0
        internal Ldc(global::Truesight.Parser.Impl.MethodBody source, global::System.IO.BinaryReader reader, global::System.Collections.ObjectModel.ReadOnlyCollection <global::Truesight.Parser.Impl.ILOp> prefixes)
            : base(source, AssertSupportedOpCode(reader), (int)reader.BaseStream.Position - global::System.Linq.Enumerable.Sum(global::System.Linq.Enumerable.Select(prefixes ?? global::XenoGears.Functional.EnumerableExtensions.ToReadOnly(global::System.Linq.Enumerable.Empty <global::Truesight.Parser.Impl.ILOp>()), prefix => prefix.Size)), prefixes ?? global::XenoGears.Functional.EnumerableExtensions.ToReadOnly(global::System.Linq.Enumerable.Empty <global::Truesight.Parser.Impl.ILOp>()))
        {
            // this is necessary for further verification
            var origPos = reader.BaseStream.Position;

            // initializing _constValue
            switch ((ushort)OpSpec.OpCode.Value)
            {
            case 0x14:     //ldnull
                _constValue = null;
                break;

            case 0x15:     //ldc.i4.m1
                _constValue = -1;
                break;

            case 0x16:     //ldc.i4.0
                _constValue = 0;
                break;

            case 0x17:     //ldc.i4.1
                _constValue = 1;
                break;

            case 0x18:     //ldc.i4.2
                _constValue = 2;
                break;

            case 0x19:     //ldc.i4.3
                _constValue = 3;
                break;

            case 0x1a:     //ldc.i4.4
                _constValue = 4;
                break;

            case 0x1b:     //ldc.i4.5
                _constValue = 5;
                break;

            case 0x1c:     //ldc.i4.6
                _constValue = 6;
                break;

            case 0x1d:     //ldc.i4.7
                _constValue = 7;
                break;

            case 0x1e:     //ldc.i4.8
                _constValue = 8;
                break;

            case 0x1f:     //ldc.i4.s
            case 0x20:     //ldc.i4
            case 0x21:     //ldc.i8
            case 0x22:     //ldc.r4
            case 0x23:     //ldc.r8
                _constValue = default(global::System.Object);
                break;

            case 0x72:     //ldstr
                _constValue = ((global::System.Func <global::System.String>)(() => { var token = ReadMetadataToken(reader); return(StringFromToken(token) ?? ("string at 0x" + token.ToString("x8"))); }))();
                break;

            case 0xd0:     //ldtoken
                _constValue = ((global::System.Func <global::System.Object>)(() => { var i_token = ReadMetadataToken(reader); var token = new global::Truesight.Parser.Api.Ops.RuntimeHandle(Source.Module, Source.Type, Source.Method, i_token); try { var resolved = token.ResolveHandle();     if (resolved != null)
                                                                                                                                                                                                                                                        {
                                                                                                                                                                                                                                                            return(resolved);
                                                                                                                                                                                                                                                        }
                                                                                                                                                                                                                                                        else
                                                                                                                                                                                                                                                        {
                                                                                                                                                                                                                                                            return(token);
                                                                                                                                                                                                                                                        } } catch { return(token); } }))();
                break;

            default:
                throw global::XenoGears.Assertions.AssertionHelper.Fail();
            }

            // initializing _useConstValue
            switch ((ushort)OpSpec.OpCode.Value)
            {
            case 0x14:     //ldnull
            case 0x15:     //ldc.i4.m1
            case 0x16:     //ldc.i4.0
            case 0x17:     //ldc.i4.1
            case 0x18:     //ldc.i4.2
            case 0x19:     //ldc.i4.3
            case 0x1a:     //ldc.i4.4
            case 0x1b:     //ldc.i4.5
            case 0x1c:     //ldc.i4.6
            case 0x1d:     //ldc.i4.7
            case 0x1e:     //ldc.i4.8
            case 0x72:     //ldstr
            case 0xd0:     //ldtoken
                _useConstValue = true;
                break;

            case 0x1f:     //ldc.i4.s
            case 0x20:     //ldc.i4
            case 0x21:     //ldc.i8
            case 0x22:     //ldc.r4
            case 0x23:     //ldc.r8
                _useConstValue = default(bool);
                break;

            default:
                throw global::XenoGears.Assertions.AssertionHelper.Fail();
            }

            // initializing _value
            switch ((ushort)OpSpec.OpCode.Value)
            {
            case 0x14:     //ldnull
            case 0x15:     //ldc.i4.m1
            case 0x16:     //ldc.i4.0
            case 0x17:     //ldc.i4.1
            case 0x18:     //ldc.i4.2
            case 0x19:     //ldc.i4.3
            case 0x1a:     //ldc.i4.4
            case 0x1b:     //ldc.i4.5
            case 0x1c:     //ldc.i4.6
            case 0x1d:     //ldc.i4.7
            case 0x1e:     //ldc.i4.8
            case 0x20:     //ldc.i4
                _value = _useConstValue ? _constValue : ReadI4(reader);
                break;

            case 0x1f:     //ldc.i4.s
                _value = _useConstValue ? _constValue : (int)ReadI1(reader);
                break;

            case 0x21:     //ldc.i8
                _value = _useConstValue ? _constValue : ReadI8(reader);
                break;

            case 0x22:     //ldc.r4
                _value = _useConstValue ? _constValue : ReadR4(reader);
                break;

            case 0x23:     //ldc.r8
                _value = _useConstValue ? _constValue : ReadR8(reader);
                break;

            case 0x72:     //ldstr
                _value = _useConstValue ? _constValue : ReadStr(reader);
                break;

            case 0xd0:     //ldtoken
                _value = _useConstValue ? _constValue : ReadToken(reader);
                break;

            default:
                throw global::XenoGears.Assertions.AssertionHelper.Fail();
            }

            // verify that we've read exactly the amount of bytes we should
            var bytesRead = reader.BaseStream.Position - origPos;

            global::XenoGears.Assertions.AssertionHelper.AssertTrue(bytesRead == SizeOfOperand);

            // now when the initialization is completed verify that we've got only prefixes we support
            global::XenoGears.Assertions.AssertionHelper.AssertAll(Prefixes, prefix =>
            {
                return(false);
            });
        }