mirror of
https://github.com/ppy/osu.git
synced 2025-02-13 19:53:23 +08:00
Properly dispose of Stream
in bg quality check
This commit is contained in:
parent
5dc6a9ed21
commit
b888185799
@ -2,6 +2,7 @@
|
|||||||
// See the LICENCE file in the repository root for full licence text.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.IO;
|
||||||
using osu.Game.Rulesets.Edit.Checks.Components;
|
using osu.Game.Rulesets.Edit.Checks.Components;
|
||||||
|
|
||||||
namespace osu.Game.Rulesets.Edit.Checks
|
namespace osu.Game.Rulesets.Edit.Checks
|
||||||
@ -48,10 +49,14 @@ namespace osu.Game.Rulesets.Edit.Checks
|
|||||||
yield return new IssueTemplateLowResolution(this).Create(texture.Width, texture.Height);
|
yield return new IssueTemplateLowResolution(this).Create(texture.Width, texture.Height);
|
||||||
|
|
||||||
string storagePath = context.Beatmap.BeatmapInfo.BeatmapSet.GetPathForFile(backgroundFile);
|
string storagePath = context.Beatmap.BeatmapInfo.BeatmapSet.GetPathForFile(backgroundFile);
|
||||||
double filesizeMb = context.WorkingBeatmap.GetStream(storagePath).Length / (1024d * 1024d);
|
|
||||||
|
|
||||||
if (filesizeMb > max_filesize_mb)
|
using (Stream stream = context.WorkingBeatmap.GetStream(storagePath))
|
||||||
yield return new IssueTemplateTooUncompressed(this).Create(filesizeMb);
|
{
|
||||||
|
double filesizeMb = stream.Length / (1024d * 1024d);
|
||||||
|
|
||||||
|
if (filesizeMb > max_filesize_mb)
|
||||||
|
yield return new IssueTemplateTooUncompressed(this).Create(filesizeMb);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public class IssueTemplateTooHighResolution : IssueTemplate
|
public class IssueTemplateTooHighResolution : IssueTemplate
|
||||||
|
Loading…
Reference in New Issue
Block a user