Skip to content

Commit d83e810

Browse files
committed
adds CheckNotContains()
1 parent c153b9d commit d83e810

File tree

1 file changed

+44
-0
lines changed

1 file changed

+44
-0
lines changed

Source/Menu/Notifications/NotificationManager.cs

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -319,6 +319,12 @@ private Check CheckMissingMatch(Check check, List<Criteria> criteriaList)
319319
return null;
320320
}
321321

322+
/// <summary>
323+
/// Returns the check if a match is found, else returns null
324+
/// </summary>
325+
/// <param name="check"></param>
326+
/// <param name="c"></param>
327+
/// <returns></returns>
322328
private Check CheckContains(Check check, Criteria c)
323329
{
324330
switch (c.Name)
@@ -351,6 +357,44 @@ private Check CheckContains(Check check, Criteria c)
351357
return null;
352358
}
353359

360+
/// <summary>
361+
/// Returns the check if a match is not found, else returns null
362+
/// </summary>
363+
/// <param name="check"></param>
364+
/// <param name="c"></param>
365+
/// <returns></returns>
366+
private Check CheckNotContains(Check check, Criteria c)
367+
{
368+
switch (c.Name)
369+
{
370+
case "direct3d":
371+
if (SystemInfo.Direct3DFeatureLevels.Contains(c.Value, StringComparer.OrdinalIgnoreCase) == false)
372+
return check;
373+
break;
374+
case "installed_version":
375+
if (SystemInfo.Application.Version.IndexOf(c.Value, StringComparison.OrdinalIgnoreCase) > -1 == false)
376+
return check;
377+
break;
378+
case "system":
379+
var os = SystemInfo.OperatingSystem;
380+
var system = $"{os.Name} {os.Version} {os.Architecture} {os.Language} {os.Languages ?? new string[0]}";
381+
if (system.IndexOf(c.Value, StringComparison.OrdinalIgnoreCase) > -1 == false)
382+
return check;
383+
break;
384+
default:
385+
if (GetSetting(c.Name).IndexOf(c.Value, StringComparison.OrdinalIgnoreCase) > -1 == false)
386+
{
387+
return check;
388+
}
389+
if (c.Name.IndexOf(c.Value, StringComparison.OrdinalIgnoreCase) > -1 == false)
390+
{
391+
return check;
392+
}
393+
return null; // Any check that is not recognised is skipped.
394+
}
395+
return null;
396+
}
397+
354398
/// <summary>
355399
/// Gets the property value of a UserSetting. The setting must match case as in "Setting.SimpleControlPhysics".
356400
/// </summary>

0 commit comments

Comments
 (0)