Skip to content

Commit 71fc062

Browse files
committed
Fix version check alerting when your version is too new (closes #25)
1 parent 5f7e5b0 commit 71fc062

2 files changed

Lines changed: 16 additions & 6 deletions

File tree

CodeStats/CodeStatsPackage.cs

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -122,11 +122,21 @@ private static void InitializeAsync()
122122
{
123123
try
124124
{
125-
string latest = Constants.LatestPluginVersion();
126-
Logger.Debug("Latest version of the plugin online is: " + latest);
127-
if (Constants.PluginVersion != latest && !String.IsNullOrWhiteSpace(latest))
125+
string latestVersionString = Constants.LatestPluginVersion();
126+
Logger.Debug("Latest version of the plugin online is: " + latestVersionString);
127+
Version latest = new Version(latestVersionString);
128+
Version current = new Version(Constants.PluginVersion);
129+
if (current.CompareTo(latest) < 0 && !String.IsNullOrWhiteSpace(latestVersionString))
128130
{
129-
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");
131+
Logger.Info("Displaying update available notice");
132+
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");
133+
}
134+
else if (Debug)
135+
{
136+
if (current.CompareTo(latest) == 0)
137+
Logger.Debug("Not displaying update notice, current and latest version are the same");
138+
else if (current.CompareTo(latest) > 0)
139+
Logger.Debug("Not displaying update notice, current version is newer than latest");
130140
}
131141
}
132142
catch { }

CodeStats/Properties/AssemblyInfo.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,5 +36,5 @@
3636
// separating this is convenient, because it allows you to update the real values here without triggering the update notification before it's ready
3737
// [assembly: AssemblyFileVersion("1.0.1")]
3838

39-
[assembly: AssemblyVersion("1.1.0")]
40-
[assembly: AssemblyFileVersion("1.1.0")]
39+
[assembly: AssemblyVersion("1.1.1")]
40+
[assembly: AssemblyFileVersion("1.1.1")]

0 commit comments

Comments
 (0)