mirror of
https://bitbucket.org/Ioncannon/project-meteor-server.git
synced 2025-07-24 11:28:22 +02:00
Added decompression/compression of packets. Cleaned up handshaking.
This commit is contained in:
parent
4aae16e458
commit
364ab40b3f
8 changed files with 123 additions and 43 deletions
|
@ -5,6 +5,7 @@ using System.IO;
|
|||
using System.Runtime.InteropServices;
|
||||
using NLog;
|
||||
using NLog.Targets;
|
||||
using Ionic.Zlib;
|
||||
|
||||
namespace FFXIVClassic.Common
|
||||
{
|
||||
|
@ -346,6 +347,28 @@ namespace FFXIVClassic.Common
|
|||
}
|
||||
}
|
||||
|
||||
public static unsafe void DecompressPacket(ref BasePacket packet)
|
||||
{
|
||||
using (var compressedStream = new MemoryStream(packet.data))
|
||||
using (var zipStream = new ZlibStream(compressedStream, Ionic.Zlib.CompressionMode.Decompress))
|
||||
using (var resultStream = new MemoryStream())
|
||||
{
|
||||
zipStream.CopyTo(resultStream);
|
||||
packet.data = resultStream.ToArray();
|
||||
}
|
||||
}
|
||||
|
||||
public static unsafe void CompressPacket(ref BasePacket packet)
|
||||
{
|
||||
using (var compressedStream = new MemoryStream(packet.data))
|
||||
using (var zipStream = new ZlibStream(compressedStream, Ionic.Zlib.CompressionMode.Compress))
|
||||
using (var resultStream = new MemoryStream())
|
||||
{
|
||||
zipStream.CopyTo(resultStream);
|
||||
packet.data = resultStream.ToArray();
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="DotNetZip" version="1.10.1" targetFramework="net45" />
|
||||
<package id="MySql.Data" version="6.9.8" targetFramework="net45" />
|
||||
<package id="NLog" version="4.3.5" targetFramework="net45" />
|
||||
</packages>
|
Loading…
Add table
Add a link
Reference in a new issue