Ejemplo n.º 1
0
            static public HEADER GetHeaderInfo(byte[] buf)
            {
                HEADER obj      = new HEADER();
                int    headSize = HeaderSize();

                byte[] headBuf = new byte[headSize];
                Array.Copy(buf, headBuf, headSize);
                obj.Update(headBuf);
                return(obj);
            }
Ejemplo n.º 2
0
        private void OnRecvPacket(object sender, EventArgs e)
        {
            var queue = (ConcurrentQueue <NetworkMgr.QueuePack>)sender;

            while (true)
            {
                NetworkMgr.QueuePack pack = null;
                if (queue.TryDequeue(out pack))
                {
                    HEADER head = HEADER.GetHeaderInfo(pack.buf);
                    HEADER obj  = CreateIcdObject((COMMAND)head.id);
                    obj.Update(pack.buf);
                    OnRecv.Invoke(pack.ClientID, obj);
                }

                if (queue.IsEmpty)
                {
                    break;
                }
            }
        }