예제 #1
0
        void Instance_OnLog(Protocol arg1, IPEndPoint arg2)
        {
            if (arg1.id == ProtocolMessage.Broadcast)
            {
                var b = ProtocolFactory.GetSubProtocol <BroadcastProtocol>(arg1);
                Invoke2(() => textBox1.AppendText(String.Format("{0} : {1}:{2} {3}" + Environment.NewLine, arg2.ToString(), b.ip, b.port, b.type)));
                return;
            }

            Invoke2(() => textBox2.AppendText(String.Format("{0} : {1} {2}" + Environment.NewLine, arg2.ToString(), arg1.id, arg1.host)));
        }
예제 #2
0
        private void OnRecv(Protocol p, bool self, int from)
        {
            switch (p.id)
            {
            case ProtocolMessage.Join:
                OnJoin(ProtocolFactory.GetSubProtocol <JoinProtocol>(p), self, from);
                break;

            case ProtocolMessage.Start:
                OnStart(ProtocolFactory.GetSubProtocol <StartProtocol>(p), self, from);
                break;

            case ProtocolMessage.Stop:
                OnStop(ProtocolFactory.GetSubProtocol <StopProtocol>(p), self, from);
                break;

            default:
                break;
            }
        }