mirror of
https://github.com/osukey/osukey.git
synced 2025-08-05 23:53:51 +09:00
ArchiveManager decoupling
This commit is contained in:
@ -3,6 +3,7 @@
|
|||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
|
using osu.Framework.Logging;
|
||||||
using osu.Framework.Platform;
|
using osu.Framework.Platform;
|
||||||
using osu.Game.Database;
|
using osu.Game.Database;
|
||||||
|
|
||||||
@ -13,12 +14,15 @@ namespace osu.Game.Beatmaps.IO
|
|||||||
|
|
||||||
public static BeatmapArchiveReader GetBeatmapArchiveReader(Storage storage, string path)
|
public static BeatmapArchiveReader GetBeatmapArchiveReader(Storage storage, string path)
|
||||||
{
|
{
|
||||||
foreach (var reader in Readers)
|
try
|
||||||
{
|
{
|
||||||
if (reader.Test(storage, path))
|
return (BeatmapArchiveReader)GetReader(storage, path);
|
||||||
return (BeatmapArchiveReader)Activator.CreateInstance(reader.Type, storage.GetStream(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>
|
/// <summary>
|
||||||
|
Reference in New Issue
Block a user