From 519a01b6f6f4a78b89ce5b90cf37288de6213ea4 Mon Sep 17 00:00:00 2001 From: Ray Koopa Date: Fri, 18 Jan 2019 20:49:18 +0100 Subject: [PATCH] Delete old packet data stream. --- .../Packets/PacketDataStream.cs | 54 ------------------- 1 file changed, 54 deletions(-) delete mode 100644 src/Syroot.Worms.Mgame.GameServer/Packets/PacketDataStream.cs 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)); - } - } -}