diff options
| author | Luke Pulverenti <luke.pulverenti@gmail.com> | 2014-06-29 15:59:52 -0400 |
|---|---|---|
| committer | Luke Pulverenti <luke.pulverenti@gmail.com> | 2014-06-29 15:59:52 -0400 |
| commit | 1a5a75854bd3ec4cdd771c9afdaefe0acb62c03c (patch) | |
| tree | 1479a46b06ca7e3a22f4c1646e6a65aa533e2f33 /MediaBrowser.Model/Dlna/ConditionProcessor.cs | |
| parent | b87f759460490792b7ceaf0513ab0d87a869e73b (diff) | |
update translations
Diffstat (limited to 'MediaBrowser.Model/Dlna/ConditionProcessor.cs')
| -rw-r--r-- | MediaBrowser.Model/Dlna/ConditionProcessor.cs | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/MediaBrowser.Model/Dlna/ConditionProcessor.cs b/MediaBrowser.Model/Dlna/ConditionProcessor.cs index 66c3e0b19..89b844ae5 100644 --- a/MediaBrowser.Model/Dlna/ConditionProcessor.cs +++ b/MediaBrowser.Model/Dlna/ConditionProcessor.cs @@ -175,6 +175,35 @@ namespace MediaBrowser.Model.Dlna return false; } + + private bool IsConditionSatisfied(ProfileCondition condition, float? currentValue) + { + if (!currentValue.HasValue) + { + // If the value is unknown, it satisfies if not marked as required + return !condition.IsRequired; + } + + float expected; + if (FloatHelper.TryParseCultureInvariant(condition.Value, out expected)) + { + switch (condition.Condition) + { + case ProfileConditionType.Equals: + return currentValue.Value.Equals(expected); + case ProfileConditionType.GreaterThanEqual: + return currentValue.Value >= expected; + case ProfileConditionType.LessThanEqual: + return currentValue.Value <= expected; + case ProfileConditionType.NotEquals: + return !currentValue.Value.Equals(expected); + default: + throw new InvalidOperationException("Unexpected ProfileConditionType"); + } + } + + return false; + } private bool IsConditionSatisfied(ProfileCondition condition, double? currentValue) { |
