void ProcessLine(string line) { if (string.IsNullOrEmpty(line)) return; var l = new Line(this, line); OnLineRead(l); int numeric; if (Exts.TryParseIntegerInvariant(l.Command, out numeric)) { var nl = new NumericLine(l, numeric); LocalUser.OnNumeric(nl); OnNumeric(nl); switch (nl.Numeric) { case NumericCommand.RPL_WELCOME: OnRegister(nl); break; case NumericCommand.RPL_ENDOFNAMES: OnSync(nl); break; } } else { switch (l.Command) { case "PING": Pong(l.Message); OnPing(l); break; case "PRIVMSG": if (IrcUtils.IsChannel(l.Target)) OnPublicMessage(l); else OnPrivateMessage(l); break; case "NOTICE": if (IrcUtils.IsChannel(l.Target)) OnPublicNotice(l); else OnPrivateNotice(l); break; case "JOIN": var jl = new JoinLine(l); LocalUser.OnJoin(jl); OnJoin(jl); break; case "PART": LocalUser.OnPart(l); OnPart(l); break; case "NICK": var nsl = new NicknameSetLine(l); LocalUser.OnNicknameSet(nsl); OnNicknameSet(nsl); break; case "QUIT": OnQuit(l); LocalUser.OnQuit(l); break; case "KICK": var kl = new KickLine(l); LocalUser.OnKick(kl); OnKick(kl); break; case "TOPIC": LocalUser.OnTopicSet(l); OnTopicSet(l); break; } } }
void ProcessLine(string line) { if (string.IsNullOrEmpty(line)) { return; } var l = new Line(this, line); OnLineRead(l); int numeric; if (int.TryParse(l.Command, out numeric)) { var nl = new NumericLine(l, numeric); LocalUser.OnNumeric(nl); OnNumeric(nl); switch (nl.Numeric) { case NumericCommand.RPL_WELCOME: OnRegister(nl); break; case NumericCommand.RPL_ENDOFNAMES: OnSync(nl); break; } } else { switch (l.Command) { case "PING": Pong(l.Message); OnPing(l); break; case "PRIVMSG": if (IrcUtils.IsChannel(l.Target)) { OnPublicMessage(l); } else { OnPrivateMessage(l); } break; case "NOTICE": if (IrcUtils.IsChannel(l.Target)) { OnPublicNotice(l); } else { OnPrivateNotice(l); } break; case "JOIN": var jl = new JoinLine(l); LocalUser.OnJoin(jl); OnJoin(jl); break; case "PART": LocalUser.OnPart(l); OnPart(l); break; case "NICK": var nsl = new NicknameSetLine(l); LocalUser.OnNicknameSet(nsl); OnNicknameSet(nsl); break; case "QUIT": OnQuit(l); LocalUser.OnQuit(l); break; case "KICK": var kl = new KickLine(l); LocalUser.OnKick(kl); OnKick(kl); break; case "TOPIC": LocalUser.OnTopicSet(l); OnTopicSet(l); break; } } }