From 151b1099dfd1a7bf923e4769e744d29c6bd3a655 Mon Sep 17 00:00:00 2001 From: Anton Firsin Date: Thu, 15 Feb 2018 17:23:20 +0500 Subject: [PATCH 1/8] Using ToString method for logging instead of Description field --- src/NAppUpdate.Framework/Tasks/FileUpdateTask.cs | 7 +++++++ src/NAppUpdate.Framework/Tasks/RegistryTask.cs | 6 ++++++ src/NAppUpdate.Framework/Tasks/UpdateTaskBase.cs | 5 +++++ src/NAppUpdate.Framework/UpdateManager.cs | 10 +++++----- src/NAppUpdate.Updater/AppStart.cs | 4 ++-- 5 files changed, 25 insertions(+), 7 deletions(-) diff --git a/src/NAppUpdate.Framework/Tasks/FileUpdateTask.cs b/src/NAppUpdate.Framework/Tasks/FileUpdateTask.cs index 3830f2bf..ba1a85e1 100644 --- a/src/NAppUpdate.Framework/Tasks/FileUpdateTask.cs +++ b/src/NAppUpdate.Framework/Tasks/FileUpdateTask.cs @@ -159,6 +159,7 @@ public override bool Rollback() return true; } + /// /// To mitigate problems with the files being locked even though the application mutex has been released. /// https://github.com/synhershko/NAppUpdate/issues/35 @@ -176,5 +177,11 @@ private void FileLockWait() } } } + + public override string ToString() + { + var ret = base.ToString(); + return string.IsNullOrWhiteSpace(ret) ? LocalPath : ret; + } } } diff --git a/src/NAppUpdate.Framework/Tasks/RegistryTask.cs b/src/NAppUpdate.Framework/Tasks/RegistryTask.cs index 2bbfbae6..13067355 100644 --- a/src/NAppUpdate.Framework/Tasks/RegistryTask.cs +++ b/src/NAppUpdate.Framework/Tasks/RegistryTask.cs @@ -78,5 +78,11 @@ public override bool Rollback() Registry.SetValue(KeyName, KeyValueName, _originalValue); return true; } + + public override string ToString() + { + var ret = base.ToString(); + return string.IsNullOrWhiteSpace(ret) ? KeyName + @"\" + KeyValueName : ret; + } } } diff --git a/src/NAppUpdate.Framework/Tasks/UpdateTaskBase.cs b/src/NAppUpdate.Framework/Tasks/UpdateTaskBase.cs index a2d15d14..6627ad85 100644 --- a/src/NAppUpdate.Framework/Tasks/UpdateTaskBase.cs +++ b/src/NAppUpdate.Framework/Tasks/UpdateTaskBase.cs @@ -31,5 +31,10 @@ public virtual void OnProgress(UpdateProgressInfo pi) public abstract void Prepare(IUpdateSource source); public abstract TaskExecutionStatus Execute(bool coldRun); public abstract bool Rollback(); + + public override string ToString() + { + return Description; + } } } diff --git a/src/NAppUpdate.Framework/UpdateManager.cs b/src/NAppUpdate.Framework/UpdateManager.cs index 36ffbd19..af7e5966 100644 --- a/src/NAppUpdate.Framework/UpdateManager.cs +++ b/src/NAppUpdate.Framework/UpdateManager.cs @@ -101,7 +101,7 @@ private void TaskProgressCallback(UpdateProgressInfo currentStatus, IUpdateTask { if (ReportProgress == null) return; - currentStatus.TaskDescription = task.Description; + currentStatus.TaskDescription = task.ToString(); currentStatus.TaskId = UpdatesToApply.IndexOf(task) + 1; //This was an assumed int, which meant we never reached 100% with an odd number of tasks @@ -247,7 +247,7 @@ public void PrepareUpdates() { task.ExecutionStatus = TaskExecutionStatus.FailedToPrepare; Logger.Log(ex); - throw new UpdateProcessFailedException("Failed to prepare task: " + task.Description, ex); + throw new UpdateProcessFailedException("Failed to prepare task: " + task, ex); } task.ExecutionStatus = TaskExecutionStatus.Prepared; @@ -411,7 +411,7 @@ public void ApplyUpdates(bool relaunchApplication, bool updaterDoLogging, bool u catch (Exception ex) { task.ExecutionStatus = TaskExecutionStatus.Failed; // mark the failing task before rethrowing - throw new UpdateProcessFailedException("Update task execution failed: " + task.Description, ex); + throw new UpdateProcessFailedException("Update task execution failed: " + task, ex); } if (task.ExecutionStatus == TaskExecutionStatus.RequiresAppRestart @@ -426,7 +426,7 @@ public void ApplyUpdates(bool relaunchApplication, bool updaterDoLogging, bool u // We are being quite explicit here - only Successful return values are considered // to be Ok (cold updates are already handled above) if (task.ExecutionStatus != TaskExecutionStatus.Successful) - throw new UpdateProcessFailedException("Update task execution failed: " + task.Description); + throw new UpdateProcessFailedException("Update task execution failed: " + task); } // If an application restart is required @@ -591,4 +591,4 @@ private bool IsAfterRestart() return false; } } -} \ No newline at end of file +} diff --git a/src/NAppUpdate.Updater/AppStart.cs b/src/NAppUpdate.Updater/AppStart.cs index 825206db..534ab6cb 100644 --- a/src/NAppUpdate.Updater/AppStart.cs +++ b/src/NAppUpdate.Updater/AppStart.cs @@ -157,7 +157,7 @@ private static void PerformUpdates() // Perform the actual off-line update process foreach (var t in _dto.Tasks) { - Log("Task \"{0}\": {1}", t.Description, t.ExecutionStatus); + Log("Task \"{0}\": {1}", t.ToString(), t.ExecutionStatus); if (t.ExecutionStatus != TaskExecutionStatus.RequiresAppRestart && t.ExecutionStatus != TaskExecutionStatus.RequiresPrivilegedAppRestart) { @@ -180,7 +180,7 @@ private static void PerformUpdates() if (t.ExecutionStatus != TaskExecutionStatus.Successful) { - string taskFailedMessage = string.Format("Update failed, task execution failed, description: {0}, execution status: {1}", t.Description, t.ExecutionStatus); + string taskFailedMessage = string.Format("Update failed, task execution failed, description: {0}, execution status: {1}", t, t.ExecutionStatus); throw new Exception(taskFailedMessage, exception); } } From 540f0ad6a6a88def5c1d62279293d21f98d8e3e6 Mon Sep 17 00:00:00 2001 From: Anton Firsin Date: Fri, 16 Feb 2018 11:17:28 +0500 Subject: [PATCH 2/8] Public ChildConditions for outside check which conditions were met --- .../Conditions/BooleanCondition.cs | 22 +++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/src/NAppUpdate.Framework/Conditions/BooleanCondition.cs b/src/NAppUpdate.Framework/Conditions/BooleanCondition.cs index 477e4be5..13f80220 100644 --- a/src/NAppUpdate.Framework/Conditions/BooleanCondition.cs +++ b/src/NAppUpdate.Framework/Conditions/BooleanCondition.cs @@ -39,21 +39,21 @@ public static ConditionType ConditionTypeFromString(string type) } #endregion - protected class ConditionItem + public class ConditionItem { public ConditionItem(IUpdateCondition cnd, ConditionType typ) { - this._Condition = cnd; - this._ConditionType = typ; + this.Condition = cnd; + this.ConditionType = typ; } internal bool HasConditionType(ConditionType type) { - return (_ConditionType & type) > 0; + return (ConditionType & type) > 0; } - public readonly IUpdateCondition _Condition; - public readonly ConditionType _ConditionType; + public IUpdateCondition Condition { get; private set; } + public ConditionType ConditionType { get; private set; } } public BooleanCondition() @@ -61,7 +61,7 @@ public BooleanCondition() Attributes = new Dictionary(); } - protected LinkedList ChildConditions { get; set; } + public LinkedList ChildConditions { get; private set; } public int ChildConditionsCount { get { if (ChildConditions != null) return ChildConditions.Count; return 0; } } public void AddCondition(IUpdateCondition cnd) @@ -77,8 +77,8 @@ public void AddCondition(IUpdateCondition cnd, ConditionType type) public IUpdateCondition Degrade() { - if (ChildConditionsCount == 1 && (ChildConditions.First.Value._ConditionType & ConditionType.NOT) == 0) - return ChildConditions.First.Value._Condition; + if (ChildConditionsCount == 1 && (ChildConditions.First.Value.ConditionType & ConditionType.NOT) == 0) + return ChildConditions.First.Value.Condition; return this; } @@ -110,13 +110,13 @@ public bool IsMet(Tasks.IUpdateTask task) { if (item.HasConditionType(ConditionType.OR)) { - var checkResult = item._Condition.IsMet(task); + var checkResult = item.Condition.IsMet(task); passed = item.HasConditionType(ConditionType.NOT) ? !checkResult : checkResult; } } else { - var checkResult = item._Condition.IsMet(task); + var checkResult = item.Condition.IsMet(task); passed = item.HasConditionType(ConditionType.NOT) ? !checkResult : checkResult; } } From a743904829669abc9aa8aab985e6323ba2ebfb6a Mon Sep 17 00:00:00 2001 From: Anton Firsin Date: Fri, 16 Feb 2018 11:23:24 +0500 Subject: [PATCH 3/8] Conditions descriptions --- src/NAppUpdate.Framework/Conditions/FileChecksumCondition.cs | 5 +++++ src/NAppUpdate.Framework/Conditions/FileDateCondition.cs | 5 +++++ src/NAppUpdate.Framework/Conditions/FileExistsCondition.cs | 5 +++++ src/NAppUpdate.Framework/Conditions/FileSizeCondition.cs | 5 +++++ src/NAppUpdate.Framework/Conditions/FileVersionCondition.cs | 5 +++++ src/NAppUpdate.Framework/Conditions/OSCondition.cs | 5 +++++ 6 files changed, 30 insertions(+) diff --git a/src/NAppUpdate.Framework/Conditions/FileChecksumCondition.cs b/src/NAppUpdate.Framework/Conditions/FileChecksumCondition.cs index 7311ef23..4e760b0e 100644 --- a/src/NAppUpdate.Framework/Conditions/FileChecksumCondition.cs +++ b/src/NAppUpdate.Framework/Conditions/FileChecksumCondition.cs @@ -43,5 +43,10 @@ public bool IsMet(IUpdateTask task) return false; } + + public override string ToString() + { + return "Checksum [" + ChecksumType + "] != " + Checksum; + } } } diff --git a/src/NAppUpdate.Framework/Conditions/FileDateCondition.cs b/src/NAppUpdate.Framework/Conditions/FileDateCondition.cs index de3394ec..6542a093 100644 --- a/src/NAppUpdate.Framework/Conditions/FileDateCondition.cs +++ b/src/NAppUpdate.Framework/Conditions/FileDateCondition.cs @@ -62,5 +62,10 @@ public bool IsMet(Tasks.IUpdateTask task) } return result; } + + public override string ToString() + { + return "Timestamp not " + ComparisonType + " " + Timestamp; + } } } diff --git a/src/NAppUpdate.Framework/Conditions/FileExistsCondition.cs b/src/NAppUpdate.Framework/Conditions/FileExistsCondition.cs index 27932023..cbc984bf 100644 --- a/src/NAppUpdate.Framework/Conditions/FileExistsCondition.cs +++ b/src/NAppUpdate.Framework/Conditions/FileExistsCondition.cs @@ -24,5 +24,10 @@ public bool IsMet(Tasks.IUpdateTask task) return File.Exists(localPath); } + + public override string ToString() + { + return "File does not exist"; + } } } diff --git a/src/NAppUpdate.Framework/Conditions/FileSizeCondition.cs b/src/NAppUpdate.Framework/Conditions/FileSizeCondition.cs index 6b43837d..e283a868 100644 --- a/src/NAppUpdate.Framework/Conditions/FileSizeCondition.cs +++ b/src/NAppUpdate.Framework/Conditions/FileSizeCondition.cs @@ -47,5 +47,10 @@ public bool IsMet(Tasks.IUpdateTask task) } return FileSize > localFileSize; } + + public override string ToString() + { + return "FileSize not " + ComparisonType + " " + FileSize; + } } } diff --git a/src/NAppUpdate.Framework/Conditions/FileVersionCondition.cs b/src/NAppUpdate.Framework/Conditions/FileVersionCondition.cs index b33a74ff..2a2fc854 100644 --- a/src/NAppUpdate.Framework/Conditions/FileVersionCondition.cs +++ b/src/NAppUpdate.Framework/Conditions/FileVersionCondition.cs @@ -50,5 +50,10 @@ public bool IsMet(Tasks.IUpdateTask task) return updateVersion > localVersion; } } + + public override string ToString() + { + return "FileSize not " + ComparisonType + " " + Version; + } } } diff --git a/src/NAppUpdate.Framework/Conditions/OSCondition.cs b/src/NAppUpdate.Framework/Conditions/OSCondition.cs index ba3eb491..f1888e54 100644 --- a/src/NAppUpdate.Framework/Conditions/OSCondition.cs +++ b/src/NAppUpdate.Framework/Conditions/OSCondition.cs @@ -93,5 +93,10 @@ static extern IntPtr GetProcAddress(IntPtr hModule, static extern bool IsWow64Process(IntPtr hProcess, out bool wow64Process); #endregion + + public override string ToString() + { + return "OS bitness != " + OsBits; + } } } From feed2d69c992dace0d31e9ab6f032c002ba9db74 Mon Sep 17 00:00:00 2001 From: Anton Firsin Date: Fri, 16 Feb 2018 11:23:45 +0500 Subject: [PATCH 4/8] NullReferenceException --- src/NAppUpdate.Updater/AppStart.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/NAppUpdate.Updater/AppStart.cs b/src/NAppUpdate.Updater/AppStart.cs index 534ab6cb..bd062cc7 100644 --- a/src/NAppUpdate.Updater/AppStart.cs +++ b/src/NAppUpdate.Updater/AppStart.cs @@ -131,7 +131,8 @@ private static void PerformUpdates() } } - _logger.LogItems.InsertRange(0, _dto.LogItems); + if(_dto.LogItems != null) + _logger.LogItems.InsertRange(0, _dto.LogItems); _dto.LogItems = _logger.LogItems; // Get some required environment variables From 85bf4d6d4e061b9b7511e4868f44d0485c0f6bfa Mon Sep 17 00:00:00 2001 From: Anton Firsin Date: Fri, 16 Feb 2018 11:28:08 +0500 Subject: [PATCH 5/8] updater.exe update in resources --- .../Resources.Designer.cs | 7 +++++-- src/NAppUpdate.Framework/Resources.resx | 8 ++++---- src/NAppUpdate.Framework/Updater/updater.exe | Bin 82432 -> 81920 bytes .../Integration/SimpleWebSourceTests.cs | 1 + 4 files changed, 10 insertions(+), 6 deletions(-) diff --git a/src/NAppUpdate.Framework/Resources.Designer.cs b/src/NAppUpdate.Framework/Resources.Designer.cs index 062e58c8..a7769419 100644 --- a/src/NAppUpdate.Framework/Resources.Designer.cs +++ b/src/NAppUpdate.Framework/Resources.Designer.cs @@ -1,7 +1,7 @@ //------------------------------------------------------------------------------ // // This code was generated by a tool. -// Runtime Version:4.0.30319.17379 +// Runtime Version:4.0.30319.42000 // // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. @@ -19,7 +19,7 @@ namespace NAppUpdate.Framework { // class via a tool like ResGen or Visual Studio. // To add or remove a member, edit your .ResX file then rerun ResGen // with the /str option, or rebuild your VS project. - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "15.0.0.0")] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] internal class Resources { @@ -60,6 +60,9 @@ internal Resources() { } } + /// + /// Looks up a localized resource of type System.Byte[]. + /// internal static byte[] updater { get { object obj = ResourceManager.GetObject("updater", resourceCulture); diff --git a/src/NAppUpdate.Framework/Resources.resx b/src/NAppUpdate.Framework/Resources.resx index 9e5ab300..3db624e1 100644 --- a/src/NAppUpdate.Framework/Resources.resx +++ b/src/NAppUpdate.Framework/Resources.resx @@ -112,13 +112,13 @@ 2.0 - System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - + - Updater\updater.exe;System.Byte[], mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + updater\updater.exe;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 \ No newline at end of file diff --git a/src/NAppUpdate.Framework/Updater/updater.exe b/src/NAppUpdate.Framework/Updater/updater.exe index 94c4caa219213287b6920dade96fbe8b98d35156..f7023290709274ff5c010dcb635b71145ae15b9f 100644 GIT binary patch delta 9472 zcmaJ{4SW>UwLf=ucXsxZ?1m%+Lf8liO9(LtR6tY$2@r(vksyKyY?1+1HalTv0|Xw~ zO+_kNEc~Wcfr^6qw6$9C0~M))udVX)&uWn#2{`eR_la38U66y;&US1*rdJBG|YeaT15JDAGD2GZ-fq4^pnePBtBf!{VegU*(R{?yi zELIQ2;egu9UYO$q%*SI;GAaNH-D9^#+{Oirddx-$`+G$^hqAI?#B+8!rN&5TjtfUT z<~7hYMuDn{n%`riax~dv>=;6)O312Cmlvw$Tj!cpjVcHnmrfJL#)SP-d%phq>(jxA zyT%I+mec>X8XuEIn?vZ`v5zqIcs0mk)ht!0D~?t7M}<{`rqJshr$xNRIN(*MtEx_q zG%KNUjz7gYFO0k$@xr>-vEIvOjaqc68QRP1VO$8j_$=E%MrZw!J}WoIL&?#(2w2cT zCjhM+S5T$N#jYHuR`pHCn>Ho`6l#+nM#e@oV+vC~vjtX$lc|5G zvLurA8B?L~-OC3ILCBn8wPks%tTt*|=zUJK$1WdS=r_M}J~QHr_)3gR(ASs-fTi{g zl~|!4N#Iy5t&N#?p&RSUVH)Jf@k`Mm;mX6HL(AM_Sx16BjBa2NR>pmG!sl!#`!>DRL0fj>xu%7hD*0Q^Cs zV1%egrQlsXNR0lL;Hrr04yEF_5_Iaz<;pMIt~~!SSMdw3LCi0#Q|V1dne3c4KD64Y z3E1yy&3OB1tvKjx{a!8}hwR^KlSf?QqzBg0KlmT6vxG4poOroC%{S^=;xZ$PHH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|`ndIiZ!6y76mKpbQAU zCWv6UBSMNZB7_1&V?+aj2^91ffGX24SJNB~QNoW5q^S`_lm^G}027Mpwi)B?p$f~^ z;&U-RgW1Mlr<(!4$FsG-W?sQ<-8cDQ7R$SX$&ME@AUX4A|v_NjZ(*?)y2kl_) zHVMD)j8HI8K#HcZJBn7o%WH+?7!u4K28KyLQ*GQ6At1*@h?sFqU{Cm-l%B@& z3IZX5x$JEkJP4L(u80G?BE>5wz7Ek_Zp@U359=^-80LKNypM0|{sFqDS^P&v5H`21 zo97;5Zb5_sxj(BBZ1B$t1|C&%Xj-%$?I_xrS(2&>TC1xQp+87fS3KX%!= zY~Xe8jPFhE8gwr&80=}XhZf5}b)|-(oZ3h+{t&FI(hd4gz3bA9uu*3tT7qXMx*e^_SlzB~Sv~NTaMJ3u z*=ChL9`dg?TCZBY1a}X!qU*isTyupju&o0Iz`^&>h*Be&&iN9O>e)5Q=9o6dB z6Xp0P7yR0l!_S=f$%Jwk&U>8F?FYff-suEJgo@t8hHJE<&fgfKYc8UcD#!nOP7S>WVxctHIc?X6} z7sthw2fm&zmP4UshA;}G!hsiNh{>LQ-6JcG8O|eL&D^nVrXVL3VatLdG876$A~wZ= ya8L~lvy8*wq}j7=ii1#aV8~2y*%QlVibwG0Eboz?pNtcpm+c?r_Du!(x%gjGhOZd_ diff --git a/src/NAppUpdate.Tests/Integration/SimpleWebSourceTests.cs b/src/NAppUpdate.Tests/Integration/SimpleWebSourceTests.cs index 8f66a929..90c832b7 100644 --- a/src/NAppUpdate.Tests/Integration/SimpleWebSourceTests.cs +++ b/src/NAppUpdate.Tests/Integration/SimpleWebSourceTests.cs @@ -9,6 +9,7 @@ public class SimpleWebSourceTests [TestMethod] public void can_download_ansi_feed() { + Assert.Inconclusive("This url contains wrong data"); const string expected = "NHibernate.Profiler-Build-"; var ws = new SimpleWebSource("http://builds.hibernatingrhinos.com/latest/nhprof"); From 9d75af569f2508d84e4d93b4ba6e222ab61c1c5a Mon Sep 17 00:00:00 2001 From: Anton Firsin Date: Fri, 16 Feb 2018 14:26:13 +0500 Subject: [PATCH 6/8] Small fix --- src/NAppUpdate.Framework/Conditions/FileVersionCondition.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/NAppUpdate.Framework/Conditions/FileVersionCondition.cs b/src/NAppUpdate.Framework/Conditions/FileVersionCondition.cs index 2a2fc854..c2498608 100644 --- a/src/NAppUpdate.Framework/Conditions/FileVersionCondition.cs +++ b/src/NAppUpdate.Framework/Conditions/FileVersionCondition.cs @@ -53,7 +53,7 @@ public bool IsMet(Tasks.IUpdateTask task) public override string ToString() { - return "FileSize not " + ComparisonType + " " + Version; + return "Version not " + ComparisonType + " " + Version; } } } From a4275c3c51a4bf5f9a8dd61ddd1c1ffc1e0eb3c0 Mon Sep 17 00:00:00 2001 From: Anton Firsin Date: Fri, 16 Feb 2018 14:27:45 +0500 Subject: [PATCH 7/8] backup files overwriting elimination --- src/NAppUpdate.Framework/Common/Logger.cs | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/src/NAppUpdate.Framework/Common/Logger.cs b/src/NAppUpdate.Framework/Common/Logger.cs index 24baea61..68257f1c 100644 --- a/src/NAppUpdate.Framework/Common/Logger.cs +++ b/src/NAppUpdate.Framework/Common/Logger.cs @@ -95,6 +95,13 @@ public void Dump(string filePath) filePath = Path.Combine(workingDir ?? string.Empty, @"NauUpdate.log"); } + if (File.Exists(filePath)) + { + var oldBackupFile = SelectBackupLogFileName(filePath); + if (oldBackupFile != null) + File.Move(filePath, oldBackupFile); + } + lock (LogItems) { using (StreamWriter w = File.CreateText(filePath)) @@ -104,5 +111,20 @@ public void Dump(string filePath) } } } + + private string SelectBackupLogFileName(string filePath) + { + var directory = Path.GetDirectoryName(filePath); + if (directory == null) + directory = "."; + for (var i = 0; i < 10; i++) + { + filePath = Path.Combine(directory, "NauUpdate." + i + ".log"); + if(File.Exists(filePath)) + continue; + return filePath; + } + return null; + } } } From 94bf15f9e3bff58b49820f76d600b5ec694f176d Mon Sep 17 00:00:00 2001 From: Anton Firsin Date: Fri, 16 Feb 2018 16:42:55 +0500 Subject: [PATCH 8/8] text fixes --- src/NAppUpdate.Framework/Conditions/FileChecksumCondition.cs | 2 +- src/NAppUpdate.Framework/Conditions/FileDateCondition.cs | 2 +- src/NAppUpdate.Framework/Conditions/FileExistsCondition.cs | 2 +- src/NAppUpdate.Framework/Conditions/FileSizeCondition.cs | 2 +- src/NAppUpdate.Framework/Conditions/FileVersionCondition.cs | 2 +- src/NAppUpdate.Framework/Conditions/OSCondition.cs | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/NAppUpdate.Framework/Conditions/FileChecksumCondition.cs b/src/NAppUpdate.Framework/Conditions/FileChecksumCondition.cs index 4e760b0e..ff8079ed 100644 --- a/src/NAppUpdate.Framework/Conditions/FileChecksumCondition.cs +++ b/src/NAppUpdate.Framework/Conditions/FileChecksumCondition.cs @@ -46,7 +46,7 @@ public bool IsMet(IUpdateTask task) public override string ToString() { - return "Checksum [" + ChecksumType + "] != " + Checksum; + return "Checksum [" + ChecksumType + "] equals " + Checksum; } } } diff --git a/src/NAppUpdate.Framework/Conditions/FileDateCondition.cs b/src/NAppUpdate.Framework/Conditions/FileDateCondition.cs index 6542a093..67423cd2 100644 --- a/src/NAppUpdate.Framework/Conditions/FileDateCondition.cs +++ b/src/NAppUpdate.Framework/Conditions/FileDateCondition.cs @@ -65,7 +65,7 @@ public bool IsMet(Tasks.IUpdateTask task) public override string ToString() { - return "Timestamp not " + ComparisonType + " " + Timestamp; + return "Timestamp " + ComparisonType + " " + Timestamp; } } } diff --git a/src/NAppUpdate.Framework/Conditions/FileExistsCondition.cs b/src/NAppUpdate.Framework/Conditions/FileExistsCondition.cs index cbc984bf..78ca0607 100644 --- a/src/NAppUpdate.Framework/Conditions/FileExistsCondition.cs +++ b/src/NAppUpdate.Framework/Conditions/FileExistsCondition.cs @@ -27,7 +27,7 @@ public bool IsMet(Tasks.IUpdateTask task) public override string ToString() { - return "File does not exist"; + return "File exists"; } } } diff --git a/src/NAppUpdate.Framework/Conditions/FileSizeCondition.cs b/src/NAppUpdate.Framework/Conditions/FileSizeCondition.cs index e283a868..aece94f9 100644 --- a/src/NAppUpdate.Framework/Conditions/FileSizeCondition.cs +++ b/src/NAppUpdate.Framework/Conditions/FileSizeCondition.cs @@ -50,7 +50,7 @@ public bool IsMet(Tasks.IUpdateTask task) public override string ToString() { - return "FileSize not " + ComparisonType + " " + FileSize; + return "FileSize " + ComparisonType + " " + FileSize; } } } diff --git a/src/NAppUpdate.Framework/Conditions/FileVersionCondition.cs b/src/NAppUpdate.Framework/Conditions/FileVersionCondition.cs index c2498608..b84ed104 100644 --- a/src/NAppUpdate.Framework/Conditions/FileVersionCondition.cs +++ b/src/NAppUpdate.Framework/Conditions/FileVersionCondition.cs @@ -53,7 +53,7 @@ public bool IsMet(Tasks.IUpdateTask task) public override string ToString() { - return "Version not " + ComparisonType + " " + Version; + return "Version " + ComparisonType + " " + Version; } } } diff --git a/src/NAppUpdate.Framework/Conditions/OSCondition.cs b/src/NAppUpdate.Framework/Conditions/OSCondition.cs index f1888e54..76fdbbc1 100644 --- a/src/NAppUpdate.Framework/Conditions/OSCondition.cs +++ b/src/NAppUpdate.Framework/Conditions/OSCondition.cs @@ -96,7 +96,7 @@ static extern IntPtr GetProcAddress(IntPtr hModule, public override string ToString() { - return "OS bitness != " + OsBits; + return "OS bitness is " + OsBits; } } }