1
0
mirror of https://github.com/ppy/osu.git synced 2024-09-22 00:47:24 +08:00

Move stablestorage check to path selection screen

Also forced stablepath to be empty during auto detection so it checks other sources to load ipc from
This commit is contained in:
Shivam 2020-05-18 00:47:31 +02:00
parent 59b006f9ac
commit 9bfdfbea43
3 changed files with 11 additions and 9 deletions

View File

@ -232,16 +232,15 @@ namespace osu.Game.Tournament.IPC
private string findFromJsonConfig() private string findFromJsonConfig()
{ {
Logger.Log("Trying to find stable through the json config"); try
if (tournamentStorage.Exists(stable_config))
{ {
using (Stream stream = tournamentStorage.GetStream(stable_config, FileAccess.Read, FileMode.Open)) Logger.Log("Trying to find stable through the json config");
using (var sr = new StreamReader(stream))
{ if (!string.IsNullOrEmpty(stableInfo.StablePath.Value))
stableInfo = JsonConvert.DeserializeObject<StableInfo>(sr.ReadToEnd());
return stableInfo.StablePath.Value; return stableInfo.StablePath.Value;
} }
catch
{
} }
return null; return null;

View File

@ -84,7 +84,6 @@ namespace osu.Game.Tournament.Screens
{ {
stableInfo.StablePath.BindValueChanged(_ => stableInfo.StablePath.BindValueChanged(_ =>
{ {
fileBasedIpc?.LocateStableStorage();
Schedule(reload); Schedule(reload);
}); });
sceneManager.SetScreen(new StablePathSelectScreen()); sceneManager.SetScreen(new StablePathSelectScreen());

View File

@ -142,6 +142,7 @@ namespace osu.Game.Tournament.Screens
private void changePath(Storage storage) private void changePath(Storage storage)
{ {
var target = directorySelector.CurrentDirectory.Value.FullName; var target = directorySelector.CurrentDirectory.Value.FullName;
Logger.Log($"Changing Stable CE location to {target}");
if (File.Exists(Path.Combine(target, "ipc.txt"))) if (File.Exists(Path.Combine(target, "ipc.txt")))
{ {
@ -161,6 +162,8 @@ namespace osu.Game.Tournament.Screens
})); }));
} }
var fileBasedIpc = ipc as FileBasedIPC;
fileBasedIpc?.LocateStableStorage();
sceneManager?.SetScreen(typeof(SetupScreen)); sceneManager?.SetScreen(typeof(SetupScreen));
} }
catch (Exception e) catch (Exception e)
@ -180,6 +183,7 @@ namespace osu.Game.Tournament.Screens
private void autoDetect() private void autoDetect()
{ {
stableInfo.StablePath.Value = string.Empty; // This forces findStablePath() to look elsewhere.
var fileBasedIpc = ipc as FileBasedIPC; var fileBasedIpc = ipc as FileBasedIPC;
fileBasedIpc?.LocateStableStorage(); fileBasedIpc?.LocateStableStorage();