jellyfin-server/Emby.Naming/Video/FlagParser.cs
Bond_009 07cc4be6a7 Fix some warnings
* Add analyzers to MediaBrowser.XbmcMetadata
* Enable TreatWarningsAsErrors for MediaBrowser.XbmcMetadata
* Add analyzers to MediaBrowser.WebDashboard
* Enable TreatWarningsAsErrors for MediaBrowser.WebDashboard
* Disable SA1600 in favor of CS1591
2020-02-23 12:11:43 +01:00

38 lines
906 B
C#

#pragma warning disable CS1591
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);
}
}
}