mirror of
https://github.com/velopack/velopack.git
synced 2025-10-25 15:19:22 +00:00
If the icon URL is already an ico file, just use it directly
This commit is contained in:
@@ -108,10 +108,17 @@ namespace Squirrel
|
||||
var wc = new WebClient();
|
||||
|
||||
await wc.DownloadFileTaskAsync(zp.IconUrl, targetPng);
|
||||
using (var fs = new FileStream(targetIco, FileMode.Create))
|
||||
using (var bmp = (Bitmap)Image.FromFile(targetPng))
|
||||
using (var ico = Icon.FromHandle(bmp.GetHicon())) {
|
||||
ico.Save(fs);
|
||||
using (var fs = new FileStream(targetIco, FileMode.Create)) {
|
||||
if (zp.IconUrl.AbsolutePath.EndsWith("ico")) {
|
||||
var bytes = File.ReadAllBytes(targetPng);
|
||||
fs.Write(bytes, 0, bytes.Length);
|
||||
} else {
|
||||
using (var bmp = (Bitmap)Image.FromFile(targetPng))
|
||||
using (var ico = Icon.FromHandle(bmp.GetHicon())) {
|
||||
ico.Save(fs);
|
||||
}
|
||||
}
|
||||
|
||||
key.SetValue("DisplayIcon", targetIco, RegistryValueKind.String);
|
||||
}
|
||||
} catch(Exception ex) {
|
||||
|
||||
Reference in New Issue
Block a user