Пример #1
0
 private int GetServerPacketSize(byte[] data, int bytesRead)
 {
     int size = 0;
     switch (data[0])
     {
         case 0x8C:
             size = 11;
             break;
         default:
             break;
     }
     if (size > 0)
         return size;
     else
     {
         // no client handler, what to do?
         var tempstream = new UOStream(data);
         tempstream.ReadBit();
         return tempstream.ReadShort();
     }
 }
Пример #2
0
        private int GetClientPacketSize(byte[] data, int bytesRead)
        {
            // need to handle byte packet i guess??
            if (ClientSizes(data[0]) != 0)
            {
                return ClientSizes(data[0]);
            }
            else if(bytesRead > 3)
            {  // Known packet with unknown size or size of 0 try and read size from data[]
                var tempstream = new UOStream(data);
                tempstream.ReadBit();
                return tempstream.ReadShort();
            }

             return 0;
        }