From 30f2eeda7c0a3d1caeff364a6d6a4c7b23942e25 Mon Sep 17 00:00:00 2001 From: Drew DeVault Date: Mon, 10 Oct 2016 09:26:34 -0400 Subject: [PATCH] Implement IDisposable in ArchiveReaders --- osu.Desktop/Beatmaps/IO/LegacyFilesystemReader.cs | 5 +++++ osu.Game/Beatmaps/IO/ArchiveReader.cs | 6 ++++-- osu.Game/Beatmaps/IO/OszArchiveReader.cs | 4 ++++ 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/osu.Desktop/Beatmaps/IO/LegacyFilesystemReader.cs b/osu.Desktop/Beatmaps/IO/LegacyFilesystemReader.cs index fa960b876c..e899673fef 100644 --- a/osu.Desktop/Beatmaps/IO/LegacyFilesystemReader.cs +++ b/osu.Desktop/Beatmaps/IO/LegacyFilesystemReader.cs @@ -48,5 +48,10 @@ namespace osu.Desktop.Beatmaps.IO public override BeatmapMetadata ReadMetadata() { return FirstMap.Metadata; + } + + public override void Dispose() + { + // no-op } } } \ No newline at end of file diff --git a/osu.Game/Beatmaps/IO/ArchiveReader.cs b/osu.Game/Beatmaps/IO/ArchiveReader.cs index ed0a07718f..2324236ba1 100644 --- a/osu.Game/Beatmaps/IO/ArchiveReader.cs +++ b/osu.Game/Beatmaps/IO/ArchiveReader.cs @@ -5,7 +5,7 @@ using osu.Framework.Platform; namespace osu.Game.Beatmaps.IO { - public abstract class ArchiveReader + public abstract class ArchiveReader : IDisposable { private class Reader { @@ -41,6 +41,8 @@ namespace osu.Game.Beatmaps.IO /// /// Opens a stream for reading a specific file from this archive. /// - public abstract Stream ReadFile(string name); + public abstract Stream ReadFile(string name); + + public abstract void Dispose(); } } \ No newline at end of file diff --git a/osu.Game/Beatmaps/IO/OszArchiveReader.cs b/osu.Game/Beatmaps/IO/OszArchiveReader.cs index a63468c16e..e75215949f 100644 --- a/osu.Game/Beatmaps/IO/OszArchiveReader.cs +++ b/osu.Game/Beatmaps/IO/OszArchiveReader.cs @@ -58,5 +58,9 @@ namespace osu.Game.Beatmaps.IO { return FirstMap.Metadata; } + public override void Dispose() + { + Archive.Dispose(); + } } } \ No newline at end of file