Skip to content

Commit

Permalink
Fix version check alerting when your version is too new (closes #25)
Browse files Browse the repository at this point in the history
  • Loading branch information
p0358 committed Nov 1, 2022
1 parent 5f7e5b0 commit 71fc062
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 6 deletions.
18 changes: 14 additions & 4 deletions CodeStats/CodeStatsPackage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -122,11 +122,21 @@ private static void InitializeAsync()
{
try
{
string latest = Constants.LatestPluginVersion();
Logger.Debug("Latest version of the plugin online is: " + latest);
if (Constants.PluginVersion != latest && !String.IsNullOrWhiteSpace(latest))
string latestVersionString = Constants.LatestPluginVersion();
Logger.Debug("Latest version of the plugin online is: " + latestVersionString);
Version latest = new Version(latestVersionString);
Version current = new Version(Constants.PluginVersion);
if (current.CompareTo(latest) < 0 && !String.IsNullOrWhiteSpace(latestVersionString))
{
MessageBox.Show("There is Code::Stats plugin update available!\nDownload it from Plugins Admin (if already available there) or GitHub.\nYour version: " + Constants.PluginVersion + "\nLatest: " + latest, "Code::Stats");
Logger.Info("Displaying update available notice");
MessageBox.Show("There is Code::Stats plugin update available!\nDownload it from Plugins Admin or GitHub. If the update is not available in Plugins Admin, you may need to update your Notepad++ version first.\nYour version: " + Constants.PluginVersion + "\nLatest: " + latestVersionString, "Code::Stats");
}
else if (Debug)
{
if (current.CompareTo(latest) == 0)
Logger.Debug("Not displaying update notice, current and latest version are the same");
else if (current.CompareTo(latest) > 0)
Logger.Debug("Not displaying update notice, current version is newer than latest");
}
}
catch { }
Expand Down
4 changes: 2 additions & 2 deletions CodeStats/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,5 +36,5 @@
// separating this is convenient, because it allows you to update the real values here without triggering the update notification before it's ready
// [assembly: AssemblyFileVersion("1.0.1")]

[assembly: AssemblyVersion("1.1.0")]
[assembly: AssemblyFileVersion("1.1.0")]
[assembly: AssemblyVersion("1.1.1")]
[assembly: AssemblyFileVersion("1.1.1")]

0 comments on commit 71fc062

Please sign in to comment.