2014-04-20 05:21:08 +00:00
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Linq;
|
2014-06-01 04:11:04 +00:00
|
|
|
|
using MediaBrowser.Model.Extensions;
|
2014-04-20 05:21:08 +00:00
|
|
|
|
|
|
|
|
|
namespace MediaBrowser.Model.Dlna
|
|
|
|
|
{
|
|
|
|
|
public class Filter
|
|
|
|
|
{
|
|
|
|
|
private readonly List<string> _fields;
|
|
|
|
|
private readonly bool _all;
|
|
|
|
|
|
2014-04-23 15:35:31 +00:00
|
|
|
|
public Filter()
|
|
|
|
|
: this("*")
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
2014-04-20 05:21:08 +00:00
|
|
|
|
public Filter(string filter)
|
|
|
|
|
{
|
2014-06-01 04:11:04 +00:00
|
|
|
|
_all = StringHelper.EqualsIgnoreCase(filter, "*");
|
2014-04-20 05:21:08 +00:00
|
|
|
|
|
2014-05-09 04:38:12 +00: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-20 05:21:08 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public bool Contains(string field)
|
|
|
|
|
{
|
|
|
|
|
return _all || _fields.Contains(field, StringComparer.OrdinalIgnoreCase);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|