diff --git a/UnionPatcher.Gui/MainForm.cs b/UnionPatcher.Gui/MainForm.cs index e35daa6..aed41a5 100644 --- a/UnionPatcher.Gui/MainForm.cs +++ b/UnionPatcher.Gui/MainForm.cs @@ -10,7 +10,6 @@ namespace LBPUnion.UnionPatcher.Gui { private readonly FilePicker filePicker; private readonly TextBox serverUrl; private readonly FilePicker outputFileName; - public Dialog CreateOkDialog(string title, string errorMessage) { DynamicLayout layout = new(); Button button; @@ -86,6 +85,18 @@ namespace LBPUnion.UnionPatcher.Gui { return; } + if (this.filePicker.FilePath == this.outputFileName.FilePath) + { + this.CreateOkDialog("Form Error", "Input and output filename are the same! Please save the patched file with a different name so you have a backup of your the original EBOOT.ELF.").ShowModal(); + return; + } + + if (!Uri.TryCreate(this.serverUrl.Text, UriKind.Absolute, out _)) + { + this.CreateOkDialog("Form Error", "Server URL is invalid! Please enter a valid URL.").ShowModal(); + return; + } + try { Patcher.PatchFile(this.filePicker.FilePath, this.serverUrl.Text, this.outputFileName.FilePath); }