Filter.cs 907 B

1234567891011121314151617181920212223242526272829303132333435
  1. using MediaBrowser.Model.Extensions;
  2. using System;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. namespace Emby.Dlna.Didl
  6. {
  7. public class Filter
  8. {
  9. private readonly List<string> _fields;
  10. private readonly bool _all;
  11. public Filter()
  12. : this("*")
  13. {
  14. }
  15. public Filter(string filter)
  16. {
  17. _all = StringHelper.EqualsIgnoreCase(filter, "*");
  18. var list = (filter ?? string.Empty).Split(new[] {','}, StringSplitOptions.RemoveEmptyEntries).ToList();
  19. _fields = list;
  20. }
  21. public bool Contains(string field)
  22. {
  23. // Don't bother with this. Some clients (media monkey) use the filter and then don't display very well when very little data comes back.
  24. return true;
  25. //return _all || ListHelper.ContainsIgnoreCase(_fields, field);
  26. }
  27. }
  28. }