Skip to content

Commit 080e38c

Browse files
committed
Automatic merge of T1.5.1-922-g0a17d985e and 16 pull requests
- Pull request #570 at 3539862: Experimental glTF 2.0 support with PBR lighting - Pull request #839 at d00beb9: First phase of https://blueprints.launchpad.net/or/+spec/additional-cruise-control-parameters - Pull request #876 at f92de76: docs: add source for documents previously on website to source Documentation folder - Pull request #882 at 3ca0eb1: Blueprint/train car operations UI window - Pull request #885 at 42092cb: feat: Add notifications to Menu - Pull request #886 at 6c0785b: Scene viewer extension to TrackViewer - Pull request #892 at 1f5ba4c: Signal Function OPP_SIG_ID_TRAINPATH - Pull request #896 at 5866028: First implementation of https://blueprints.launchpad.net/or/+spec/specific-sounds-for-ai-trains - Pull request #903 at 29f3d1a: Downloading route content (Github, zip) - Pull request #912 at f7b85e4: New Triple Valve Features Vol. 2 - Pull request #919 at 26cc6a8: Added mouse wheel support for controls which can be moved by pressing t… - Pull request #923 at e0f3c55: Add curve squeal to route - Pull request #924 at 6c2c3cd: Default Asset Improvements - Pull request #925 at e3b1688: Fix brakeshoe force bug - Pull request #927 at cf687d4: AI Train Power Supply/Lights Fix - Pull request #928 at 1f23512: Fix Missing Initializations From Copy in MSTSLocomotive
18 parents ce56f6e + 0a17d98 + 3539862 + d00beb9 + f92de76 + 3ca0eb1 + 42092cb + 6c0785b + 1f5ba4c + 5866028 + 29f3d1a + f7b85e4 + 26cc6a8 + e0f3c55 + 6c2c3cd + e3b1688 + cf687d4 + 1f23512 commit 080e38c

File tree

1 file changed

+32
-50
lines changed

1 file changed

+32
-50
lines changed

Source/Menu/Notifications/NotificationManager.cs

Lines changed: 32 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ public Notifications GetNotifications()
8989
}
9090

9191
/// <summary>
92-
/// Fetch the Notifications from https://static.openrails.org/notifications/notifications.json
92+
/// Fetch the Notifications from https://static.openrails.org/notifications/menu.json
9393
/// </summary>
9494
private string GetRemoteJson()
9595
{
@@ -101,7 +101,7 @@ private string GetRemoteJson()
101101
// Helpful to supply server with data for its log file.
102102
client.Headers[HttpRequestHeader.UserAgent] = $"{System.Windows.Forms.Application.ProductName}/{VersionInfo.VersionOrBuild}";
103103

104-
return client.DownloadString(new Uri("https://wepp.co.uk/openrails/notifications.json"));
104+
return client.DownloadString(new Uri("https://wepp.co.uk/openrails/notifications/menu.json"));
105105
}
106106

107107
public void PopulatePageList()
@@ -241,27 +241,7 @@ private Check CheckExcludes(Check check)
241241
{
242242
if (c is Contains)
243243
{
244-
switch (c.Name)
245-
{
246-
case "direct3d":
247-
if (SystemInfo.Direct3DFeatureLevels.Contains(c.Value, StringComparer.OrdinalIgnoreCase))
248-
return check;
249-
break;
250-
case "installed_version":
251-
if (SystemInfo.Application.Version.IndexOf(c.Value, StringComparison.OrdinalIgnoreCase) > -1)
252-
return check;
253-
break;
254-
case "already updated": // ReplaceParameter() changed {{new_version}} to "already updated"
255-
break;
256-
case "system":
257-
var os = SystemInfo.OperatingSystem;
258-
var system = $"{os.Name} {os.Version} {os.Architecture} {os.Language} {os.Languages ?? new string[0]}";
259-
if (system.IndexOf(c.Value, StringComparison.OrdinalIgnoreCase) > -1)
260-
return check;
261-
break;
262-
default: // Any check that is not recognised fails.
263-
return check;
264-
}
244+
CheckContains(check, c);
265245
}
266246
}
267247
return null;
@@ -279,28 +259,32 @@ private Check CheckIncludes(Check check)
279259

280260
foreach (var c in check.IncludesAnyOf)
281261
{
282-
if (c is Contains)
283-
{
284-
switch (c.Name)
285-
{
286-
case "direct3d":
287-
if (SystemInfo.Direct3DFeatureLevels.Contains(c.Value, StringComparer.OrdinalIgnoreCase))
288-
return check;
289-
break;
290-
case "installed_version":
291-
if (SystemInfo.Application.Version.IndexOf(c.Value, StringComparison.OrdinalIgnoreCase) > -1)
292-
return check;
293-
break;
294-
case "system":
295-
var os = SystemInfo.OperatingSystem;
296-
var system = $"{os.Name} {os.Version} {os.Architecture} {os.Language} {os.Languages ?? new string[0]}";
297-
if (system.IndexOf(c.Value, StringComparison.OrdinalIgnoreCase) > -1)
298-
return check;
299-
break;
300-
default: // Any check that is not recognised fails.
301-
return null;
302-
}
303-
}
262+
CheckContains(check, c);
263+
}
264+
return null;
265+
}
266+
267+
private Check CheckContains(Check check, Criteria c)
268+
{
269+
switch (c.Name)
270+
{
271+
case "direct3d":
272+
if (SystemInfo.Direct3DFeatureLevels.Contains(c.Value, StringComparer.OrdinalIgnoreCase))
273+
return check;
274+
break;
275+
case "installed_version":
276+
if (c.Value == "none" // as Update Mode == "none"
277+
|| SystemInfo.Application.Version.IndexOf(c.Value, StringComparison.OrdinalIgnoreCase) > -1)
278+
return check;
279+
break;
280+
case "system":
281+
var os = SystemInfo.OperatingSystem;
282+
var system = $"{os.Name} {os.Version} {os.Architecture} {os.Language} {os.Languages ?? new string[0]}";
283+
if (system.IndexOf(c.Value, StringComparison.OrdinalIgnoreCase) > -1)
284+
return check;
285+
break;
286+
default: // Any check that is not recognised succeeds.
287+
return null;
304288
}
305289
return null;
306290
}
@@ -379,13 +363,11 @@ private string ReplaceParameter(string field)
379363
? "none"
380364
: UpdateManager.ChannelName;
381365
break;
382-
case "new_version":
366+
case "latest_version":
383367
replacement = UpdateManager.LastUpdate == null
384368
|| UpdateManager.ChannelName == ""
385-
? "not available"
386-
: UpdateManager.LastUpdate.Version == SystemInfo.Application.Version
387-
? "already updated"
388-
: UpdateManager.LastUpdate.Version;
369+
? "none"
370+
: UpdateManager.LastUpdate.Version;
389371
break;
390372
case "release_date":
391373
replacement = UpdateManager.LastUpdate == null

0 commit comments

Comments
 (0)