mirror of
https://github.com/ppy/osu.git
synced 2025-02-13 17:53:21 +08:00
Dispose of Stream
s when used
This commit is contained in:
parent
01d77fb741
commit
47b4d03145
@ -83,7 +83,7 @@ namespace osu.Game.Tests.Editing.Checks
|
||||
|
||||
private BeatmapVerifierContext getContext(string resourceName, bool allowMissing = false)
|
||||
{
|
||||
Stream resourceStream = string.IsNullOrEmpty(resourceName) ? null : TestResources.OpenResource(resourceName);
|
||||
using Stream resourceStream = string.IsNullOrEmpty(resourceName) ? null : TestResources.OpenResource(resourceName);
|
||||
if (!allowMissing && resourceStream == null)
|
||||
throw new FileNotFoundException($"The requested test resource \"{resourceName}\" does not exist.");
|
||||
|
||||
|
@ -104,7 +104,7 @@ namespace osu.Game.Tests.Editing.Checks
|
||||
|
||||
private BeatmapVerifierContext getContext(string resourceName, bool allowMissing = false)
|
||||
{
|
||||
Stream resourceStream = string.IsNullOrEmpty(resourceName) ? null : TestResources.OpenResource(resourceName);
|
||||
using Stream resourceStream = string.IsNullOrEmpty(resourceName) ? null : TestResources.OpenResource(resourceName);
|
||||
if (!allowMissing && resourceStream == null)
|
||||
throw new FileNotFoundException($"The requested test resource \"{resourceName}\" does not exist.");
|
||||
|
||||
|
@ -50,8 +50,12 @@ namespace osu.Game.Rulesets.Edit.Checks
|
||||
continue;
|
||||
}
|
||||
|
||||
Stream data = context.WorkingBeatmap.GetStream(storagePath);
|
||||
StreamFileAbstraction fileAbstraction = new StreamFileAbstraction(filename, data);
|
||||
StreamFileAbstraction fileAbstraction;
|
||||
|
||||
using (Stream data = context.WorkingBeatmap.GetStream(storagePath))
|
||||
{
|
||||
fileAbstraction = new StreamFileAbstraction(filename, data);
|
||||
}
|
||||
|
||||
// We use TagLib here for platform invariance; BASS cannot detect audio presence on Linux.
|
||||
TagLib.File tagFile = null;
|
||||
|
@ -31,7 +31,7 @@ namespace osu.Game.Rulesets.Edit.Checks
|
||||
|
||||
foreach (var file in beatmapSet.Files)
|
||||
{
|
||||
Stream data = context.WorkingBeatmap.GetStream(file.FileInfo.StoragePath);
|
||||
using Stream data = context.WorkingBeatmap.GetStream(file.FileInfo.StoragePath);
|
||||
if (data == null)
|
||||
continue;
|
||||
|
||||
|
@ -22,7 +22,7 @@ namespace osu.Game.Rulesets.Edit.Checks
|
||||
|
||||
foreach (var file in beatmapSet.Files)
|
||||
{
|
||||
Stream data = context.WorkingBeatmap.GetStream(file.FileInfo.StoragePath);
|
||||
using Stream data = context.WorkingBeatmap.GetStream(file.FileInfo.StoragePath);
|
||||
if (data?.Length == 0)
|
||||
yield return new IssueTemplateZeroBytes(this).Create(file.Filename);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user