Make IPC error dialog reusable

and inspectcode fixes
This commit is contained in:
Shivam 2020-05-17 22:46:43 +02:00
parent a97100216c
commit 59b006f9ac
4 changed files with 11 additions and 10 deletions

View File

@ -6,14 +6,13 @@ using osu.Game.Overlays.Dialog;
namespace osu.Game.Tournament.Components namespace osu.Game.Tournament.Components
{ {
public class IPCNotFoundDialog : PopupDialog public class IPCErrorDialog : PopupDialog
{ {
public IPCNotFoundDialog() public IPCErrorDialog(string headerText, string bodyText)
{ {
BodyText = "Select a directory that contains an osu! Cutting Edge installation"; Icon = FontAwesome.Regular.SadTear;
HeaderText = headerText;
Icon = FontAwesome.Regular.Angry; BodyText = bodyText;
HeaderText = @"This is an invalid IPC Directory!";
Buttons = new PopupDialogButton[] Buttons = new PopupDialogButton[]
{ {
new PopupDialogOkButton new PopupDialogOkButton

View File

@ -233,6 +233,7 @@ namespace osu.Game.Tournament.IPC
private string findFromJsonConfig() private string findFromJsonConfig()
{ {
Logger.Log("Trying to find stable through the json config"); Logger.Log("Trying to find stable through the json config");
if (tournamentStorage.Exists(stable_config)) if (tournamentStorage.Exists(stable_config))
{ {
using (Stream stream = tournamentStorage.GetStream(stable_config, FileAccess.Read, FileMode.Open)) using (Stream stream = tournamentStorage.GetStream(stable_config, FileAccess.Read, FileMode.Open))

View File

@ -82,7 +82,7 @@ namespace osu.Game.Tournament.Screens
ButtonText = "Refresh", ButtonText = "Refresh",
Action = () => Action = () =>
{ {
stableInfo.StablePath.BindValueChanged(_ => stableInfo.StablePath.BindValueChanged(_ =>
{ {
fileBasedIpc?.LocateStableStorage(); fileBasedIpc?.LocateStableStorage();
Schedule(reload); Schedule(reload);

View File

@ -171,7 +171,7 @@ namespace osu.Game.Tournament.Screens
else else
{ {
overlay = new DialogOverlay(); overlay = new DialogOverlay();
overlay.Push(new IPCNotFoundDialog()); overlay.Push(new IPCErrorDialog("This is an invalid IPC Directory", "Select a directory that contains an osu! stable cutting edge installation and make sure it has an empty ipc.txt file in it."));
AddInternal(overlay); AddInternal(overlay);
Logger.Log("Folder is not an osu! stable CE directory"); Logger.Log("Folder is not an osu! stable CE directory");
// Return an error in the picker that the directory does not contain ipc.txt // Return an error in the picker that the directory does not contain ipc.txt
@ -182,11 +182,12 @@ namespace osu.Game.Tournament.Screens
{ {
var fileBasedIpc = ipc as FileBasedIPC; var fileBasedIpc = ipc as FileBasedIPC;
fileBasedIpc?.LocateStableStorage(); fileBasedIpc?.LocateStableStorage();
if (fileBasedIpc?.IPCStorage == null) if (fileBasedIpc?.IPCStorage == null)
{ {
// Could not auto detect // Could not auto detect
overlay = new DialogOverlay(); overlay = new DialogOverlay();
overlay.Push(new IPCNotFoundDialog()); overlay.Push(new IPCErrorDialog("Failed to auto detect", "An osu! stable cutting-edge installation could not be auto detected.\nPlease try and manually point to the directory."));
AddInternal(overlay); AddInternal(overlay);
} }
else else