Example #1
0
        private void HandleResponse(GAISReader gr)
        {
            RESPONSE id = (RESPONSE)gr.ReadInt32();

            if (id == RESPONSE.NICKNAME_TAKEN)
            {
                tcpClient.Close();
                MessageBox.Show("Nickname Taken!");
                pForm.SetVisibility(true);
            }
        }
Example #2
0
        private void HandleVideoUpdate(GAISReader gr)
        {
            String nick = gr.ReadString();
            Int32  size = gr.ReadInt32();

            Byte[] arr = gr.ReadBytes(size);

            if (arr.Length > 0)
            {
                Program.General.SetImage(arr);
            }
        }
Example #3
0
        private void Run()
        {
            while (true)
            {
                try
                {
                    if (tcpClient.Available > 0)
                    {
                        GAISReader gr = new GAISReader(tcpClient.GetStream());

                        OPCODE op = (OPCODE)gr.ReadInt32();

                        switch (op)
                        {
                        case OPCODE.RESPONSE:
                            HandleResponse(gr);
                            break;

                        case OPCODE.VIDEO_START:
                            HandleVideoStart(gr);
                            break;

                        case OPCODE.VIDEO_END:
                            HandleVideoEnd(gr);
                            break;

                        case OPCODE.VIDEO_UPDATE:
                            HandleVideoUpdate(gr);
                            break;
                        }
                    }
                }
                catch
                {
                    tcpClient.Close();
                }

                Thread.Sleep(100);
            }
        }
Example #4
0
        private void HandleVideoEnd(GAISReader gr)
        {
            String nick = gr.ReadString();

            Program.General.Active = false;
        }
Example #5
0
        private void HandleVideoStart(GAISReader gr)
        {
            String nick = gr.ReadString();

            Program.General.Active = true;
        }