Merge pull request #2825 from ivandrofly/check-for-update

[checkforupdateshelper] - compare version using built-in version symbol
This commit is contained in:
Nikolaj Olsson 2018-03-13 16:50:49 +01:00 committed by GitHub
commit e22278ce9c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -139,23 +139,7 @@ namespace Nikse.SubtitleEdit.Core.Forms
try
{
//string[] currentVersionInfo = "3.3.14".Split('.'); // for testing...
string[] currentVersionInfo = Utilities.AssemblyVersion.Split('.');
string minorMinorVersion = string.Empty;
if (currentVersionInfo.Length >= 3 && currentVersionInfo[2] != "0")
minorMinorVersion = "." + currentVersionInfo[2];
string currentVersion = $"{currentVersionInfo[0]}.{currentVersionInfo[1]}{minorMinorVersion}";
if (currentVersion == LatestVersionNumber)
return false;
string[] latestVersionInfo = LatestVersionNumber.Split('.');
if (int.Parse(latestVersionInfo[0]) > int.Parse(currentVersionInfo[0]))
return true;
if (int.Parse(latestVersionInfo[0]) == int.Parse(currentVersionInfo[0]) && int.Parse(latestVersionInfo[1]) > int.Parse(currentVersionInfo[1]))
return true;
if (int.Parse(latestVersionInfo[0]) == int.Parse(currentVersionInfo[0]) && int.Parse(latestVersionInfo[1]) == int.Parse(currentVersionInfo[1]) && int.Parse(latestVersionInfo[2]) > int.Parse(currentVersionInfo[2]))
return true;
return false;
return Version.Parse(LatestVersionNumber) > Version.Parse(Utilities.AssemblyVersion);
}
catch
{