static Task HandleCommand(IrcConnection conn, string prefix, string command, string[] args) { Func <IrcConnection, string, string, string[], Task> handler; if (!_handlers.TryGetValue(command, out handler)) { // handler not yet registered MethodInfo mi; if (!_handlerInfos.TryGetValue(command, out mi)) { mi = _defaultHandler; } ParameterExpression pInstance = Expression.Parameter(typeof(IrcConnection), "instance"), pPrefix = Expression.Parameter(typeof(string), "prefix"), pCmd = Expression.Parameter(typeof(string), "cmd"), pArgs = Expression.Parameter(typeof(string[]), "args"); ParameterExpression[] all = new[] { pInstance, pPrefix, pCmd, pArgs }; var lambda = Expression.Lambda <Func <IrcConnection, string, string, string[], Task> >( Expression.Call( pInstance, mi, pPrefix, pCmd, pArgs ), all ); handler = _handlers[command] = lambda.Compile(); } return(handler(conn, prefix, command, args)); }
static Task HandleCommand(IrcConnection conn, string prefix, string command, string[] args) { Func<IrcConnection, string, string, string[], Task> handler; if (!_handlers.TryGetValue(command, out handler)) { // handler not yet registered MethodInfo mi; if (!_handlerInfos.TryGetValue(command, out mi)) mi = _defaultHandler; ParameterExpression pInstance = Expression.Parameter(typeof(IrcConnection), "instance"), pPrefix = Expression.Parameter(typeof(string), "prefix"), pCmd = Expression.Parameter(typeof(string), "cmd"), pArgs = Expression.Parameter(typeof(string[]), "args"); ParameterExpression[] all = new[] { pInstance, pPrefix, pCmd, pArgs }; var lambda = Expression.Lambda<Func<IrcConnection, string, string, string[], Task>>( Expression.Call( pInstance, mi, pPrefix, pCmd, pArgs ), all ); handler = _handlers[command] = lambda.Compile(); } return handler(conn, prefix, command, args); }
public IrcChannel(IrcConnection connection, string name) { _connection = connection; _name = name; _users = new List<Guid>(); _userStates = new Dictionary<Guid, UserMode>(); _loaded = new TaskCompletionSource<IIrcChannel>(); _state = State.WaitingForJoin; _userList = new ChannelUserList(this); _userObjects = new Dictionary<Guid, IrcChannelUser>(); }
public IrcChannel(IrcConnection connection, string name) { _connection = connection; _name = name; _users = new List <Guid>(); _userStates = new Dictionary <Guid, UserMode>(); _loaded = new TaskCompletionSource <IIrcChannel>(); _state = State.WaitingForJoin; _userList = new ChannelUserList(this); _userObjects = new Dictionary <Guid, IrcChannelUser>(); }
public IrcCurrentUser(IrcConnection conn) { _conn = conn; }
public IrcUser(IrcConnection connection, Guid guid) { _connection = connection; _guid = guid; }
public ChannelList(IrcConnection connection) { _connection = connection; }