mirror of
https://github.com/LBPUnion/UnionPatcher.git
synced 2025-07-30 20:58:40 +00:00
Added support for trailing slashes
Trailing slahes (LITTLEBIGPLANETPS3_XML/) now get automatically removed.
This commit is contained in:
parent
47af7d6929
commit
3b309103cd
3 changed files with 22 additions and 4 deletions
|
@ -132,7 +132,15 @@ public class FilePatchForm : Form {
|
||||||
Gui.CreateOkDialog("Error occurred while patching", "An error occured while patching:\n" + e);
|
Gui.CreateOkDialog("Error occurred while patching", "An error occured while patching:\n" + e);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Purely for the dialog box to show the correct URL. Actual patcher has this too.
|
||||||
|
// If server URL contains a trailing slash, loop until it's gone.
|
||||||
|
string formattedUrl = this.serverUrl.Text;
|
||||||
|
while (formattedUrl.EndsWith('/'))
|
||||||
|
{
|
||||||
|
formattedUrl = formattedUrl.Remove(formattedUrl.Length - 1);
|
||||||
|
}
|
||||||
|
|
||||||
Gui.CreateOkDialog("Success!", "The Server URL has been patched to " + this.serverUrl.Text);
|
Gui.CreateOkDialog("Success!", "The Server URL has been patched to " + formattedUrl);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -73,7 +73,15 @@ public class RemotePatchForm : Form
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Gui.CreateOkDialog("Success!", $"The Server URL for {this.lbpGameID.Text} on the PS3 at {this.ps3LocalIP.Text} has been patched to {this.serverUrl.Text}");
|
// Purely for the dialog box to show the correct URL. Actual patcher has this too.
|
||||||
|
// If server URL contains a trailing slash, loop until it's gone.
|
||||||
|
string formattedUrl = this.serverUrl.Text;
|
||||||
|
while (formattedUrl.EndsWith('/'))
|
||||||
|
{
|
||||||
|
formattedUrl = formattedUrl.Remove(formattedUrl.Length - 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
Gui.CreateOkDialog("Success!", $"The Server URL for {this.lbpGameID.Text} on the PS3 at {this.ps3LocalIP.Text} has been patched to {formattedUrl}");
|
||||||
};
|
};
|
||||||
|
|
||||||
return control;
|
return control;
|
||||||
|
|
|
@ -21,8 +21,10 @@ public static class Patcher {
|
||||||
|
|
||||||
public static byte[] PatchData(byte[] data, string serverUrl) {
|
public static byte[] PatchData(byte[] data, string serverUrl) {
|
||||||
#region Validation
|
#region Validation
|
||||||
if(serverUrl.EndsWith('/')) {
|
// If server URL contains a trailing slash, loop until it's gone.
|
||||||
throw new ArgumentException("URL must not contain a trailing slash!");
|
while (serverUrl.EndsWith('/'))
|
||||||
|
{
|
||||||
|
serverUrl = serverUrl.Remove(serverUrl.Length - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Attempt to create URI to see if it's valid
|
// Attempt to create URI to see if it's valid
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue