mirror of
https://github.com/LBPUnion/UnionPatcher.git
synced 2025-04-23 21:15:18 +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);
|
||||
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;
|
||||
}
|
||||
|
||||
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;
|
||||
|
|
|
@ -21,8 +21,10 @@ public static class Patcher {
|
|||
|
||||
public static byte[] PatchData(byte[] data, string serverUrl) {
|
||||
#region Validation
|
||||
if(serverUrl.EndsWith('/')) {
|
||||
throw new ArgumentException("URL must not contain a trailing slash!");
|
||||
// If server URL contains a trailing slash, loop until it's gone.
|
||||
while (serverUrl.EndsWith('/'))
|
||||
{
|
||||
serverUrl = serverUrl.Remove(serverUrl.Length - 1);
|
||||
}
|
||||
|
||||
// Attempt to create URI to see if it's valid
|
||||
|
|
Loading…
Add table
Reference in a new issue