Inheritance: System.EventArgs
Exemple #1
0
 public static void IrcConnectionListCallback(object sender, ReadLineEventArgs e)
 {
     string[] linear = e.Line.Split(new char[] { ' ' });
     if (linear.Length >= 5 && linear[1] == "322")
     {
         Console.WriteLine("On the IRC channel " + CHANNEL + " are " + linear[4] + " users");
         ((IrcConnection)sender).Disconnect();
     }
 }
 internal void HandleOnReadLine(object sender, ReadLineEventArgs e)
 {
     if (OnReadLine != null)
         OnReadLine(this, e);
 }
        private void SimpleParser(object sender, ReadLineEventArgs args)
        {
            string rawline = args.Line;
            string[] rawlineex = rawline.Split(new[] { ' ' });
            string messagecode;

            if (rawline[0] == ':')
            {
                messagecode = rawlineex[1];

                ReplyCode replycode = ReplyCode.Null;
                try
                {
                    replycode = (ReplyCode)int.Parse(messagecode);
                }
                catch (FormatException)
                {
                }

                if (replycode != ReplyCode.Null)
                {
                    switch (replycode)
                    {
                        case ReplyCode.Welcome:
                            IsRegistered = true;
                            break;
                    }
                }
                else
                {
                    switch (rawlineex[1])
                    {
                        case "PONG":
                            DateTime now = DateTime.Now;
                            lastPongReceived = now;
                            lag = now - lastPingSent;

                            break;
                    }
                }
            }
            else
            {
                messagecode = rawlineex[0];
                switch (messagecode)
                {
                    case "ERROR":
                        // FIXME: handle server errors differently than connection errors!
                        //IsConnectionError = true;
                        break;
                }
            }
        }
 public void PluginsOnReadLine(object sender, ReadLineEventArgs e)
 {
     OnReadLine(this, e);
 }