private static void HandleOperator(object sender, HandleOperatorArgs e)
 {
     if (Handlers.ContainsKey(e.Symbol))
     {
         e.Result = Handlers[e.Symbol].Process(e);
     }
 }
예제 #2
0
    protected static HandleOperatorArgs OnHandleOperator(object sender, IScriptContext context, string symbol, params object[] parameters)
    {
      HandleOperatorArgs args = new HandleOperatorArgs(context, symbol, parameters);

      if (HandleOperator != null)
        HandleOperator.Invoke(sender, args);

      return args;
    }
예제 #3
0
        public object Process(HandleOperatorArgs args)
        {
            if (args == null)
            {
                throw new NotSupportedException();
            }

            EventInfo @event = args.Arguments.FirstOrDefault() as EventInfo;

            if (@event == null)
            {
                return(null);
            }

            args.Cancel = true;
            if (subscribe)
            {
                return(args.Arguments[1]);
            }
            else
            {
                return(new RemoveDelegate((IInvokable)args.Arguments[1]));
            }
        }
예제 #4
0
            public object Process(HandleOperatorArgs args)
            {
                if (args.Arguments != null && args.Arguments.Length == 1)
                {
                  string value = (string)args.Arguments[0];
                  args.Cancel = true;
                  return int.Parse(value);
                }

                throw new NotSupportedException();
            }