diff --git a/src/Syroot.Worms.Mgame.GameServer/Packets/PacketDataStream.cs b/src/Syroot.Worms.Mgame.GameServer/Packets/PacketDataStream.cs deleted file mode 100644 index a76f7e6..0000000 --- a/src/Syroot.Worms.Mgame.GameServer/Packets/PacketDataStream.cs +++ /dev/null @@ -1,54 +0,0 @@ -using System; -using System.IO; -using System.Text; -using Syroot.BinaryData; - -namespace Syroot.Worms.Mgame.GameServer -{ - /// - /// Represents an in-memory stream formatting data for being sent or received from instances. - /// - internal class PacketDataStream : BinaryStream - { - // ---- FIELDS ------------------------------------------------------------------------------------------------- - - private readonly MemoryStream _baseStream; - - // ---- CONSTRUCTORS & DESTRUCTOR ------------------------------------------------------------------------------ - - static PacketDataStream() - { - Encoding.RegisterProvider(CodePagesEncodingProvider.Instance); - } - - internal PacketDataStream(MemoryStream baseStream) - : base(baseStream, encoding: Encoding.GetEncoding(949), stringCoding: StringCoding.Int16CharCount) - { - _baseStream = baseStream; - } - - internal PacketDataStream(MemoryStream baseStream, int offset) - : this(new MemoryStream(baseStream.GetBuffer(), offset, (int)baseStream.Length - offset)) { } - - internal PacketDataStream() : this(new MemoryStream()) { } - - internal PacketDataStream(byte[] buffer) : this(new MemoryStream(buffer)) { } - - // ---- METHODS (INTERNAL) ------------------------------------------------------------------------------------- - - /// - /// Returns a containing the actually used memory buffer bytes. - /// - /// The span containing the used buffer bytes. - internal Span GetSpan() => _baseStream.GetBuffer().AsSpan(0, (int)Position); - - /// - /// Reads the remaining bytes in the buffer. - /// - /// The remaining bytes. - internal byte[] ReadToEnd() - { - return ReadBytes((int)(Length - Position)); - } - } -}