GUI: Small improvement in executable version check.
This commit is contained in:
parent
08aaf69262
commit
76c0050d60
@ -6,7 +6,6 @@
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
|
||||
using com.muldersoft.slunkcrypt.gui.utils;
|
||||
|
||||
namespace com.muldersoft.slunkcrypt.gui.process
|
||||
@ -87,7 +86,7 @@ namespace com.muldersoft.slunkcrypt.gui.process
|
||||
string.Equals(fileVersion.CompanyName, "Muldersoft", StringComparison.OrdinalIgnoreCase) &&
|
||||
(fileVersion.FileMajorPart == appVersion.Major) && (fileVersion.FileMinorPart == appVersion.Minor))
|
||||
{
|
||||
success = (fileVersion.FilePrivatePart >= appVersion.Revision);
|
||||
success = ToVersion64(fileVersion.FileBuildPart, fileVersion.FilePrivatePart) >= ToVersion64(appVersion.Build, appVersion.Revision);
|
||||
}
|
||||
}
|
||||
finally
|
||||
@ -101,5 +100,10 @@ namespace com.muldersoft.slunkcrypt.gui.process
|
||||
catch { }
|
||||
return success;
|
||||
}
|
||||
|
||||
static ulong ToVersion64(int upper, int lower)
|
||||
{
|
||||
return (Convert.ToUInt64(upper) << 32) | Convert.ToUInt64(lower);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -23,10 +23,11 @@ namespace com.muldersoft.slunkcrypt.gui.utils
|
||||
|
||||
public static new string ToString()
|
||||
{
|
||||
Version version = m_version.Value;
|
||||
return string.Format(
|
||||
(version.Revision > 0) ? "Version {0:D}.{1:D}.{2:D}, built on {3}" : "Version {0:D}.{1:D}, built on {3}",
|
||||
version.Major, version.Minor, version.Revision, BuildDate.ToString("yyyy-MM-dd"));
|
||||
Version value = Version;
|
||||
string versionString = string.Format(
|
||||
((value.Revision > 0) || (value.Build > 0)) ? ((value.Build > 0) ? "{0:D}.{1:D}.{2:D}.{3:D}" : "{0:D}.{1:D}.{3:D}") : "{0:D}.{1:D}",
|
||||
value.Major, value.Minor, value.Build, value.Revision);
|
||||
return string.Format("Version {0}, built on {1}", versionString, BuildDate.ToString("yyyy-MM-dd"));
|
||||
}
|
||||
|
||||
// =============================================================================
|
||||
|
Loading…
Reference in New Issue
Block a user