Merge pull request #11 from AShifter/master

Check input/output file names and input server URL
This commit is contained in:
jvyden 2022-02-20 20:18:33 -05:00 committed by GitHub
commit 4c0f87ec78
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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);
}