Skip to content

Commit b60596a

Browse files
committed
Check OS compatibility when searching for updates
1 parent befd244 commit b60596a

4 files changed

Lines changed: 36 additions & 1 deletion

File tree

‎Source/NETworkManager/Models/Update/Updater.cs‎

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,13 @@ protected virtual void OnNoUpdateAvailable()
2222
NoUpdateAvailable?.Invoke(this, EventArgs.Empty);
2323
}
2424

25+
public event EventHandler ClientIncompatibleWithNewVersion;
26+
27+
protected virtual void OnClientIncompatibleWithNewVersion()
28+
{
29+
ClientIncompatibleWithNewVersion?.Invoke(this, EventArgs.Empty);
30+
}
31+
2532
public event EventHandler Error;
2633

2734
protected virtual void OnError()
@@ -42,6 +49,13 @@ public void Check()
4249
var latestRelease = client.Repository.Release.GetLatest(Properties.Resources.NETworkManager_GitHub_User, Properties.Resources.NETworkManager_GitHub_Repo);
4350

4451
var latestVersion = new Version(latestRelease.Result.TagName.TrimStart('v'));
52+
53+
if(ConfigurationManager.Current.OSVersion < new Version(10, 0) && latestVersion >= new Version(2,0))
54+
{
55+
OnClientIncompatibleWithNewVersion();
56+
57+
return;
58+
}
4559

4660
// Compare versions (tag=v1.4.2.0, version=1.4.2.0)
4761
if (latestVersion > AssemblyManager.Current.Version)

‎Source/NETworkManager/Resources/Localization/Strings.Designer.cs‎

Lines changed: 9 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎Source/NETworkManager/Resources/Localization/Strings.resx‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2018,4 +2018,7 @@ Changing this value requires a restart of the application to take effect.</value
20182018
<data name="RunBackgroundJobEveryXMinute" xml:space="preserve">
20192019
<value>Run background job every x-minute</value>
20202020
</data>
2021+
<data name="YourSystemOSIsIncompatibleWithTheLatestRelease" xml:space="preserve">
2022+
<value>Your system OS is incompatible with the latest release!</value>
2023+
</data>
20212024
</root>

‎Source/NETworkManager/ViewModels/AboutViewModel.cs‎

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,11 +172,12 @@ private void CheckForUpdates()
172172

173173
updater.UpdateAvailable += Updater_UpdateAvailable;
174174
updater.NoUpdateAvailable += Updater_NoUpdateAvailable;
175+
updater.ClientIncompatibleWithNewVersion += Updater_ClientIncompatibleWithNewVersion; ;
175176
updater.Error += Updater_Error;
176177

177178
updater.Check();
178179
}
179-
180+
180181
public void OpenLicenseFolder()
181182
{
182183
Process.Start(LibraryManager.GetLicenseLocation());
@@ -200,6 +201,14 @@ private void Updater_NoUpdateAvailable(object sender, EventArgs e)
200201
ShowUpdaterMessage = true;
201202
}
202203

204+
private void Updater_ClientIncompatibleWithNewVersion(object sender, EventArgs e)
205+
{
206+
UpdaterMessage = Strings.YourSystemOSIsIncompatibleWithTheLatestRelease;
207+
208+
IsUpdateCheckRunning = false;
209+
ShowUpdaterMessage = true;
210+
}
211+
203212
private void Updater_Error(object sender, EventArgs e)
204213
{
205214
UpdaterMessage = Strings.ErrorCheckingApiGithubComVerifyYourNetworkConnection;

0 commit comments

Comments
 (0)