1
0
mirror of https://github.com/ppy/osu.git synced 2024-09-21 18:07:23 +08:00

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
{
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.Angry;
HeaderText = @"This is an invalid IPC Directory!";
Icon = FontAwesome.Regular.SadTear;
HeaderText = headerText;
BodyText = bodyText;
Buttons = new PopupDialogButton[]
{
new PopupDialogOkButton

View File

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

View File

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

View File

@ -171,7 +171,7 @@ namespace osu.Game.Tournament.Screens
else
{
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);
Logger.Log("Folder is not an osu! stable CE directory");
// 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;
fileBasedIpc?.LocateStableStorage();
if (fileBasedIpc?.IPCStorage == null)
{
// Could not auto detect
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);
}
else