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


C# Emit.Instruction类代码示例

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


Instruction类属于dnlib.DotNet.Emit命名空间,在下文中一共展示了Instruction类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Clear

 public void Clear()
 {
     instructions = new List<Instruction>();
     branchOrRet = new List<Instruction>();
     afterInstr = null;
     fakeBranches = new List<Instruction>();
 }
开发者ID:M3rcurio,项目名称:denvlib,代码行数:7,代码来源:ControlFlowTask.cs

示例2: EmulateUntil

 public void EmulateUntil(Instruction instruction, CilBody body, Instruction starter)
 {
     Snapshots.Add(new Snapshot(new Stack<StackEntry>(Stack), new Dictionary<int, LocalEntry>(_locals),
                                instruction, _methodBody, null));
     _instructionPointer = starter.GetInstructionIndex(body.Instructions) - 1;
     Trace(() => _methodBody.Instructions[_instructionPointer] != instruction);
 }
开发者ID:GodLesZ,项目名称:ConfuserDeobfuscator,代码行数:7,代码来源:ILEmulator.cs

示例3: FollowsPattern

 public static bool FollowsPattern(
     this Instruction instr,
     CilBody body,
     out Instruction ender,
     List<Predicate<Instruction>> preds,
     int minPatternSize,
     out int patternSize)
 {
     var curInstr = instr;
     ender = null;
     var correct = 0;
     patternSize = 0;
     while (curInstr.Next(body) != null && preds.Any(p => p(curInstr.Next(body))))
     {
         curInstr = curInstr.Next(body);
         correct++;
     }
     if (correct >= minPatternSize)
     {
         patternSize = correct + 1;
         ender = curInstr;
         return true;
     }
     return false;
 }
开发者ID:n017,项目名称:ConfuserDeobfuscator,代码行数:25,代码来源:InstructionExt.cs

示例4: getInstruction

 static Instruction getInstruction(IList<Instruction> instrs, Instruction source, int displ)
 {
     int sourceIndex = instrs.IndexOf(source);
     if (sourceIndex < 0)
         throw new ApplicationException("Could not find source instruction");
     return instrs[sourceIndex + displ];
 }
开发者ID:GodLesZ,项目名称:ConfuserDeobfuscator,代码行数:7,代码来源:CsvmToCilMethodConverter.cs

示例5: OnAfterLoadArg

		protected override Instruction OnAfterLoadArg(MethodDef methodToInline, Instruction instr, ref int instrIndex) {
			if (instr.OpCode.Code != Code.Box)
				return instr;
			if (methodToInline.MethodSig.GetGenParamCount() == 0)
				return instr;
			return DotNetUtils.GetInstruction(methodToInline.Body.Instructions, ref instrIndex);
		}
开发者ID:SAD1992,项目名称:justdecompile-plugins,代码行数:7,代码来源:DsMethodCallInliner.cs

示例6: MarkAsBranchTarget

		void MarkAsBranchTarget(Instruction instr) {
			if (instr == null)
				return;

			int index = instrToIndex[instr];
			GetBranchTargetList(index);	// Just create the list
		}
开发者ID:SAD1992,项目名称:justdecompile-plugins,代码行数:7,代码来源:InstructionListParser.cs

示例7: Emulate

		public bool Emulate(Instruction instr) {
			switch (instr.OpCode.Code) {
			case Code.Br:
			case Code.Br_S:		return Emulate_Br();
			case Code.Beq:
			case Code.Beq_S:	return Emulate_Beq();
			case Code.Bge:
			case Code.Bge_S:	return Emulate_Bge();
			case Code.Bge_Un:
			case Code.Bge_Un_S:	return Emulate_Bge_Un();
			case Code.Bgt:
			case Code.Bgt_S:	return Emulate_Bgt();
			case Code.Bgt_Un:
			case Code.Bgt_Un_S:	return Emulate_Bgt_Un();
			case Code.Ble:
			case Code.Ble_S:	return Emulate_Ble();
			case Code.Ble_Un:
			case Code.Ble_Un_S:	return Emulate_Ble_Un();
			case Code.Blt:
			case Code.Blt_S:	return Emulate_Blt();
			case Code.Blt_Un:
			case Code.Blt_Un_S:	return Emulate_Blt_Un();
			case Code.Bne_Un:
			case Code.Bne_Un_S:	return Emulate_Bne_Un();
			case Code.Brfalse:
			case Code.Brfalse_S:return Emulate_Brfalse();
			case Code.Brtrue:
			case Code.Brtrue_S:	return Emulate_Brtrue();
			case Code.Switch:	return Emulate_Switch();

			default:
				return false;
			}
		}
