2
0

FlagParser.cs 906 B

12345678910111213141516171819202122232425262728293031323334353637
  1. #pragma warning disable CS1591
  2. using System;
  3. using System.IO;
  4. using Emby.Naming.Common;
  5. namespace Emby.Naming.Video
  6. {
  7. public class FlagParser
  8. {
  9. private readonly NamingOptions _options;
  10. public FlagParser(NamingOptions options)
  11. {
  12. _options = options;
  13. }
  14. public string[] GetFlags(string path)
  15. {
  16. return GetFlags(path, _options.VideoFlagDelimiters);
  17. }
  18. public string[] GetFlags(string path, char[] delimeters)
  19. {
  20. if (string.IsNullOrEmpty(path))
  21. {
  22. throw new ArgumentNullException(nameof(path));
  23. }
  24. // Note: the tags need be be surrounded be either a space ( ), hyphen -, dot . or underscore _.
  25. var file = Path.GetFileName(path);
  26. return file.Split(delimeters, StringSplitOptions.RemoveEmptyEntries);
  27. }
  28. }
  29. }