You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
jellyfin/MediaBrowser.Model/Extensions/LibraryOptionsExtension.cs

35 lines
970 B

using System;
using System.Linq;
using MediaBrowser.Model.Configuration;
namespace MediaBrowser.Model.Extensions;
/// <summary>
/// Extensions for <see cref="LibraryOptions"/>.
/// </summary>
public static class LibraryOptionsExtension
{
/// <summary>
/// Get the custom tag delimiters.
/// </summary>
/// <param name="options">This LibraryOptions.</param>
/// <returns>CustomTagDelimiters in char[].</returns>
public static char[] GetCustomTagDelimiters(this LibraryOptions options)
{
ArgumentNullException.ThrowIfNull(options);
var delimiterList = options.CustomTagDelimiters.Select<string, char?>(x =>
{
var isChar = char.TryParse(x, out var c);
if (isChar)
{
return c;
}
return null;
}).Where(x => x is not null).Select(x => x!.Value).ToList();
delimiterList.Add('\0');
return delimiterList.ToArray();
}
}