本文整理汇总了C#中IDecompiler.QueryAttribute方法的典型用法代码示例。如果您正苦于以下问题:C# IDecompiler.QueryAttribute方法的具体用法?C# IDecompiler.QueryAttribute怎么用?C# IDecompiler.QueryAttribute使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IDecompiler
的用法示例。
在下文中一共展示了IDecompiler.QueryAttribute方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: RewriteRead
public override void RewriteRead(CodeDescriptor decompilee, FieldInfo field, object instance, IDecompiler stack, IFunctionBuilder builder)
{
var me = stack.QueryAttribute<AsyncMethodDecompiler>();
var elem = (StackElement)me._tasks[field.Name];
stack.Push(elem);
}
示例2: RewriteWrite
public override void RewriteWrite(CodeDescriptor decompilee, FieldInfo field, object instance, StackElement value, IDecompiler stack, IFunctionBuilder builder)
{
var me = stack.QueryAttribute<AsyncMethodDecompiler>();
me._tasks[field.Name] = value;
}
示例3: Rewrite
public override bool Rewrite(CodeDescriptor decompilee, MethodBase callee, StackElement[] args, IDecompiler stack, IFunctionBuilder builder)
{
var ctx = stack.QueryAttribute<AsyncMethodDecompiler>();
if (ctx.ImplStyle == EAsyncImplStyle.FSM)
{
if (args.Length == 2 &&
ctx._curCoFSM.ResultVar != null)
{
builder.Store(ctx._curCoFSM.ResultVar, args[1].Expr);
if (args[1].Expr.ResultType.IsComplete)
ctx._curCoFSM.ResultVar.UpgradeType(args[1].Expr.ResultType);
}
var si = ctx.ForkInitialSI();
var pi = new ProceedWithStateInfo()
{
TargetState = si,
TargetWaitState = false,
LambdaTransition = false
};
if (ctx._curCoFSM != null &&
ctx._curCoFSM.DoneVar != null)
{
var tr = LiteralReference.CreateConstant(true);
builder.Store(ctx._curCoFSM.DoneVar, tr);
pi.TargetState = null;
}
var fspec = new FunctionSpec(typeof(void))
{
IntrinsicRep = IntrinsicFunctions.ProceedWithState(pi)
};
builder.Call(fspec, LiteralReference.CreateConstant(pi));
}
return true;
}
示例4: Rewrite
public override bool Rewrite(CodeDescriptor decompilee, MethodBase callee, StackElement[] args, IDecompiler stack, IFunctionBuilder builder)
{
var amd = stack.QueryAttribute<AsyncMethodDecompiler>();
if (amd != null && amd.ImplStyle == EAsyncImplStyle.FSM)
{
return false;
}
object[] outArgs;
object result;
stack.TryGetReturnValueSample((MethodInfo)callee, args, out outArgs, out result);
var fspec = new FunctionSpec(typeof(Task))
{
CILRep = callee
};
var fcall = new FunctionCall()
{
Callee = fspec,
Arguments = args.Select(a => a.Expr).ToArray(),
ResultType = TypeDescriptor.GetTypeOf(result)
};
stack.Push(fcall, result);
return true;
}