Fix styling issues and move StorageManager to Configuration Folder

This commit is contained in:
Shivam 2020-06-08 03:12:37 +02:00
parent ba5a747ac9
commit f01a86f5b1
3 changed files with 9 additions and 12 deletions

View File

@ -20,7 +20,6 @@ protected override void InitialiseDefaults()
base.InitialiseDefaults();
Set(StorageConfig.CurrentTournament, string.Empty);
}
}
public enum StorageConfig

View File

@ -19,8 +19,6 @@
using osu.Game.Beatmaps;
using osu.Game.Graphics;
using osu.Game.Online.API.Requests;
using osu.Framework.Logging;
using osu.Game.Tournament.Configuration;
using osu.Game.Tournament.IPC;
using osu.Game.Tournament.Models;
using osu.Game.Users;
@ -62,7 +60,7 @@ private void load(FrameworkConfigManager frameworkConfig)
Textures.AddStore(new TextureLoaderStore(tournamentStorage.VideoStorage));
this.storage = tournamentStorage;
storage = tournamentStorage;
windowSize = frameworkConfig.GetBindable<Size>(FrameworkSetting.WindowedSize);
windowSize.BindValueChanged(size => ScheduleAfterChildren(() =>

View File

@ -45,7 +45,7 @@ public TournamentStorage(GameHost host)
else
{
// Migrating old storage format to the new one.
Migrate();
migrate();
Logger.Log("Migrating files from old storage to new.");
}
@ -53,16 +53,16 @@ public TournamentStorage(GameHost host)
Logger.Log("Using tournament storage: " + GetFullPath(string.Empty));
}
private void Migrate()
private void migrate()
{
var defaultPath = "tournaments/default";
const string default_path = "tournaments/default";
var source = new DirectoryInfo(GetFullPath("tournament"));
var destination = new DirectoryInfo(GetFullPath(defaultPath));
var destination = new DirectoryInfo(GetFullPath(default_path));
Directory.CreateDirectory(destination.FullName);
if (host.Storage.Exists("bracket.json"))
{
{
Logger.Log("Migrating bracket to default tournament storage.");
var bracketFile = new System.IO.FileInfo(GetFullPath(string.Empty) + Path.DirectorySeparatorChar + GetFiles(string.Empty, "bracket.json").First());
attemptOperation(() => bracketFile.CopyTo(Path.Combine(destination.FullName, bracketFile.Name), true));
@ -70,8 +70,8 @@ private void Migrate()
Logger.Log("Migrating other assets to default tournament storage.");
copyRecursive(source, destination);
ChangeTargetStorage(UnderlyingStorage.GetStorageForDirectory(defaultPath));
storageConfig.Set<string>(StorageConfig.CurrentTournament, defaultPath);
ChangeTargetStorage(UnderlyingStorage.GetStorageForDirectory(default_path));
storageConfig.Set(StorageConfig.CurrentTournament, default_path);
storageConfig.Save();
}