mirror of
https://github.com/ppy/osu.git
synced 2025-03-28 06:47:18 +08:00
Merge pull request #3488 from plankp/dnd-osr-files
Handle external files with File instead
This commit is contained in:
commit
901a7445fa
@ -154,7 +154,7 @@ namespace osu.Game
|
|||||||
dependencies.Cache(RulesetStore = new RulesetStore(contextFactory));
|
dependencies.Cache(RulesetStore = new RulesetStore(contextFactory));
|
||||||
dependencies.Cache(FileStore = new FileStore(contextFactory, Host.Storage));
|
dependencies.Cache(FileStore = new FileStore(contextFactory, Host.Storage));
|
||||||
dependencies.Cache(BeatmapManager = new BeatmapManager(Host.Storage, contextFactory, RulesetStore, api, Audio, Host));
|
dependencies.Cache(BeatmapManager = new BeatmapManager(Host.Storage, contextFactory, RulesetStore, api, Audio, Host));
|
||||||
dependencies.Cache(ScoreStore = new ScoreStore(Host.Storage, contextFactory, Host, BeatmapManager, RulesetStore));
|
dependencies.Cache(ScoreStore = new ScoreStore(contextFactory, Host, BeatmapManager, RulesetStore));
|
||||||
dependencies.Cache(KeyBindingStore = new KeyBindingStore(contextFactory, RulesetStore));
|
dependencies.Cache(KeyBindingStore = new KeyBindingStore(contextFactory, RulesetStore));
|
||||||
dependencies.Cache(SettingsStore = new SettingsStore(contextFactory));
|
dependencies.Cache(SettingsStore = new SettingsStore(contextFactory));
|
||||||
dependencies.Cache(RulesetConfigCache = new RulesetConfigCache(SettingsStore));
|
dependencies.Cache(RulesetConfigCache = new RulesetConfigCache(SettingsStore));
|
||||||
|
@ -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.Beatmaps;
|
using osu.Game.Beatmaps;
|
||||||
using osu.Game.Database;
|
using osu.Game.Database;
|
||||||
@ -13,8 +14,6 @@ namespace osu.Game.Rulesets.Scoring
|
|||||||
{
|
{
|
||||||
public class ScoreStore : DatabaseBackedStore, ICanAcceptFiles
|
public class ScoreStore : DatabaseBackedStore, ICanAcceptFiles
|
||||||
{
|
{
|
||||||
private readonly Storage storage;
|
|
||||||
|
|
||||||
private readonly BeatmapManager beatmaps;
|
private readonly BeatmapManager beatmaps;
|
||||||
private readonly RulesetStore rulesets;
|
private readonly RulesetStore rulesets;
|
||||||
|
|
||||||
@ -25,9 +24,8 @@ namespace osu.Game.Rulesets.Scoring
|
|||||||
// ReSharper disable once NotAccessedField.Local (we should keep a reference to this so it is not finalised)
|
// ReSharper disable once NotAccessedField.Local (we should keep a reference to this so it is not finalised)
|
||||||
private ScoreIPCChannel ipc;
|
private ScoreIPCChannel ipc;
|
||||||
|
|
||||||
public ScoreStore(Storage storage, DatabaseContextFactory factory, IIpcHost importHost = null, BeatmapManager beatmaps = null, RulesetStore rulesets = null) : base(factory)
|
public ScoreStore(DatabaseContextFactory factory, IIpcHost importHost = null, BeatmapManager beatmaps = null, RulesetStore rulesets = null) : base(factory)
|
||||||
{
|
{
|
||||||
this.storage = storage;
|
|
||||||
this.beatmaps = beatmaps;
|
this.beatmaps = beatmaps;
|
||||||
this.rulesets = rulesets;
|
this.rulesets = rulesets;
|
||||||
|
|
||||||
@ -49,8 +47,14 @@ namespace osu.Game.Rulesets.Scoring
|
|||||||
|
|
||||||
public Score ReadReplayFile(string replayFilename)
|
public Score ReadReplayFile(string replayFilename)
|
||||||
{
|
{
|
||||||
using (Stream s = storage.GetStream(Path.Combine(replay_folder, replayFilename)))
|
if (File.Exists(replayFilename))
|
||||||
return new DatabasedLegacyScoreParser(rulesets, beatmaps).Parse(s);
|
{
|
||||||
|
using (var stream = File.OpenRead(replayFilename))
|
||||||
|
return new DatabasedLegacyScoreParser(rulesets, beatmaps).Parse(stream);
|
||||||
|
}
|
||||||
|
|
||||||
|
Logger.Log($"Replay file {replayFilename} cannot be found", LoggingTarget.Information, LogLevel.Error);
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user