本文整理汇总了C#中IInstructionOperandResolver类的典型用法代码示例。如果您正苦于以下问题:C# IInstructionOperandResolver类的具体用法?C# IInstructionOperandResolver怎么用?C# IInstructionOperandResolver使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IInstructionOperandResolver类属于命名空间,在下文中一共展示了IInstructionOperandResolver类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: arithmetic_read
static Instruction arithmetic_read(BinaryReader reader, IInstructionOperandResolver resolver, GenericParamContext gpContext) {
switch (reader.ReadByte()) {
case 0: return OpCodes.Add.ToInstruction();
case 1: return OpCodes.Add_Ovf.ToInstruction();
case 2: return OpCodes.Add_Ovf_Un.ToInstruction();
case 3: return OpCodes.Sub.ToInstruction();
case 4: return OpCodes.Sub_Ovf.ToInstruction();
case 5: return OpCodes.Sub_Ovf_Un.ToInstruction();
case 6: return OpCodes.Mul.ToInstruction();
case 7: return OpCodes.Mul_Ovf.ToInstruction();
case 8: return OpCodes.Mul_Ovf_Un.ToInstruction();
case 9: return OpCodes.Div.ToInstruction();
case 10: return OpCodes.Div_Un.ToInstruction();
case 11: return OpCodes.Rem.ToInstruction();
case 12: return OpCodes.Rem_Un.ToInstruction();
default: throw new ApplicationException("Invalid opcode");
}
}
开发者ID:RafaelRMachado,项目名称:de4dot,代码行数:18,代码来源:OpCodeHandler.cs
示例2: ldelem_read
static Instruction ldelem_read(BinaryReader reader, IInstructionOperandResolver resolver, GenericParamContext gpContext) {
Instruction instr = null;
bool first = reader.ReadBoolean();
bool second = reader.ReadBoolean();
int value = reader.ReadInt32();
foreach (var info in instructionInfos2) {
if (info.First != first || info.Second != second)
continue;
if (second && value != info.Value)
continue;
if (second)
instr = new Instruction(info.OpCode);
else
instr = new Instruction(info.OpCode, resolver.ResolveToken((uint)value, gpContext));
break;
}
if (instr == null)
throw new ApplicationException("Invalid opcode");
return instr;
}
开发者ID:RafaelRMachado,项目名称:de4dot,代码行数:22,代码来源:OpCodeHandler.cs
示例3: CreateCilBody
/// <summary>
/// Creates a CIL method body or returns an empty one if <paramref name="reader"/> doesn't
/// point to the start of a valid CIL method body.
/// </summary>
/// <param name="opResolver">The operand resolver</param>
/// <param name="reader">A reader positioned at the start of a .NET method body</param>
/// <param name="method">Use parameters from this method</param>
/// <param name="gpContext">Generic parameter context</param>
public static CilBody CreateCilBody(IInstructionOperandResolver opResolver, IBinaryReader reader, MethodDef method, GenericParamContext gpContext) {
return CreateCilBody(opResolver, reader, null, method.Parameters, gpContext);
}
开发者ID:xingkongtianyu,项目名称:Protect.NET,代码行数:11,代码来源:MethodBodyReader.cs
示例4: MethodBodyReader
/// <summary>
/// Constructor
/// </summary>
/// <param name="opResolver">The operand resolver</param>
/// <param name="codeReader">A reader positioned at the start of a .NET method body</param>
/// <param name="ehReader">Exception handler reader or <c>null</c> if exceptions aren't
/// present or if <paramref name="codeReader"/> contains the exception handlers</param>
/// <param name="parameters">Method parameters</param>
public MethodBodyReader(IInstructionOperandResolver opResolver, IBinaryReader codeReader, IBinaryReader ehReader, IList<Parameter> parameters)
: this(opResolver, codeReader, ehReader, parameters, new GenericParamContext()) {
}
开发者ID:xingkongtianyu,项目名称:Protect.NET,代码行数:11,代码来源:MethodBodyReader.cs
示例5: box_read
static Instruction box_read(BinaryReader reader, IInstructionOperandResolver resolver, GenericParamContext gpContext) {
var instr = new Instruction();
switch (reader.ReadByte()) {
case 0: instr.OpCode = OpCodes.Box; break;
case 1: instr.OpCode = OpCodes.Unbox_Any; break;
default: throw new ApplicationException("Invalid opcode");
}
instr.Operand = resolver.ResolveToken(reader.ReadUInt32(), gpContext);
return instr;
}
开发者ID:RafaelRMachado,项目名称:de4dot,代码行数:10,代码来源:OpCodeHandler.cs
示例6: ldftn_read
static Instruction ldftn_read(BinaryReader reader, IInstructionOperandResolver resolver, GenericParamContext gpContext) {
byte code = reader.ReadByte();
uint token = reader.ReadUInt32();
switch (code) {
case 0:
return new Instruction(OpCodes.Ldftn, resolver.ResolveToken(token, gpContext));
case 1:
reader.ReadInt32(); // token of newobj .ctor
return new Instruction(OpCodes.Ldvirtftn, resolver.ResolveToken(token, gpContext));
default:
throw new ApplicationException("Invalid opcode");
}
}
开发者ID:RafaelRMachado,项目名称:de4dot,代码行数:16,代码来源:OpCodeHandler.cs
示例7: ldc_read
static Instruction ldc_read(BinaryReader reader, IInstructionOperandResolver resolver, GenericParamContext gpContext) {
switch ((ElementType)reader.ReadByte()) {
case ElementType.I4: return Instruction.CreateLdcI4(reader.ReadInt32());
case ElementType.I8: return OpCodes.Ldc_I8.ToInstruction(reader.ReadInt64());
case ElementType.R4: return OpCodes.Ldc_R4.ToInstruction(reader.ReadSingle());
case ElementType.R8: return OpCodes.Ldc_R8.ToInstruction(reader.ReadDouble());
case ElementType.Object: return OpCodes.Ldnull.ToInstruction();
default: throw new ApplicationException("Invalid opcode");
}
}
开发者ID:RafaelRMachado,项目名称:de4dot,代码行数:10,代码来源:OpCodeHandler.cs
示例8: leave_read
static Instruction leave_read(BinaryReader reader, IInstructionOperandResolver resolver, GenericParamContext gpContext) {
int displacement = reader.ReadInt32();
return new Instruction(OpCodes.Leave, new TargetDisplOperand(displacement));
}
开发者ID:RafaelRMachado,项目名称:de4dot,代码行数:4,代码来源:OpCodeHandler.cs
示例9: ldstr_read
static Instruction ldstr_read(BinaryReader reader, IInstructionOperandResolver resolver, GenericParamContext gpContext) {
return OpCodes.Ldstr.ToInstruction(reader.ReadString());
}
开发者ID:RafaelRMachado,项目名称:de4dot,代码行数:3,代码来源:OpCodeHandler.cs
示例10: ldloca_read
static Instruction ldloca_read(BinaryReader reader, IInstructionOperandResolver resolver, GenericParamContext gpContext) {
Instruction instr = new Instruction();
if (reader.ReadBoolean()) {
instr.OpCode = OpCodes.Ldarga;
instr.Operand = new ArgOperand(reader.ReadUInt16());
}
else {
instr.OpCode = OpCodes.Ldloca;
instr.Operand = new LocalOperand(reader.ReadUInt16());
}
return instr;
}
开发者ID:RafaelRMachado,项目名称:de4dot,代码行数:13,代码来源:OpCodeHandler.cs
示例11: ldfld_read
static Instruction ldfld_read(BinaryReader reader, IInstructionOperandResolver resolver, GenericParamContext gpContext) {
byte b = reader.ReadByte();
var field = resolver.ResolveToken(reader.ReadUInt32(), gpContext) as IField;
switch (b) {
case 0: return new Instruction(null, new FieldInstructionOperand(OpCodes.Ldsfld, OpCodes.Ldfld, field));
case 1: return new Instruction(null, new FieldInstructionOperand(OpCodes.Ldsflda, OpCodes.Ldflda, field));
case 2: return new Instruction(null, new FieldInstructionOperand(OpCodes.Stsfld, OpCodes.Stfld, field));
default: throw new ApplicationException("Invalid opcode");
}
}
开发者ID:RafaelRMachado,项目名称:de4dot,代码行数:10,代码来源:OpCodeHandler.cs
示例12: endfinally_read
static Instruction endfinally_read(BinaryReader reader, IInstructionOperandResolver resolver, GenericParamContext gpContext) {
return OpCodes.Endfinally.ToInstruction();
}
开发者ID:RafaelRMachado,项目名称:de4dot,代码行数:3,代码来源:OpCodeHandler.cs
示例13: logical_read
static Instruction logical_read(BinaryReader reader, IInstructionOperandResolver resolver, GenericParamContext gpContext) {
switch (reader.ReadByte()) {
case 0: return OpCodes.And.ToInstruction();
case 1: return OpCodes.Or.ToInstruction();
case 2: return OpCodes.Xor.ToInstruction();
case 3: return OpCodes.Shl.ToInstruction();
case 4: return OpCodes.Shr.ToInstruction();
case 5: return OpCodes.Shr_Un.ToInstruction();
default: throw new ApplicationException("Invalid opcode");
}
}
开发者ID:RafaelRMachado,项目名称:de4dot,代码行数:11,代码来源:OpCodeHandler.cs
示例14: newarr_read
static Instruction newarr_read(BinaryReader reader, IInstructionOperandResolver resolver, GenericParamContext gpContext) {
return new Instruction(OpCodes.Newarr, resolver.ResolveToken(reader.ReadUInt32(), gpContext));
}
开发者ID:RafaelRMachado,项目名称:de4dot,代码行数:3,代码来源:OpCodeHandler.cs
示例15: ret_read
static Instruction ret_read(BinaryReader reader, IInstructionOperandResolver resolver, GenericParamContext gpContext) {
reader.ReadInt32(); // token of current method
return OpCodes.Ret.ToInstruction();
}
开发者ID:RafaelRMachado,项目名称:de4dot,代码行数:4,代码来源:OpCodeHandler.cs
示例16: stloc_read
static Instruction stloc_read(BinaryReader reader, IInstructionOperandResolver resolver, GenericParamContext gpContext) {
bool isStarg = reader.ReadBoolean();
ushort index = reader.ReadUInt16();
var instr = new Instruction();
if (isStarg) {
instr.OpCode = OpCodes.Starg;
instr.Operand = new ArgOperand(index);
}
else {
instr.OpCode = OpCodes.Stloc;
instr.Operand = new LocalOperand(index);
reader.ReadInt32(); // ElementType of local
}
return instr;
}
开发者ID:RafaelRMachado,项目名称:de4dot,代码行数:17,代码来源:OpCodeHandler.cs
示例17: stobj_read
static Instruction stobj_read(BinaryReader reader, IInstructionOperandResolver resolver, GenericParamContext gpContext) {
return new Instruction(OpCodes.Stobj, null);
}
开发者ID:RafaelRMachado,项目名称:de4dot,代码行数:3,代码来源:OpCodeHandler.cs
示例18: switch_read
static Instruction switch_read(BinaryReader reader, IInstructionOperandResolver resolver, GenericParamContext gpContext) {
int numTargets = reader.ReadInt32();
int[] targetDispls = new int[numTargets];
for (int i = 0; i < targetDispls.Length; i++)
targetDispls[i] = reader.ReadInt32();
return new Instruction(OpCodes.Switch, new SwitchTargetDisplOperand(targetDispls));
}
开发者ID:RafaelRMachado,项目名称:de4dot,代码行数:7,代码来源:OpCodeHandler.cs
示例19: throw_read
static Instruction throw_read(BinaryReader reader, IInstructionOperandResolver resolver, GenericParamContext gpContext) {
return OpCodes.Throw.ToInstruction();
}
开发者ID:RafaelRMachado,项目名称:de4dot,代码行数:3,代码来源:OpCodeHandler.cs
示例20: neg_read
static Instruction neg_read(BinaryReader reader, IInstructionOperandResolver resolver, GenericParamContext gpContext) {
switch (reader.ReadByte()) {
case 0: return OpCodes.Neg.ToInstruction();
case 1: return OpCodes.Not.ToInstruction();
default: throw new ApplicationException("Invalid opcode");
}
}
开发者ID:RafaelRMachado,项目名称:de4dot,代码行数:7,代码来源:OpCodeHandler.cs
注:本文中的IInstructionOperandResolver类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论