Esempio n. 1
0
 public static ParsedUpdatePacket Create(DateTime time, byte[] packetContent, bool isSingleBlock, bool isCompressed)
 {
     if (isCompressed)
     {
         packetContent = UpdateFieldsUtil.Decompress(packetContent);
     }
     return(new ParsedUpdatePacket(time, packetContent, isSingleBlock));
 }
Esempio n. 2
0
        /*public static void Dump(byte[] packetContent, bool isSingleBlock, IndentTextWriter writer)
         * {
         *      Dump(packetContent, isSingleBlock, writer, false);
         * }
         *
         * public static void Dump(PacketIn packet, IndentTextWriter writer)
         * {
         *      Dump(GetBytes(packet), false, writer, false);
         * }
         *
         * public static void Dump(byte[] packetContent, bool isSingleBlock, IndentTextWriter writer, bool isCompressed)
         * {
         *      Dump(DateTime.Now, packetContent, isSingleBlock, writer, isCompressed);
         * }*/

        public static void Dump(DateTime timeStamp, byte[] packetContent, bool isSingleBlock, IndentTextWriter writer, bool isCompressed)
        {
            if (isCompressed)
            {
                packetContent = UpdateFieldsUtil.Decompress(packetContent);
            }
            var packet = new ParsedUpdatePacket(packetContent, isSingleBlock);

            writer.WriteLine("");
            packet.Dump("", writer);
        }
Esempio n. 3
0
        public static byte[] GetBytes(PacketIn updatePacket)
        {
            var bytes = updatePacket.ReadBytes(updatePacket.Length - updatePacket.HeaderSize);

            if (updatePacket.PacketId.RawId == (uint)RealmServerOpCode.SMSG_COMPRESSED_UPDATE_OBJECT)
            {
                bytes = UpdateFieldsUtil.Decompress(bytes);
            }
            else if (updatePacket.PacketId.RawId != (uint)RealmServerOpCode.SMSG_UPDATE_OBJECT)
            {
                throw new Exception("Given Packet " + updatePacket + " is not an Update Packet!");
            }
            return(bytes);
        }