当前位置: 首页>>代码示例>>C#>>正文


C# IInstructionOperandResolver类代码示例

本文整理汇总了C#中IInstructionOperandResolver的典型用法代码示例。如果您正苦于以下问题:C# IInstructionOperandResolver类的具体用法?C# IInstructionOperandResolver怎么用?C# IInstructionOperandResolver使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


IInstructionOperandResolver类属于命名空间,在下文中一共展示了IInstructionOperandResolver类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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


注:本文中的IInstructionOperandResolver类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。