2014-06-04 19:32:40 -07:00
|
|
|
|
using MediaBrowser.Model.Extensions;
|
|
|
|
|
using System;
|
2014-04-19 22:21:08 -07:00
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
|
|
|
|
|
namespace MediaBrowser.Model.Dlna
|
|
|
|
|
{
|
|
|
|
|
public class Filter
|
|
|
|
|
{
|
|
|
|
|
private readonly List<string> _fields;
|
|
|
|
|
private readonly bool _all;
|
|
|
|
|
|
2014-04-23 08:35:31 -07:00
|
|
|
|
public Filter()
|
|
|
|
|
: this("*")
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
2014-04-19 22:21:08 -07:00
|
|
|
|
public Filter(string filter)
|
|
|
|
|
{
|
2014-05-31 21:11:04 -07:00
|
|
|
|
_all = StringHelper.EqualsIgnoreCase(filter, "*");
|
2014-04-19 22:21:08 -07:00
|
|
|
|
|
2014-05-08 21:38:12 -07:00
|
|
|
|
List<string> list = new List<string>();
|
|
|
|
|
foreach (string s in (filter ?? string.Empty).Split(new[] {','}, StringSplitOptions.RemoveEmptyEntries))
|
|
|
|
|
list.Add(s);
|
|
|
|
|
_fields = list;
|
2014-04-19 22:21:08 -07:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public bool Contains(string field)
|
|
|
|
|
{
|
2014-06-04 19:32:40 -07:00
|
|
|
|
return _all || ListHelper.ContainsIgnoreCase(_fields, field);
|
2014-04-19 22:21:08 -07:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|