From 0ffddacf11795b8a50606b6515c1dc6828ad8dd0 Mon Sep 17 00:00:00 2001 From: gnattu Date: Tue, 24 Sep 2024 12:36:05 +0800 Subject: Move GetCustomTagDelimiters to Extension --- .../Extensions/LibraryOptionsExtension.cs | 32 ++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 MediaBrowser.Model/Extensions/LibraryOptionsExtension.cs (limited to 'MediaBrowser.Model/Extensions/LibraryOptionsExtension.cs') diff --git a/MediaBrowser.Model/Extensions/LibraryOptionsExtension.cs b/MediaBrowser.Model/Extensions/LibraryOptionsExtension.cs new file mode 100644 index 000000000..4a814f22a --- /dev/null +++ b/MediaBrowser.Model/Extensions/LibraryOptionsExtension.cs @@ -0,0 +1,32 @@ +using System; +using System.Linq; +using MediaBrowser.Model.Configuration; + +namespace MediaBrowser.Model.Extensions; + +/// +/// Extensions for . +/// +public static class LibraryOptionsExtension +{ + /// + /// Get the custom tag delimiters. + /// + /// This LibraryOptions. + /// CustomTagDelimiters in char[]. + public static char[] GetCustomTagDelimiters(this LibraryOptions options) + { + ArgumentNullException.ThrowIfNull(options); + + return options.CustomTagDelimiters.Select(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).ToArray(); + } +} -- cgit v1.2.3