mirror of
https://github.com/jellyfin/jellyfin.git
synced 2024-09-06 13:57:14 -04:00
parse condition value
This commit is contained in:
parent
24246ba85f
commit
76fe96e3e3
@ -219,6 +219,15 @@ namespace MediaBrowser.Dlna.PlayTo
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Determines whether [is condition satisfied] [the specified condition].
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="condition">The condition.</param>
|
||||||
|
/// <param name="mediaPath">The media path.</param>
|
||||||
|
/// <param name="videoStream">The video stream.</param>
|
||||||
|
/// <param name="audioStream">The audio stream.</param>
|
||||||
|
/// <returns><c>true</c> if [is condition satisfied] [the specified condition]; otherwise, <c>false</c>.</returns>
|
||||||
|
/// <exception cref="System.InvalidOperationException">Unexpected ProfileConditionType</exception>
|
||||||
private bool IsConditionSatisfied(ProfileCondition condition, string mediaPath, MediaStream videoStream, MediaStream audioStream)
|
private bool IsConditionSatisfied(ProfileCondition condition, string mediaPath, MediaStream videoStream, MediaStream audioStream)
|
||||||
{
|
{
|
||||||
var actualValue = GetConditionValue(condition, mediaPath, videoStream, audioStream);
|
var actualValue = GetConditionValue(condition, mediaPath, videoStream, audioStream);
|
||||||
@ -226,7 +235,7 @@ namespace MediaBrowser.Dlna.PlayTo
|
|||||||
if (actualValue.HasValue)
|
if (actualValue.HasValue)
|
||||||
{
|
{
|
||||||
long expected;
|
long expected;
|
||||||
if (long.TryParse("", NumberStyles.Any, _usCulture, out expected))
|
if (long.TryParse(condition.Value, NumberStyles.Any, _usCulture, out expected))
|
||||||
{
|
{
|
||||||
switch (condition.Condition)
|
switch (condition.Condition)
|
||||||
{
|
{
|
||||||
@ -247,6 +256,15 @@ namespace MediaBrowser.Dlna.PlayTo
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the condition value.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="condition">The condition.</param>
|
||||||
|
/// <param name="mediaPath">The media path.</param>
|
||||||
|
/// <param name="videoStream">The video stream.</param>
|
||||||
|
/// <param name="audioStream">The audio stream.</param>
|
||||||
|
/// <returns>System.Nullable{System.Int64}.</returns>
|
||||||
|
/// <exception cref="System.InvalidOperationException">Unexpected Property</exception>
|
||||||
private long? GetConditionValue(ProfileCondition condition, string mediaPath, MediaStream videoStream, MediaStream audioStream)
|
private long? GetConditionValue(ProfileCondition condition, string mediaPath, MediaStream videoStream, MediaStream audioStream)
|
||||||
{
|
{
|
||||||
switch (condition.Property)
|
switch (condition.Property)
|
||||||
@ -270,6 +288,11 @@ namespace MediaBrowser.Dlna.PlayTo
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Converts to long.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="val">The value.</param>
|
||||||
|
/// <returns>System.Nullable{System.Int64}.</returns>
|
||||||
private long? ConvertToLong(float? val)
|
private long? ConvertToLong(float? val)
|
||||||
{
|
{
|
||||||
return val.HasValue ? Convert.ToInt64(val.Value) : (long?)null;
|
return val.HasValue ? Convert.ToInt64(val.Value) : (long?)null;
|
||||||
|
Loading…
Reference in New Issue
Block a user