From e152ecc55d4b8509bbdd60a3ca7939c3750e334b Mon Sep 17 00:00:00 2001 From: Keivan Beigi Date: Wed, 7 Aug 2013 19:07:46 -0700 Subject: [PATCH] removed RegexOptions.IgnoreCase from some expressions. supposed to be faster. --- NzbDrone.Common.Test/ServiceProviderTests.cs | 1 + NzbDrone.Common/EnsureThat/EnsureStringExtensions.cs | 4 ++-- NzbDrone.Common/StringExtensions.cs | 6 +++--- NzbDrone.Core/Indexers/BasicRssParser.cs | 6 +++--- 4 files changed, 9 insertions(+), 8 deletions(-) diff --git a/NzbDrone.Common.Test/ServiceProviderTests.cs b/NzbDrone.Common.Test/ServiceProviderTests.cs index 716cc7f0f..6888a5356 100644 --- a/NzbDrone.Common.Test/ServiceProviderTests.cs +++ b/NzbDrone.Common.Test/ServiceProviderTests.cs @@ -7,6 +7,7 @@ namespace NzbDrone.Common.Test { [TestFixture] + [Timeout(15000)] public class ServiceProviderTests : TestBase { private const string ALWAYS_INSTALLED_SERVICE = "SCardSvr"; //Smart Card diff --git a/NzbDrone.Common/EnsureThat/EnsureStringExtensions.cs b/NzbDrone.Common/EnsureThat/EnsureStringExtensions.cs index 9b803617e..9a0275894 100644 --- a/NzbDrone.Common/EnsureThat/EnsureStringExtensions.cs +++ b/NzbDrone.Common/EnsureThat/EnsureStringExtensions.cs @@ -95,8 +95,8 @@ public static Param IsRelativePath(this Param param) return param; } - private static readonly Regex windowsInvalidPathRegex = new Regex(@"[/*<>""|]", RegexOptions.Compiled | RegexOptions.IgnoreCase); - private static readonly Regex windowsPathRegex = new Regex(@"^[a-z]:\\", RegexOptions.Compiled | RegexOptions.IgnoreCase); + private static readonly Regex windowsInvalidPathRegex = new Regex(@"[/*<>""|]", RegexOptions.Compiled); + private static readonly Regex windowsPathRegex = new Regex(@"^[a-zA-Z]:\\", RegexOptions.Compiled); [DebuggerStepThrough] public static Param IsValidPath(this Param param) diff --git a/NzbDrone.Common/StringExtensions.cs b/NzbDrone.Common/StringExtensions.cs index bddd4cd77..85db4e23d 100644 --- a/NzbDrone.Common/StringExtensions.cs +++ b/NzbDrone.Common/StringExtensions.cs @@ -10,9 +10,9 @@ public static string Inject(this string format, params object[] formattingArgs) return string.Format(format, formattingArgs); } - private static readonly Regex InvalidCharRegex = new Regex(@"[^a-z0-9\s-]", RegexOptions.Compiled | RegexOptions.IgnoreCase); - private static readonly Regex InvalidSearchCharRegex = new Regex(@"[^a-z0-9\s-\.]", RegexOptions.Compiled | RegexOptions.IgnoreCase); - private static readonly Regex CollapseSpace = new Regex(@"\s+", RegexOptions.Compiled | RegexOptions.IgnoreCase); + private static readonly Regex InvalidCharRegex = new Regex(@"[^a-zA-Z0-9\s-]", RegexOptions.Compiled); + private static readonly Regex InvalidSearchCharRegex = new Regex(@"[^a-zA-Z0-9\s-\.]", RegexOptions.Compiled); + private static readonly Regex CollapseSpace = new Regex(@"\s+", RegexOptions.Compiled); public static string ToSlug(this string phrase) { diff --git a/NzbDrone.Core/Indexers/BasicRssParser.cs b/NzbDrone.Core/Indexers/BasicRssParser.cs index 0cb552830..9badc1fcc 100644 --- a/NzbDrone.Core/Indexers/BasicRssParser.cs +++ b/NzbDrone.Core/Indexers/BasicRssParser.cs @@ -112,13 +112,13 @@ public static string ParseReleaseGroup(string title) private static readonly Regex[] HeaderRegex = new[] { new Regex(@"(?:\[.+\]\-\[.+\]\-\[.+\]\-\[)(?.+)(?:\]\-.+)", - RegexOptions.IgnoreCase | RegexOptions.Compiled), + RegexOptions.IgnoreCase), new Regex(@"(?:\[.+\]\W+\[.+\]\W+\[.+\]\W+\"")(?.+)(?:\"".+)", - RegexOptions.IgnoreCase | RegexOptions.Compiled), + RegexOptions.IgnoreCase), new Regex(@"(?:\[)(?.+)(?:\]\-.+)", - RegexOptions.IgnoreCase | RegexOptions.Compiled), + RegexOptions.IgnoreCase), }; public static string ParseHeader(string header)