mirror of
https://github.com/Jackett/Jackett
synced 2025-01-02 21:26:08 +00:00
Cardigann template: add if support for collections
This commit is contained in:
parent
8499d06a14
commit
55ce1394c6
1 changed files with 12 additions and 2 deletions
|
@ -20,6 +20,7 @@ using System.Linq;
|
|||
using System.Net;
|
||||
using Microsoft.AspNetCore.WebUtilities;
|
||||
using Jacket.Common.Helpers;
|
||||
using System.Collections;
|
||||
|
||||
namespace Jackett.Indexers
|
||||
{
|
||||
|
@ -262,8 +263,17 @@ namespace Jackett.Indexers
|
|||
|
||||
if (condition.StartsWith("."))
|
||||
{
|
||||
string value = (string)variables[condition];
|
||||
if (!string.IsNullOrWhiteSpace(value))
|
||||
var conditionResultState = false;
|
||||
var value = variables[condition];
|
||||
|
||||
if (value is string)
|
||||
conditionResultState = !string.IsNullOrWhiteSpace((string)value);
|
||||
else if(value is ICollection)
|
||||
conditionResultState = ((ICollection)value).Count > 0;
|
||||
else
|
||||
throw new Exception(string.Format("Unexpceted type for variable {0}: {1}", condition, value.GetType()));
|
||||
|
||||
if (conditionResultState)
|
||||
{
|
||||
conditionResult = onTrue;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue