예제 #1
0
파일: Core.cs 프로젝트: WildGenie/uo-ext
        public void UOExtPacket(IClientPeer peer, byte header, byte[] buffer, int offset, short length)
        {
            MemoryStream ms = new MemoryStream(buffer, offset, length);
            BinaryReader br = new BinaryReader(ms);

            byte sequence = br.ReadByte();

            switch (sequence)
            {
                case (0x00):
                    byte version = br.ReadByte();
                    byte[] uoextmd5 = br.ReadBytes(16);
                    byte[] uoextguimd5 = br.ReadBytes(16);
                    if (version != 0)
                    {
                        peer.Close();
                    }
                    else
                    {

                        if (!ByteArrayCompare(uoextmd5, Dll.UOExt.MD5))
                        {
                            peer.Send(new Handshake(0x01));
                            peer.Send(Dll.UOExt.SimpleHeader);
                            foreach (DllContent dc in Dll.UOExt.Content)
                            {
                                peer.Send(dc);
                            }
                            return;
                        }
                        else if (!ByteArrayCompare(uoextguimd5, Dll.UOExtGUI.MD5))
                        {
                            peer.Send(new Handshake(0x02));
                            peer.Send(Dll.UOExtGUI.SimpleHeader);
                            foreach (DllContent dc in Dll.UOExtGUI.Content)
                            {
                                peer.Send(dc);
                            }
                        }
                        else
                        {
                            peer.Send(new Handshake(0x00));
                        }
                        peer.Send(m_libraryList);
                        peer.Send(m_pluginsList);
                    }
                    break;
                case (0x03):
                    for (short i = 0; i < Dll.Dlls.Length; i++)
                    {
                        peer.Send(Dll.Dlls[i].Header);
                        foreach (DllContent dc in Dll.Dlls[i].Content)
                        {
                            peer.Send(dc);
                        }
                    }
                    peer.Send(m_initComplete);
                    break;
            }
        }
예제 #2
0
파일: Packet.cs 프로젝트: WildGenie/uo-ext
        public void Send(IClientPeer p) 
        {
            m_Writer.Flush();
            p.Send(m_Buffer);
            this.OnSend(p);

        }
예제 #3
0
파일: Packet.cs 프로젝트: WildGenie/uo-ext
 public void Send(IClientPeer p)
 {
     m_Writer.Flush();
     p.Send(m_Buffer);
     this.OnSend(p);
 }
예제 #4
0
파일: Core.cs 프로젝트: WildGenie/uo-ext
        public void UOExtPacket(IClientPeer peer, byte header, byte[] buffer, int offset, short length)
        {
            MemoryStream ms = new MemoryStream(buffer, offset, length);
            BinaryReader br = new BinaryReader(ms);

            byte sequence = br.ReadByte();

            switch (sequence)
            {
            case (0x00):
                byte   version     = br.ReadByte();
                byte[] uoextmd5    = br.ReadBytes(16);
                byte[] uoextguimd5 = br.ReadBytes(16);
                if (version != 0)
                {
                    peer.Close();
                }
                else
                {
                    if (!ByteArrayCompare(uoextmd5, Dll.UOExt.MD5))
                    {
                        peer.Send(new Handshake(0x01));
                        peer.Send(Dll.UOExt.SimpleHeader);
                        foreach (DllContent dc in Dll.UOExt.Content)
                        {
                            peer.Send(dc);
                        }
                        return;
                    }
                    else if (!ByteArrayCompare(uoextguimd5, Dll.UOExtGUI.MD5))
                    {
                        peer.Send(new Handshake(0x02));
                        peer.Send(Dll.UOExtGUI.SimpleHeader);
                        foreach (DllContent dc in Dll.UOExtGUI.Content)
                        {
                            peer.Send(dc);
                        }
                    }
                    else
                    {
                        peer.Send(new Handshake(0x00));
                    }
                    peer.Send(m_libraryList);
                    peer.Send(m_pluginsList);
                }
                break;

            case (0x03):
                for (short i = 0; i < Dll.Dlls.Length; i++)
                {
                    peer.Send(Dll.Dlls[i].Header);
                    foreach (DllContent dc in Dll.Dlls[i].Content)
                    {
                        peer.Send(dc);
                    }
                }
                peer.Send(m_initComplete);
                break;
            }
        }