mirror of
https://github.com/jellyfin/jellyfin.git
synced 2024-11-20 04:18:51 -07:00
30 lines
682 B
C#
30 lines
682 B
C#
#pragma warning disable CS1591
|
|
|
|
using System;
|
|
|
|
namespace Emby.Dlna.Didl
|
|
{
|
|
public class Filter
|
|
{
|
|
private readonly string[] _fields;
|
|
private readonly bool _all;
|
|
|
|
public Filter()
|
|
: this("*")
|
|
{
|
|
}
|
|
|
|
public Filter(string filter)
|
|
{
|
|
_all = string.Equals(filter, "*", StringComparison.OrdinalIgnoreCase);
|
|
|
|
_fields = (filter ?? string.Empty).Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
|
|
}
|
|
|
|
public bool Contains(string field)
|
|
{
|
|
return _all || Array.Exists(_fields, x => x.Equals(field, StringComparison.OrdinalIgnoreCase));
|
|
}
|
|
}
|
|
}
|