Example #1
0
 public static MsilInstruction Create(MsilOpCode code, IList <MsilInstruction> operand)
 {
     if (code.OperandType != MsilOperandType.InlineSwitch)
     {
         throw new ArgumentException("Opcode does not accept an instruction array operand.", "code");
     }
     return(new MsilInstruction(0, code, operand));
 }
Example #2
0
 public static MsilInstruction Create(MsilOpCode code, float operand)
 {
     if (code.OperandType != MsilOperandType.ShortInlineR)
     {
         throw new ArgumentException("Opcode does not accept a float32 operand.", "code");
     }
     return(new MsilInstruction(0, code, operand));
 }
Example #3
0
 public static MsilInstruction Create(MsilOpCode code, string operand)
 {
     if (code.OperandType != MsilOperandType.InlineString)
     {
         throw new ArgumentException("Opcode does not accept a string operand.", "code");
     }
     return(new MsilInstruction(0, code, operand));
 }
Example #4
0
 public static MsilInstruction Create(MsilOpCode code, MsilInstruction instruction)
 {
     if (code.OperandType != MsilOperandType.ShortInlineBrTarget && code.OperandType != MsilOperandType.InlineBrTarget)
     {
         throw new ArgumentException("Opcode does not accept an instruction operand.", "code");
     }
     return(new MsilInstruction(0, code, instruction));
 }
Example #5
0
 public static MsilInstruction Create(MsilOpCode code)
 {
     if (code.OperandType != MsilOperandType.InlineNone)
     {
         throw new ArgumentException("Opcode requires an operand.", "code");
     }
     return(new MsilInstruction(0, code, null));
 }
Example #6
0
 public static MsilInstruction Create(MsilOpCode code, ParameterSignature operand)
 {
     if (code.OperandType != MsilOperandType.InlineArgument && code.OperandType != MsilOperandType.ShortInlineArgument)
     {
         throw new ArgumentException("Opcode does not accept a parameter operand.", "code");
     }
     return(new MsilInstruction(0, code, operand));
 }
Example #7
0
 public static MsilInstruction Create(MsilOpCode code, VariableSignature operand)
 {
     if (code.OperandType != MsilOperandType.InlineVar && code.OperandType != MsilOperandType.ShortInlineVar)
     {
         throw new ArgumentException("Opcode does not accept a local variable operand.", "code");
     }
     return(new MsilInstruction(0, code, operand));
 }
Example #8
0
 private void WriteOpCode(MsilOpCode opCode)
 {
     if (opCode.Size == 2)
     {
         _writer.WriteByte(opCode.Op1);
     }
     _writer.WriteByte(opCode.Op2);
 }
Example #9
0
 public static MsilInstruction Create(MsilOpCode code, IMemberReference operand)
 {
     switch (code.OperandType)
     {
     case MsilOperandType.InlineField:
     case MsilOperandType.InlineMethod:
     case MsilOperandType.InlineTok:
     case MsilOperandType.InlineType:
         return(new MsilInstruction(0, code, operand));
     }
     throw new ArgumentException("Opcode does not accept a member operand operand.", "code");
 }
Example #10
0
 public MsilInstruction(int offset, MsilOpCode opCode, object operand)
 {
     Offset  = offset;
     OpCode  = opCode;
     Operand = operand;
 }