mirror of
https://github.com/ppy/osu
synced 2025-01-11 16:49:39 +00:00
Use one constant for STABLE_CONFIG location string
This commit is contained in:
parent
a0a54efd4e
commit
e018d07441
@ -40,8 +40,6 @@ namespace osu.Game.Tournament.IPC
|
|||||||
[Resolved]
|
[Resolved]
|
||||||
private StableInfo stableInfo { get; set; }
|
private StableInfo stableInfo { get; set; }
|
||||||
|
|
||||||
private const string stable_config = "tournament/stable.json";
|
|
||||||
|
|
||||||
public Storage IPCStorage { get; private set; }
|
public Storage IPCStorage { get; private set; }
|
||||||
|
|
||||||
[Resolved]
|
[Resolved]
|
||||||
@ -196,7 +194,7 @@ namespace osu.Game.Tournament.IPC
|
|||||||
|
|
||||||
private void saveStablePath()
|
private void saveStablePath()
|
||||||
{
|
{
|
||||||
using (var stream = tournamentStorage.GetStream(stable_config, FileAccess.Write, FileMode.Create))
|
using (var stream = tournamentStorage.GetStream(StableInfo.STABLE_CONFIG, FileAccess.Write, FileMode.Create))
|
||||||
using (var sw = new StreamWriter(stream))
|
using (var sw = new StreamWriter(stream))
|
||||||
{
|
{
|
||||||
sw.Write(JsonConvert.SerializeObject(stableInfo,
|
sw.Write(JsonConvert.SerializeObject(stableInfo,
|
||||||
|
@ -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;
|
using System;
|
||||||
|
using Newtonsoft.Json;
|
||||||
using osu.Framework.Bindables;
|
using osu.Framework.Bindables;
|
||||||
|
|
||||||
namespace osu.Game.Tournament.Models
|
namespace osu.Game.Tournament.Models
|
||||||
@ -13,5 +14,8 @@ namespace osu.Game.Tournament.Models
|
|||||||
public class StableInfo
|
public class StableInfo
|
||||||
{
|
{
|
||||||
public Bindable<string> StablePath = new Bindable<string>(string.Empty);
|
public Bindable<string> StablePath = new Bindable<string>(string.Empty);
|
||||||
|
|
||||||
|
[JsonIgnore]
|
||||||
|
public const string STABLE_CONFIG = "tournament/stable.json";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -28,7 +28,6 @@ namespace osu.Game.Tournament.Screens
|
|||||||
|
|
||||||
private LoginOverlay loginOverlay;
|
private LoginOverlay loginOverlay;
|
||||||
private ActionableInfo resolution;
|
private ActionableInfo resolution;
|
||||||
private const string stable_config = "tournament/stable.json";
|
|
||||||
|
|
||||||
[Resolved]
|
[Resolved]
|
||||||
private MatchIPCInfo ipc { get; set; }
|
private MatchIPCInfo ipc { get; set; }
|
||||||
|
@ -26,8 +26,6 @@ namespace osu.Game.Tournament.Screens
|
|||||||
{
|
{
|
||||||
private DirectorySelector directorySelector;
|
private DirectorySelector directorySelector;
|
||||||
|
|
||||||
private const string stable_config = "tournament/stable.json";
|
|
||||||
|
|
||||||
[Resolved]
|
[Resolved]
|
||||||
private StableInfo stableInfo { get; set; }
|
private StableInfo stableInfo { get; set; }
|
||||||
|
|
||||||
@ -150,7 +148,7 @@ namespace osu.Game.Tournament.Screens
|
|||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
using (var stream = storage.GetStream(stable_config, FileAccess.Write, FileMode.Create))
|
using (var stream = storage.GetStream(StableInfo.STABLE_CONFIG, FileAccess.Write, FileMode.Create))
|
||||||
using (var sw = new StreamWriter(stream))
|
using (var sw = new StreamWriter(stream))
|
||||||
{
|
{
|
||||||
sw.Write(JsonConvert.SerializeObject(stableInfo,
|
sw.Write(JsonConvert.SerializeObject(stableInfo,
|
||||||
|
@ -147,7 +147,10 @@ namespace osu.Game.Tournament
|
|||||||
|
|
||||||
private void readStableConfig()
|
private void readStableConfig()
|
||||||
{
|
{
|
||||||
if (storage.Exists(stable_config))
|
if (stableInfo == null)
|
||||||
|
stableInfo = new StableInfo();
|
||||||
|
|
||||||
|
if (storage.Exists(StableInfo.STABLE_CONFIG))
|
||||||
{
|
{
|
||||||
using (Stream stream = storage.GetStream(stable_config, FileAccess.Read, FileMode.Open))
|
using (Stream stream = storage.GetStream(stable_config, FileAccess.Read, FileMode.Open))
|
||||||
using (var sr = new StreamReader(stream))
|
using (var sr = new StreamReader(stream))
|
||||||
@ -156,9 +159,6 @@ namespace osu.Game.Tournament
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (stableInfo == null)
|
|
||||||
stableInfo = new StableInfo();
|
|
||||||
|
|
||||||
dependencies.Cache(stableInfo);
|
dependencies.Cache(stableInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user