From fb46536e170cae651fe0897a7a00d2151c1cba48 Mon Sep 17 00:00:00 2001 From: GoldenretriverYT <49924528+GoldenretriverYT@users.noreply.github.com> Date: Sun, 10 Dec 2023 00:52:19 +0100 Subject: [PATCH] Clean up object --- source/Cosmos.System2/FileSystem/FAT/FatStream.cs | 4 +++- source/Cosmos.System2_Plugs/System/IO/FileImpl.cs | 8 +++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/source/Cosmos.System2/FileSystem/FAT/FatStream.cs b/source/Cosmos.System2/FileSystem/FAT/FatStream.cs index e4049526ae..687fa325c6 100644 --- a/source/Cosmos.System2/FileSystem/FAT/FatStream.cs +++ b/source/Cosmos.System2/FileSystem/FAT/FatStream.cs @@ -2,7 +2,7 @@ using System; using System.IO; - +using Cosmos.Core; using Cosmos.System.FileSystem.FAT.Listing; namespace Cosmos.System.FileSystem.FAT @@ -426,6 +426,8 @@ public override void Write(byte[] aBuffer, int aOffset, int aCount) aOffset += (int)xWriteSize; mPosition += xWriteSize; } + + GCImplementation.Free(xCluster); } } } diff --git a/source/Cosmos.System2_Plugs/System/IO/FileImpl.cs b/source/Cosmos.System2_Plugs/System/IO/FileImpl.cs index 7fd237d0bd..57eb644bca 100644 --- a/source/Cosmos.System2_Plugs/System/IO/FileImpl.cs +++ b/source/Cosmos.System2_Plugs/System/IO/FileImpl.cs @@ -41,11 +41,9 @@ public static void WriteAllLines(string path, string[] contents) public static void WriteAllBytes(string path, byte[] aData) { - BinaryWriter Writer = new(new FileStream(path, FileMode.OpenOrCreate)); - - Writer.Write(aData); - - Writer.Dispose(); + var writer = new FileStream(path, FileMode.OpenOrCreate); + writer.Write(aData); + writer.Dispose(); } } } \ No newline at end of file