public TestDescriptor(string name, string template, object[] values, ResultGetter resultGetter) { Name = name; Template = template; ContextValues = values; this.resultGetter = resultGetter; }
public TestDescriptor(string name, string template, object[] values, ResultGetter resultGetter, params string[] vars) { Name = name; Template = template; ContextValues = values; this.resultGetter = resultGetter; Vars = vars; }
// Socket.Accept wrapper public IEnumerator Accept() { SocketAsyncEventArgs e = this.EventArgs(); ResultGetter returnAcceptSocket = new ResultGetter(delegate(SocketAsyncEventArgs _e) { return new Cosocket(_e.AcceptSocket); }); return this.Spawn(this.socket.AcceptAsync, e, returnAcceptSocket); }
// Socket.Accept wrapper public IEnumerator Accept() { SocketAsyncEventArgs e = this.EventArgs(); ResultGetter returnAcceptSocket = new ResultGetter(delegate(SocketAsyncEventArgs _e) { return(new Cosocket(_e.AcceptSocket)); }); return(this.Spawn(this.socket.AcceptAsync, e, returnAcceptSocket)); }
public void Register(string field, ResultGetter resultGetter) { _fields.Add(field, resultGetter); }
protected IEnumerator Spawn(Func <SocketAsyncEventArgs, bool> sockMethod, SocketAsyncEventArgs e, ResultGetter getResult) { if (!sockMethod(e)) { // complete immediately if (getResult != null) { yield return(getResult(e)); } yield break; } uint token = (uint)e.UserToken; this.waiting.Add(token); while (true) { if (this.waiting.Contains(token)) { yield return(null); } else { if (getResult != null) { yield return(getResult(e)); } yield break; } } }
protected IEnumerator Spawn(Func<SocketAsyncEventArgs, bool> sockMethod, SocketAsyncEventArgs e, ResultGetter getResult) { if (!sockMethod(e)) { // complete immediately if (getResult != null) { yield return getResult(e); } yield break; } uint token = (uint)e.UserToken; this.waiting.Add(token); while (true) { if (this.waiting.Contains(token)) { yield return null; } else { if (getResult != null) { yield return getResult(e); } yield break; } } }
private void AddCommand(string name, string title, string subtitle, Action action, ResultGetter func, string path) { var actualPath = string.IsNullOrEmpty(path) ? string.Empty : path; if (name == null) { DefaultCommandInfoByPath[actualPath] = new CommandInfo { ResultGetter = func }; } else { var commandInfo = new CommandInfo { Name = name, Title = title, Subtitle = subtitle, FinalAction = action, ResultGetter = func, Path = actualPath }; GetCommandInfos(actualPath).Add(commandInfo); } }
protected void AddCommand(string name, string title, string subtitle, ResultGetter func, string path) => AddCommand(name, title, subtitle, null, func, path);
protected void AddCommand(string name, string title, string subtitle, ResultGetter func) => AddCommand(name, title, subtitle, func, string.Empty);
protected void AddDefaultCommand(ResultGetter func, string path) => AddCommand(null, null, null, null, func, path);
protected void AddDefaultCommand(ResultGetter func) => AddDefaultCommand(func, string.Empty);