aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.Model
diff options
context:
space:
mode:
Diffstat (limited to 'MediaBrowser.Model')
-rw-r--r--MediaBrowser.Model/Dlna/SearchCriteria.cs31
1 files changed, 7 insertions, 24 deletions
diff --git a/MediaBrowser.Model/Dlna/SearchCriteria.cs b/MediaBrowser.Model/Dlna/SearchCriteria.cs
index 77d6a55ea..6f4a692c8 100644
--- a/MediaBrowser.Model/Dlna/SearchCriteria.cs
+++ b/MediaBrowser.Model/Dlna/SearchCriteria.cs
@@ -5,7 +5,7 @@ using System.Text.RegularExpressions;
namespace MediaBrowser.Model.Dlna
{
- public class SearchCriteria
+ public partial class SearchCriteria
{
public SearchCriteria(string search)
{
@@ -13,10 +13,10 @@ namespace MediaBrowser.Model.Dlna
SearchType = SearchType.Unknown;
- string[] factors = RegexSplit(search, "(and|or)");
+ string[] factors = AndOrRegex().Split(search);
foreach (string factor in factors)
{
- string[] subFactors = RegexSplit(factor.Trim().Trim('(').Trim(')').Trim(), "\\s", 3);
+ string[] subFactors = WhiteSpaceRegex().Split(factor.Trim().Trim('(').Trim(')').Trim(), 3);
if (subFactors.Length == 3)
{
@@ -46,27 +46,10 @@ namespace MediaBrowser.Model.Dlna
public SearchType SearchType { get; set; }
- /// <summary>
- /// Splits the specified string.
- /// </summary>
- /// <param name="str">The string.</param>
- /// <param name="term">The term.</param>
- /// <param name="limit">The limit.</param>
- /// <returns>System.String[].</returns>
- private static string[] RegexSplit(string str, string term, int limit)
- {
- return new Regex(term).Split(str, limit);
- }
+ [GeneratedRegex("\\s")]
+ private static partial Regex WhiteSpaceRegex();
- /// <summary>
- /// Splits the specified string.
- /// </summary>
- /// <param name="str">The string.</param>
- /// <param name="term">The term.</param>
- /// <returns>System.String[].</returns>
- private static string[] RegexSplit(string str, string term)
- {
- return Regex.Split(str, term, RegexOptions.IgnoreCase);
- }
+ [GeneratedRegex("(and|or)", RegexOptions.IgnoreCase)]
+ private static partial Regex AndOrRegex();
}
}