Пример #1
0
 public void Run(ICommandInteraction writer, [Values(TraceEnableCommand)] LiteralToken enable, LiteralToken cpuToken, StringToken functionName, BooleanToken traceReturn, params LiteralToken[] types)
 {
     var cpu = (Arm)monitor.ConvertValueOrThrowRecoverable(cpuToken.Value, typeof(Arm));
     var cpuTracer = EnsureTracer(cpu);
     var handler = new DefaultFunctionHandler(cpu);
     var paramList = new List<FunctionCallParameter>();
     foreach(var parameter in types)
     {
         FunctionCallParameterType paramType;
         if(!Enum.TryParse(parameter.Value, out paramType))
         {
             throw new RecoverableException("{0} is not a proper parameter type.".FormatWith(parameter.Value));
         }
         paramList.Add(new FunctionCallParameter{ Type = paramType });
     }
     handler.CallParameters = paramList.Take(paramList.Count - (traceReturn.Value ? 1 : 0));
     handler.ReturnParameter = traceReturn.Value ? paramList.Last() : (FunctionCallParameter?)null;
     if(traceReturn.Value)
     {
         cpuTracer.TraceFunction(functionName.Value, handler.CallParameters, handler.CallHandler, handler.ReturnParameter, handler.ReturnHandler);
     }
     else
     {
         cpuTracer.TraceFunction(functionName.Value, handler.CallParameters, handler.CallHandler);
     }
     
 }
Пример #2
0
 public void RunnableAttribute(ICommandInteraction writer, BooleanToken allow)
 {
     if(allow.Value)
     {
         monitor.CurrentBindingFlags |= BindingFlags.NonPublic;
     }
     else
     {
         monitor.CurrentBindingFlags &= ~BindingFlags.NonPublic;
     }
 }
Пример #3
0
 public void Run(ICommandInteraction writer, [Values(TraceEnableCommand)] LiteralToken enable, LiteralToken cpuToken, StringToken functionName, BooleanToken traceReturn, NumericToken numberOfParameters)
 {
     Execute(writer, cpuToken, functionName.Value, traceReturn.Value, (int)numberOfParameters.Value);
 }
Пример #4
0
 public void Run(ICommandInteraction writer, [Values(TraceEnableCommand)] LiteralToken enable, LiteralToken cpuToken, StringToken functionName, BooleanToken traceReturn)
 {
     Execute(writer, cpuToken, functionName.Value, traceReturn.Value, null);
 }
Пример #5
0
 public void SetVerbosity(ICommandInteraction writer, BooleanToken verbosity)
 {
     verbose = verbosity.Value;
     setVerbosity(verbose);
 }