diff --git a/Projects/Server/Network/NetState/NetState.cs b/Projects/Server/Network/NetState/NetState.cs index 6b9eaa88f..cf0db67f9 100644 --- a/Projects/Server/Network/NetState/NetState.cs +++ b/Projects/Server/Network/NetState/NetState.cs @@ -414,36 +414,6 @@ namespace Server.Network } } - /** - * Send data using a circular buffer from SendPipe - */ - public void Send(ref CircularBuffer buffer, int length) - { - if (Connection == null || BlockAllPackets || length <= 0) - { - return; - } - - try - { - // _packetEncoder?.Invoke(ref buffer, ref length); - if (CompressionEnabled) - { - NetworkCompression.Compress(ref buffer, ref length); // This will be changed soon - } - - SendPipe.Writer.Advance((uint)length); - } - catch (Exception ex) - { -#if DEBUG - Console.WriteLine(ex); - TraceException(ex); -#endif - Dispose(); - } - } - public virtual void Send(Packet p) { if (Connection == null || BlockAllPackets) diff --git a/Projects/Server/Network/NetworkCompression.cs b/Projects/Server/Network/NetworkCompression.cs index f9c438c25..550556157 100644 --- a/Projects/Server/Network/NetworkCompression.cs +++ b/Projects/Server/Network/NetworkCompression.cs @@ -61,70 +61,6 @@ namespace Server.Network 0x4, 0x00D }; - public static void Compress(ref CircularBuffer buffer, ref int length) - { - length = Compress(ref buffer, length, ref buffer); - } - - public static int Compress(ref CircularBuffer input, int inputLength, ref CircularBuffer output) - { - if (inputLength > DefiniteOverflow) - { - return 0; - } - - int bitCount = 0; - int bitValue = 0; - - int inputIdx = 0; - int outputIdx = 0; - - while (inputIdx < inputLength) - { - int i = input[inputIdx++] << 1; - - bitCount += _huffmanTable[i]; - bitValue = (bitValue << _huffmanTable[i]) | _huffmanTable[i + 1]; - - while (bitCount >= 8) - { - bitCount -= 8; - - if (output.Length < outputIdx + 1) - { - return 0; - } - - output[outputIdx++] = (byte)(bitValue >> bitCount); - } - } - - // terminal code - bitCount += _huffmanTable[0x200]; - bitValue = (bitValue << _huffmanTable[0x200]) | _huffmanTable[0x201]; - - // align on byte boundary - if ((bitCount & 7) != 0) - { - bitValue <<= 8 - (bitCount & 7); - bitCount += 8 - (bitCount & 7); - } - - while (bitCount >= 8) - { - bitCount -= 8; - - if (output.Length < outputIdx + 1) - { - return 0; - } - - output[outputIdx++] = (byte)(bitValue >> bitCount); - } - - return outputIdx; - } - public static void Compress(ReadOnlySpan input, ref CircularBuffer output, out int length) { length = Compress(input, ref output);