private static void HandleOperator(object sender, HandleOperatorArgs e) { if (Handlers.ContainsKey(e.Symbol)) { e.Result = Handlers[e.Symbol].Process(e); } }
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; }
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])); } }
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(); }