Added a url utility

This commit is contained in:
Lars Brubaker 2023-04-13 18:06:35 -07:00
parent 999bad8230
commit efcf5bebdc
2 changed files with 3 additions and 15 deletions

View file

@ -561,18 +561,6 @@ namespace MatterHackers.MatterControl
public static void LaunchBrowser(string targetUri)
{
string AddQueryPram(string url, string key, string value)
{
if (url.Contains("?"))
{
return url + "&" + key + "=" + value;
}
else
{
return url + "?" + key + "=" + value;
}
}
UiThread.RunOnIdle(() =>
{
var affiliateCode = OemSettings.Instance.AffiliateCode;
@ -591,11 +579,11 @@ namespace MatterHackers.MatterControl
// if the affiliateCode is only numbers, we assume it is a tracking code
if (affiliateCode.All(char.IsDigit))
{
targetUri = AddQueryPram(targetUri, "aff", affiliateCode);
targetUri = Util.AddQueryPram(targetUri, "aff", affiliateCode);
}
else // it is an RCODE
{
targetUri = AddQueryPram(targetUri, "rcode", affiliateCode);
targetUri = Util.AddQueryPram(targetUri, "rcode", affiliateCode);
}
targetUri += internalLink;