Ejemplo n.º 1
0
        public int WriteOperand(byte[] array, int index)
        {
            int   before = index;
            short val    = _op.Value;

            fixed(byte *a = array)
            {
                int size = ILHelper.GetOperandSize(_op.OperandType);

                for (int i = 0; i < size; i++)
                {
                    a[index++] = _operand[i];
                }
            }

            return(index - before);
        }
Ejemplo n.º 2
0
        public static unsafe Op[] ReadIL(byte *il_ptr, long count)
        {
            List <Op> operations = new List <Op>();
            void *    end        = il_ptr + count;

            while (il_ptr < end)
            {
                OpCode code = ILHelper.ReadOpCode(il_ptr);

                il_ptr += code.Size;
                byte[] operand = ReadOperand(il_ptr, code.OperandType);
                il_ptr += operand.Length;

                operations.Add(new Op(code, operand));
            }

            return(operations.ToArray());
        }
Ejemplo n.º 3
0
 public T ReadOperand <T>() where T : unmanaged
 {
     fixed(byte *ptr = _operand)
     return(ILHelper.ReadILValue <T>(ptr));
 }