@@ -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