jellyfin/Emby.Naming/Video/FlagParser.cs
Bond_009 5a8e972952 Enable TreatWarningsAsErrors for some projects
Analyzers are only run in debug build, so setting TreatWarningsAsErrors
for release build will catch the compiler warnings until we resolve all
analyzer warnings.
2019-12-13 20:11:37 +01:00

38 lines
937 B
C#

#pragma warning disable CS1591
#pragma warning disable SA1600
using System;
using System.IO;
using Emby.Naming.Common;
namespace Emby.Naming.Video
{
public class FlagParser
{
private readonly NamingOptions _options;
public FlagParser(NamingOptions options)
{
_options = options;
}
public string[] GetFlags(string path)
{
return GetFlags(path, _options.VideoFlagDelimiters);
}
public string[] GetFlags(string path, char[] delimeters)
{
if (string.IsNullOrEmpty(path))
{
throw new ArgumentNullException(nameof(path));
}
// Note: the tags need be be surrounded be either a space ( ), hyphen -, dot . or underscore _.
var file = Path.GetFileName(path);
return file.Split(delimeters, StringSplitOptions.RemoveEmptyEntries);
}
}
}