mirror of
https://github.com/jellyfin/jellyfin.git
synced 2024-06-29 10:23:36 +02:00
Backport pull request #9351 from jellyfin/release-10.8.z
Fix EqualsAny condition check for int and double
Original-merge: e8b0ae07af
Merged-by: Bond-009 <bond.009@outlook.com>
Backported-by: crobibero <cody@robibe.ro>
This commit is contained in:
parent
ef3868ff50
commit
65090ac817
|
@ -136,12 +136,26 @@ namespace MediaBrowser.Model.Dlna
|
|||
return !condition.IsRequired;
|
||||
}
|
||||
|
||||
if (int.TryParse(condition.Value, CultureInfo.InvariantCulture, out var expected))
|
||||
var conditionType = condition.Condition;
|
||||
if (condition.Condition == ProfileConditionType.EqualsAny)
|
||||
{
|
||||
switch (condition.Condition)
|
||||
foreach (var singleConditionString in condition.Value.AsSpan().Split('|'))
|
||||
{
|
||||
if (int.TryParse(singleConditionString, NumberStyles.Integer, CultureInfo.InvariantCulture, out int conditionValue)
|
||||
&& conditionValue.Equals(currentValue))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
if (int.TryParse(condition.Value, NumberStyles.Integer, CultureInfo.InvariantCulture, out var expected))
|
||||
{
|
||||
switch (conditionType)
|
||||
{
|
||||
case ProfileConditionType.Equals:
|
||||
case ProfileConditionType.EqualsAny:
|
||||
return currentValue.Value.Equals(expected);
|
||||
case ProfileConditionType.GreaterThanEqual:
|
||||
return currentValue.Value >= expected;
|
||||
|
@ -212,9 +226,24 @@ namespace MediaBrowser.Model.Dlna
|
|||
return !condition.IsRequired;
|
||||
}
|
||||
|
||||
if (double.TryParse(condition.Value, CultureInfo.InvariantCulture, out var expected))
|
||||
var conditionType = condition.Condition;
|
||||
if (condition.Condition == ProfileConditionType.EqualsAny)
|
||||
{
|
||||
switch (condition.Condition)
|
||||
foreach (var singleConditionString in condition.Value.AsSpan().Split('|'))
|
||||
{
|
||||
if (double.TryParse(singleConditionString, NumberStyles.Float | NumberStyles.AllowThousands, CultureInfo.InvariantCulture, out double conditionValue)
|
||||
&& conditionValue.Equals(currentValue))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
if (double.TryParse(condition.Value, NumberStyles.Float | NumberStyles.AllowThousands, CultureInfo.InvariantCulture, out var expected))
|
||||
{
|
||||
switch (conditionType)
|
||||
{
|
||||
case ProfileConditionType.Equals:
|
||||
return currentValue.Value.Equals(expected);
|
||||
|
|
Loading…
Reference in a new issue