开发者ID:SAD1992,项目名称:justdecompile-plugins,代码行数:34,代码来源:BranchEmulator.cs

示例8: EmitDecode

		public Instruction[] EmitDecode(MethodDef init, RPContext ctx, Instruction[] arg) {
			Tuple<Expression, Func<int, int>> key = GetKey(ctx, init);

			var invCompiled = new List<Instruction>();
			new CodeGen(arg, ctx.Method, invCompiled).GenerateCIL(key.Item1);
			init.Body.MaxStack += (ushort)ctx.Depth;
			return invCompiled.ToArray();
		}
开发者ID:EmilZhou,项目名称:ConfuserEx,代码行数:8,代码来源:ExpressionEncoding.cs

示例9: ReadInlineTok

		protected override ITokenOperand ReadInlineTok(Instruction instr) {
			switch (reader.ReadByte()) {
			case 0: return imageReader.ReadTypeSig().ToTypeDefOrRef();
			case 1: return imageReader.ReadFieldRef();
			case 2: return imageReader.ReadMethodRef();
			default: throw new ApplicationException("Unknown token type");
			}
		}
开发者ID:RafaelRMachado,项目名称:de4dot,代码行数:8,代码来源:MethodBodyReader.cs

示例10: EmitDecode

		public Instruction[] EmitDecode(MethodDef init, RPContext ctx, Instruction[] arg) {
			Tuple<MethodDef, Func<int, int>> key = GetKey(ctx, init);

			var repl = new List<Instruction>();
			repl.AddRange(arg);
			repl.Add(Instruction.Create(OpCodes.Call, key.Item1));
			return repl.ToArray();
		}
开发者ID:EmilZhou,项目名称:ConfuserEx,代码行数:8,代码来源:x86Encoding.cs

示例11: getExInfo

 ExInfo getExInfo(Instruction instruction)
 {
     if (instruction == null)
         return lastExInfo;
     ExInfo exInfo;
     if (!exInfos.TryGetValue(instruction, out exInfo))
         exInfos[instruction] = exInfo = new ExInfo();
     return exInfo;
 }
开发者ID:n017,项目名称:ConfuserDeobfuscator,代码行数:9,代码来源:MethodPrinter.cs

示例12: checkInvokeCall

 static bool checkInvokeCall(Instruction instr, string returnType, string parameters)
 {
     var method = instr.Operand as MethodDef;
     if (method == null)
         return false;
     if (method.Name != "Invoke")
         return false;
     return DotNetUtils.isMethod(method, returnType, parameters);
 }
开发者ID:n017,项目名称:ConfuserDeobfuscator,代码行数:9,代码来源:TamperDetection.cs

示例13: GetInstructionSize

 protected static int GetInstructionSize(Instruction instr)
 {
     var opcode = instr.OpCode;
     if (opcode == null)
         return 5;	// Load store/field
     var op = instr.Operand as SwitchTargetDisplOperand;
     if (op == null)
         return instr.GetSize();
     return instr.OpCode.Size + (op.TargetDisplacements.Length + 1) * 4;
 }
开发者ID:kakkerlakgly,项目名称:de4dot,代码行数:10,代码来源:CsvmToCilMethodConverterBase.cs

示例14: GetOffset

		/// <summary>
		/// Gets the offset of an instruction
		/// </summary>
		/// <param name="instr">The instruction</param>
		/// <returns>The offset or <c>0</c> if <paramref name="instr"/> is <c>null</c> or not
		/// present in the list of all instructions.</returns>
		protected uint GetOffset(Instruction instr) {
			if (instr == null) {
				Error("Instruction is null");
				return 0;
			}
			uint offset;
			if (offsets.TryGetValue(instr, out offset))
				return offset;
			Error("Found some other method's instruction or a removed instruction. You probably removed an instruction that is the target of a branch instruction or an instruction that's the first/last instruction in an exception handler.");
			return 0;
		}
开发者ID:EmilZhou,项目名称:dnlib,代码行数:17,代码来源:MethodBodyWriterBase.cs

示例15: InlineLoadMethod

		protected bool InlineLoadMethod(int patchIndex, MethodDef methodToInline, Instruction loadInstr, int instrIndex) {
			if (!IsReturn(methodToInline, instrIndex))
				return false;

			int methodArgsCount = DotNetUtils.GetArgsCount(methodToInline);
			for (int i = 0; i < methodArgsCount; i++)
				block.Insert(patchIndex++, OpCodes.Pop.ToInstruction());

			block.Instructions[patchIndex] = new Instr(loadInstr.Clone());
			return true;
		}
开发者ID:RafaelRMachado,项目名称:de4dot,代码行数:11,代码来源:MethodCallInlinerBase.cs


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