From 5663f5ee5d011033dcd287d364d82e2ea410836c Mon Sep 17 00:00:00 2001 From: Pascal Schedel Date: Wed, 4 Dec 2024 14:56:41 +0100 Subject: [PATCH] only delete file when downloaded from http --- Pilz.Updating.Client/UpdateClient.cs | 2 +- Pilz.Updating.Client/Utils.cs | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/Pilz.Updating.Client/UpdateClient.cs b/Pilz.Updating.Client/UpdateClient.cs index dd5dddf..5206de7 100644 --- a/Pilz.Updating.Client/UpdateClient.cs +++ b/Pilz.Updating.Client/UpdateClient.cs @@ -200,7 +200,7 @@ public class UpdateClient(string updateUrl, AppVersion currentVersion, AppChanne File.Delete(packagePath); Directory.Delete(dataPath, true); } - else if (package.PackageType == PackageType.File) + else if (package.PackageType == PackageType.File && package.AddressType == PackageAddressType.Http) File.Delete(dataPath); RaiseStatusChanged(UpdateStatus.Cleanup, UpdateStatusEvent.PostEvent); diff --git a/Pilz.Updating.Client/Utils.cs b/Pilz.Updating.Client/Utils.cs index 61e7cc6..b7bf5f6 100644 --- a/Pilz.Updating.Client/Utils.cs +++ b/Pilz.Updating.Client/Utils.cs @@ -42,7 +42,7 @@ public static class Utils oldFile = destFileName + ".old"; File.Move(destFileName, oldFile, true); triesLeft++; - Thread.Sleep(1000); + Thread.Sleep(100); } } catch (Exception) @@ -55,7 +55,6 @@ public static class Utils try { File.Delete(oldFile); - Thread.Sleep(1000); } catch (Exception) {