1
0
mirror of https://github.com/ppy/osu.git synced 2025-03-23 16:27:20 +08:00

ArchiveManager decoupling

This commit is contained in:
Alex Amadori 2017-03-07 00:10:33 +01:00
parent a297489151
commit aee7b05bae

View File

@ -3,6 +3,7 @@
using System;
using System.IO;
using osu.Framework.Logging;
using osu.Framework.Platform;
using osu.Game.Database;
@ -13,12 +14,15 @@ namespace osu.Game.Beatmaps.IO
public static BeatmapArchiveReader GetBeatmapArchiveReader(Storage storage, string path)
{
foreach (var reader in Readers)
try
{
if (reader.Test(storage, path))
return (BeatmapArchiveReader)Activator.CreateInstance(reader.Type, storage.GetStream(path));
return (BeatmapArchiveReader)GetReader(storage, path);
}
catch (InvalidCastException e)
{
Logger.Error(e, "A tricky ArchiveReader instance passed the test to be a BeatmapArhiveReader, but it's really not");
throw e;
}
throw new IOException(@"Unknown file format");
}
/// <summary>