mirror of
https://github.com/QL-Win/QuickLook.git
synced 2026-02-28 01:00:17 +08:00
Version.CompareTo
This commit is contained in:
@@ -41,6 +41,8 @@ namespace QuickLook
|
|||||||
bool success = false;
|
bool success = false;
|
||||||
int cleanNewVersion = 0;
|
int cleanNewVersion = 0;
|
||||||
int cleanCurrentVersion = 0;
|
int cleanCurrentVersion = 0;
|
||||||
|
Version vNew = new Version();
|
||||||
|
Version vCurrent = new Version();
|
||||||
string changeLogPath = Directory.GetCurrentDirectory() + @"\quicklook_updates\changelog.md";
|
string changeLogPath = Directory.GetCurrentDirectory() + @"\quicklook_updates\changelog.md";
|
||||||
|
|
||||||
try
|
try
|
||||||
@@ -53,9 +55,8 @@ namespace QuickLook
|
|||||||
lversion = results["name"];
|
lversion = results["name"];
|
||||||
dpath = results["assets"][0]["browser_download_url"];
|
dpath = results["assets"][0]["browser_download_url"];
|
||||||
mdchangelog = results["body"];
|
mdchangelog = results["body"];
|
||||||
lversion = lversion + ".0"; //update-version.cmd adds an aditional 0 to the version, github api doesnt.
|
vNew = new Version(lversion);
|
||||||
cleanNewVersion = Convert.ToInt32(lversion.Replace(".", ""));
|
vCurrent = new Version(Application.ProductVersion);
|
||||||
cleanCurrentVersion = Convert.ToInt32(Application.ProductVersion.Replace(".", ""));
|
|
||||||
|
|
||||||
string tmpFolderPath = Directory.GetCurrentDirectory() + @"\quicklook_updates";
|
string tmpFolderPath = Directory.GetCurrentDirectory() + @"\quicklook_updates";
|
||||||
if (!Directory.Exists(tmpFolderPath))
|
if (!Directory.Exists(tmpFolderPath))
|
||||||
@@ -93,7 +94,7 @@ namespace QuickLook
|
|||||||
success = false;
|
success = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((cleanCurrentVersion < cleanNewVersion) && success)
|
if ((vNew.CompareTo(vCurrent) > 0) && success)
|
||||||
{
|
{
|
||||||
Action acpt = new Action(() => UpdateConfirmation(changeLogPath, dpath));
|
Action acpt = new Action(() => UpdateConfirmation(changeLogPath, dpath));
|
||||||
Action dcln = new Action(() => CancelUpdate());
|
Action dcln = new Action(() => CancelUpdate());
|
||||||
@@ -113,7 +114,7 @@ namespace QuickLook
|
|||||||
{
|
{
|
||||||
if (!silent)
|
if (!silent)
|
||||||
{
|
{
|
||||||
TrayIconManager.GetInstance().ShowNotification("QuickLook", "You have the latest version installed.", false);
|
TrayIconManager.GetInstance().ShowNotification("", "You have the latest version installed.", false);
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user