예제 #1
0
파일: MainForm.cs 프로젝트: strager/Ondit
        private void Connection(string host, int port)
        {
            client = new Client(host, port);

            client.SynchronizingObject = this;

            client.RawMessageSent += MessageSent;
            client.RawMessageReceived += MessageReceived;
            client.ConversationMessageReceived += ConversationMessageReceived;

            client.Connect();
            client.WaitForConnected();

            if(client.ConnectionStatus != ConnectionStatus.Connected) {
                conversation.Text += string.Format(@"Could not connect to {0} on port {1}." + Environment.NewLine, host, port);

                return;
            }

            clientThread = new Thread(() => {
                while(client != null) {
                    client.HandleMessageBlock();
                }
            });

            clientThread.Start();
        }
예제 #2
0
파일: Program.cs 프로젝트: strager/Ondit
        void Run()
        {
            using(client = new Client("irc.slagg.org", 6667)) {
                Console.WriteLine("Connecting...");

                client.Connect();
                client.WaitForConnected();

                Console.WriteLine("Connected!");

                LoadPlugins();

                client.JoinChannel("#test");

                while(client.ConnectionStatus == ConnectionStatus.Connected) {
                    client.HandleMessageBlock();
                }
            }
        }