diff --git a/Lagrange.Core/Utility/Binary/BinaryPacket.cs b/Lagrange.Core/Utility/Binary/BinaryPacket.cs index 2fee35ccd..9c8a26753 100644 --- a/Lagrange.Core/Utility/Binary/BinaryPacket.cs +++ b/Lagrange.Core/Utility/Binary/BinaryPacket.cs @@ -7,7 +7,7 @@ namespace Lagrange.Core.Utility.Binary; /// Binary Writer, Inspired by /// Provide only Sync Apis /// -internal partial class BinaryPacket +internal partial class BinaryPacket : IDisposable { private readonly MemoryStream _stream; @@ -295,4 +295,10 @@ public static bool InsertPrefix(byte[] buffer, uint offset, uint value, Prefix p public bool IsAvailable(int length) => _stream.Length - _stream.Position >= length; public byte[] ToArray() => _stream.ToArray(); + + public void Dispose() + { + _stream.Dispose(); + _reader.Dispose(); + } } \ No newline at end of file