parse address and replace variables
This commit is contained in:
@@ -126,7 +126,7 @@ public class UpdateClient(string updateUrl, AppVersion currentVersion, AppChanne
|
|||||||
|
|
||||||
// Download zip package
|
// Download zip package
|
||||||
using var zipFile = new FileStream(zipPath, FileMode.Create, FileAccess.ReadWrite);
|
using var zipFile = new FileStream(zipPath, FileMode.Create, FileAccess.ReadWrite);
|
||||||
using var zipStream = await WebClient.GetStreamAsync(package.Address);
|
using var zipStream = await WebClient.GetStreamAsync(package.GetAddress());
|
||||||
await zipStream.CopyToAsync(zipFile);
|
await zipStream.CopyToAsync(zipFile);
|
||||||
|
|
||||||
// Remember path to package directory
|
// Remember path to package directory
|
||||||
@@ -138,7 +138,7 @@ public class UpdateClient(string updateUrl, AppVersion currentVersion, AppChanne
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (package.AddressType == PackageAddressType.Local)
|
else if (package.AddressType == PackageAddressType.Local)
|
||||||
dicPackagePaths.Add(package, package.Address);
|
dicPackagePaths.Add(package, package.GetAddress());
|
||||||
else
|
else
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
|||||||
@@ -27,5 +27,16 @@ public class UpdatePackageInfo(AppVersion version, string address)
|
|||||||
public UpdateType UpdateType { get; set; }
|
public UpdateType UpdateType { get; set; }
|
||||||
|
|
||||||
[Obsolete, JsonProperty]
|
[Obsolete, JsonProperty]
|
||||||
private string Packagelink => Address;
|
private string Packagelink => GetAddress();
|
||||||
|
|
||||||
|
public string GetAddress()
|
||||||
|
{
|
||||||
|
return Address
|
||||||
|
.Replace("{appversion}", Version.ToString())
|
||||||
|
.Replace("{version}", Version.Version.ToString())
|
||||||
|
.Replace("{channelstr}", Version.Channel.ToString())
|
||||||
|
.Replace("{channel}", ((int)Version.Channel).ToString())
|
||||||
|
.Replace("{build}", Version.Build.ToString())
|
||||||
|
;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user