Esempio n. 1
0
 public static void Parse(GameProtocolListener listener, Guid? sender, Byte[] packet)
 {
     BinaryReader rdr = new BinaryReader(new MemoryStream(packet));
     OPCODE opcode = (OPCODE)rdr.ReadByte();
     switch (opcode)
     {
         case OPCODE.INTRO:
             int uuidLength = rdr.ReadInt32();
             byte[] uuidBytes = rdr.ReadBytes(uuidLength);
             Guid uuid = new Guid(uuidBytes);
             String name = rdr.ReadString();
             String descr = rdr.ReadString();
             IPAddress addr = IPAddress.Parse(rdr.ReadString());
             int socketNum = rdr.ReadInt32();
             listener.GameAnnouncement(uuid, name, descr,addr,socketNum);
             break;
         ;
     }
 }