public static byte[] GetAddonInfoData(CharacterSession session, byte[] packedData, int packedSize, int unpackedSize)
        {
            // Check ZLib header (normal mode)
            if (packedData[0] == 0x78 && packedData[1] == 0x9C)
            {
                var unpackedAddonData = new byte[unpackedSize];

                if (packedSize > 0)
                {
                    using (var inflate = new DeflateStream(new MemoryStream(packedData, 2, packedSize - 6), CompressionMode.Decompress))
                    {
                        var decompressed = new MemoryStream();
                        inflate.CopyTo(decompressed);

                        decompressed.Seek(0, SeekOrigin.Begin);

                        for (int i = 0; i < unpackedSize; i++)
                            unpackedAddonData[i] = (byte)decompressed.ReadByte();
                    }
                }

                return unpackedAddonData;
            }
            else
            {
                Log.Error($"Wrong AddonInfo for Client '{session.GetClientInfo()}'.");

                session.Dispose();
            }

            return null;
        }
Exemple #2
0
 public static void HandleLogDisconnect(LogDisconnect logDisconnect, CharacterSession session)
 {
     Log.Debug($"{session.GetClientInfo()} disconnected (Reason: {logDisconnect.Reason}).");
 }