Community Webservices: Don't assume the previous host was zune.net

This commit is contained in:
Yoshi Askharoun
2024-10-22 14:04:42 -05:00
parent e8a23d2ac9
commit 111a66d616
+11 -1
View File
@@ -154,9 +154,19 @@ public class WebservicesMod(ModMetadata metadata) : Mod(metadata), IAsyncInit
return $"Failed to reach \"{newHost}\". Ping status: {ping.Status}";
}
// Patch ZuneServices.dll to use the new host instead of zune.net
// Read URL block as string
zsDllReader.BaseStream.Position = ZUNESERVICES_ENDPOINTS_BLOCK_OFFSET;
string endpointBlock = System.Text.Encoding.Unicode.GetString(zsDllReader.ReadBytes(ZUNESERVICES_ENDPOINTS_BLOCK_LENGTH));
// Try to determine previous host
try
{
var firstUrl = endpointBlock[..endpointBlock.IndexOf('\0')];
oldHost = firstUrl.Substring(11, oldHost.Length);
}
catch { }
// Patch ZuneServices.dll to use the new host instead of zune.net
endpointBlock = endpointBlock.Replace("resources." + oldHost, "www.zuneupdate.com"); // Use zuneupdate.com until resources.zunes.me is online
endpointBlock = endpointBlock.Replace(oldHost, newHost);
byte[] endpointBytes = System.Text.Encoding.Unicode.GetBytes(endpointBlock);