move string.Replace extension
This commit is contained in:
parent
a8da86d059
commit
d26707708d
|
@ -1,4 +1,4 @@
|
||||||
using MediaBrowser.Common.Configuration;
|
using MediaBrowser.Model.Extensions;
|
||||||
using MediaBrowser.Common.Extensions;
|
using MediaBrowser.Common.Extensions;
|
||||||
using MediaBrowser.Common.IO;
|
using MediaBrowser.Common.IO;
|
||||||
using MediaBrowser.Controller.Channels;
|
using MediaBrowser.Controller.Channels;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
using MediaBrowser.Common.Extensions;
|
using MediaBrowser.Model.Extensions;
|
||||||
using MediaBrowser.Common.IO;
|
using MediaBrowser.Common.IO;
|
||||||
using MediaBrowser.Common.Net;
|
using MediaBrowser.Common.Net;
|
||||||
using MediaBrowser.Controller.Channels;
|
using MediaBrowser.Controller.Channels;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
using MediaBrowser.Common.Extensions;
|
using MediaBrowser.Model.Extensions;
|
||||||
using MediaBrowser.Common.IO;
|
using MediaBrowser.Common.IO;
|
||||||
using MediaBrowser.Common.Net;
|
using MediaBrowser.Common.Net;
|
||||||
using MediaBrowser.Controller.Channels;
|
using MediaBrowser.Controller.Channels;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
using MediaBrowser.Common.Extensions;
|
using MediaBrowser.Model.Extensions;
|
||||||
using MediaBrowser.Common.IO;
|
using MediaBrowser.Common.IO;
|
||||||
using MediaBrowser.Model.Logging;
|
using MediaBrowser.Model.Logging;
|
||||||
using System;
|
using System;
|
||||||
|
|
|
@ -26,36 +26,6 @@ namespace MediaBrowser.Common.Extensions
|
||||||
return Regex.Replace(htmlString, pattern, string.Empty).Trim();
|
return Regex.Replace(htmlString, pattern, string.Empty).Trim();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Replaces the specified STR.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="str">The STR.</param>
|
|
||||||
/// <param name="oldValue">The old value.</param>
|
|
||||||
/// <param name="newValue">The new value.</param>
|
|
||||||
/// <param name="comparison">The comparison.</param>
|
|
||||||
/// <returns>System.String.</returns>
|
|
||||||
public static string Replace(this string str, string oldValue, string newValue, StringComparison comparison)
|
|
||||||
{
|
|
||||||
var sb = new StringBuilder();
|
|
||||||
|
|
||||||
var previousIndex = 0;
|
|
||||||
var index = str.IndexOf(oldValue, comparison);
|
|
||||||
|
|
||||||
while (index != -1)
|
|
||||||
{
|
|
||||||
sb.Append(str.Substring(previousIndex, index - previousIndex));
|
|
||||||
sb.Append(newValue);
|
|
||||||
index += oldValue.Length;
|
|
||||||
|
|
||||||
previousIndex = index;
|
|
||||||
index = str.IndexOf(oldValue, index, comparison);
|
|
||||||
}
|
|
||||||
|
|
||||||
sb.Append(str.Substring(previousIndex));
|
|
||||||
|
|
||||||
return sb.ToString();
|
|
||||||
}
|
|
||||||
|
|
||||||
public static string RemoveDiacritics(this string text)
|
public static string RemoveDiacritics(this string text)
|
||||||
{
|
{
|
||||||
return String.Concat(
|
return String.Concat(
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
using MediaBrowser.Common.Extensions;
|
using MediaBrowser.Model.Extensions;
|
||||||
using MediaBrowser.Controller.Channels;
|
using MediaBrowser.Controller.Channels;
|
||||||
using MediaBrowser.Controller.Drawing;
|
using MediaBrowser.Controller.Drawing;
|
||||||
using MediaBrowser.Controller.Entities;
|
using MediaBrowser.Controller.Entities;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
using MediaBrowser.Common.Extensions;
|
using MediaBrowser.Model.Extensions;
|
||||||
using MediaBrowser.Model.Logging;
|
using MediaBrowser.Model.Logging;
|
||||||
using System;
|
using System;
|
||||||
using System.Globalization;
|
using System.Globalization;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
using MediaBrowser.Common.Extensions;
|
using MediaBrowser.Model.Extensions;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Globalization;
|
using System.Globalization;
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
using System;
|
using MediaBrowser.Model.Extensions;
|
||||||
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Globalization;
|
using System.Globalization;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using MediaBrowser.Common.Extensions;
|
|
||||||
|
|
||||||
namespace MediaBrowser.MediaEncoding.Subtitles
|
namespace MediaBrowser.MediaEncoding.Subtitles
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
using MediaBrowser.Common.Extensions;
|
using MediaBrowser.Model.Extensions;
|
||||||
using System;
|
using System;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Globalization;
|
using System.Globalization;
|
||||||
|
using System.Text;
|
||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
|
|
||||||
namespace MediaBrowser.Model.Extensions
|
namespace MediaBrowser.Model.Extensions
|
||||||
|
@ -94,5 +95,35 @@ namespace MediaBrowser.Model.Extensions
|
||||||
{
|
{
|
||||||
return new Regex(term).Split(str, limit);
|
return new Regex(term).Split(str, limit);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Replaces the specified STR.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="str">The STR.</param>
|
||||||
|
/// <param name="oldValue">The old value.</param>
|
||||||
|
/// <param name="newValue">The new value.</param>
|
||||||
|
/// <param name="comparison">The comparison.</param>
|
||||||
|
/// <returns>System.String.</returns>
|
||||||
|
public static string Replace(this string str, string oldValue, string newValue, StringComparison comparison)
|
||||||
|
{
|
||||||
|
var sb = new StringBuilder();
|
||||||
|
|
||||||
|
var previousIndex = 0;
|
||||||
|
var index = str.IndexOf(oldValue, comparison);
|
||||||
|
|
||||||
|
while (index != -1)
|
||||||
|
{
|
||||||
|
sb.Append(str.Substring(previousIndex, index - previousIndex));
|
||||||
|
sb.Append(newValue);
|
||||||
|
index += oldValue.Length;
|
||||||
|
|
||||||
|
previousIndex = index;
|
||||||
|
index = str.IndexOf(oldValue, index, comparison);
|
||||||
|
}
|
||||||
|
|
||||||
|
sb.Append(str.Substring(previousIndex));
|
||||||
|
|
||||||
|
return sb.ToString();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
using MediaBrowser.Common.Configuration;
|
using MediaBrowser.Common.Configuration;
|
||||||
using MediaBrowser.Common.Extensions;
|
using MediaBrowser.Model.Extensions;
|
||||||
using MediaBrowser.Controller.Entities;
|
using MediaBrowser.Controller.Entities;
|
||||||
using MediaBrowser.Controller.Entities.Audio;
|
using MediaBrowser.Controller.Entities.Audio;
|
||||||
using MediaBrowser.Controller.Library;
|
using MediaBrowser.Controller.Library;
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
using DvdLib.Ifo;
|
using DvdLib.Ifo;
|
||||||
using MediaBrowser.Common.Configuration;
|
using MediaBrowser.Common.Configuration;
|
||||||
using MediaBrowser.Common.Extensions;
|
using MediaBrowser.Model.Extensions;
|
||||||
using MediaBrowser.Common.IO;
|
using MediaBrowser.Common.IO;
|
||||||
using MediaBrowser.Controller.Chapters;
|
using MediaBrowser.Controller.Chapters;
|
||||||
using MediaBrowser.Controller.Configuration;
|
using MediaBrowser.Controller.Configuration;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
using MediaBrowser.Common.Extensions;
|
using MediaBrowser.Model.Extensions;
|
||||||
using MediaBrowser.Common.IO;
|
using MediaBrowser.Common.IO;
|
||||||
using MediaBrowser.Controller.Entities;
|
using MediaBrowser.Controller.Entities;
|
||||||
using MediaBrowser.Controller.Localization;
|
using MediaBrowser.Controller.Localization;
|
||||||
|
|
|
@ -11,6 +11,7 @@ using MediaBrowser.Controller.Providers;
|
||||||
using MediaBrowser.Model.Channels;
|
using MediaBrowser.Model.Channels;
|
||||||
using MediaBrowser.Model.Dto;
|
using MediaBrowser.Model.Dto;
|
||||||
using MediaBrowser.Model.Entities;
|
using MediaBrowser.Model.Entities;
|
||||||
|
using MediaBrowser.Model.Extensions;
|
||||||
using MediaBrowser.Model.Logging;
|
using MediaBrowser.Model.Logging;
|
||||||
using MediaBrowser.Model.MediaInfo;
|
using MediaBrowser.Model.MediaInfo;
|
||||||
using MediaBrowser.Model.Net;
|
using MediaBrowser.Model.Net;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
using MediaBrowser.Common.Extensions;
|
using MediaBrowser.Model.Extensions;
|
||||||
using MediaBrowser.Controller.Entities;
|
using MediaBrowser.Controller.Entities;
|
||||||
using System;
|
using System;
|
||||||
using System.Globalization;
|
using System.Globalization;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
using MediaBrowser.Common.Extensions;
|
using MediaBrowser.Model.Extensions;
|
||||||
using MediaBrowser.Common.IO;
|
using MediaBrowser.Common.IO;
|
||||||
using MediaBrowser.Controller.Entities;
|
using MediaBrowser.Controller.Entities;
|
||||||
using MediaBrowser.Controller.Library;
|
using MediaBrowser.Controller.Library;
|
||||||
|
|
|
@ -1,18 +1,18 @@
|
||||||
using MediaBrowser.Common.Extensions;
|
using MediaBrowser.Controller.Entities;
|
||||||
using MediaBrowser.Controller.Entities;
|
|
||||||
using MediaBrowser.Controller.Entities.Movies;
|
using MediaBrowser.Controller.Entities.Movies;
|
||||||
using MediaBrowser.Controller.Entities.TV;
|
using MediaBrowser.Controller.Entities.TV;
|
||||||
using MediaBrowser.Controller.Library;
|
using MediaBrowser.Controller.Library;
|
||||||
using MediaBrowser.Controller.Providers;
|
using MediaBrowser.Controller.Providers;
|
||||||
using MediaBrowser.Controller.Resolvers;
|
using MediaBrowser.Controller.Resolvers;
|
||||||
using MediaBrowser.Model.Entities;
|
using MediaBrowser.Model.Entities;
|
||||||
|
using MediaBrowser.Model.Extensions;
|
||||||
using MediaBrowser.Naming.IO;
|
using MediaBrowser.Naming.IO;
|
||||||
using MediaBrowser.Naming.Video;
|
using MediaBrowser.Naming.Video;
|
||||||
|
using MediaBrowser.Server.Implementations.Logging;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using MediaBrowser.Server.Implementations.Logging;
|
|
||||||
|
|
||||||
namespace MediaBrowser.Server.Implementations.Library.Resolvers.Movies
|
namespace MediaBrowser.Server.Implementations.Library.Resolvers.Movies
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
using MediaBrowser.Common.Extensions;
|
using MediaBrowser.Model.Extensions;
|
||||||
using MediaBrowser.Common.IO;
|
using MediaBrowser.Common.IO;
|
||||||
using MediaBrowser.Controller.Configuration;
|
using MediaBrowser.Controller.Configuration;
|
||||||
using MediaBrowser.Controller.Localization;
|
using MediaBrowser.Controller.Localization;
|
||||||
|
|
|
@ -11,6 +11,7 @@ using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
using MediaBrowser.Model.Extensions;
|
||||||
|
|
||||||
namespace MediaBrowser.Server.Implementations.Notifications
|
namespace MediaBrowser.Server.Implementations.Notifications
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,12 +1,11 @@
|
||||||
using System.Globalization;
|
using MediaBrowser.Common.Extensions;
|
||||||
using MediaBrowser.Common.Extensions;
|
|
||||||
using MediaBrowser.Common.IO;
|
using MediaBrowser.Common.IO;
|
||||||
using MediaBrowser.Common.Net;
|
|
||||||
using MediaBrowser.Controller;
|
using MediaBrowser.Controller;
|
||||||
using MediaBrowser.Controller.Configuration;
|
using MediaBrowser.Controller.Configuration;
|
||||||
using MediaBrowser.Controller.Localization;
|
using MediaBrowser.Controller.Localization;
|
||||||
using MediaBrowser.Controller.Net;
|
using MediaBrowser.Controller.Net;
|
||||||
using MediaBrowser.Controller.Plugins;
|
using MediaBrowser.Controller.Plugins;
|
||||||
|
using MediaBrowser.Model.Extensions;
|
||||||
using MediaBrowser.Model.Logging;
|
using MediaBrowser.Model.Logging;
|
||||||
using MediaBrowser.Model.Net;
|
using MediaBrowser.Model.Net;
|
||||||
using MediaBrowser.Model.Serialization;
|
using MediaBrowser.Model.Serialization;
|
||||||
|
@ -14,6 +13,7 @@ using ServiceStack;
|
||||||
using ServiceStack.Web;
|
using ServiceStack.Web;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Globalization;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
using MediaBrowser.Common.Configuration;
|
using MediaBrowser.Common.Configuration;
|
||||||
using MediaBrowser.Common.Extensions;
|
using MediaBrowser.Model.Extensions;
|
||||||
using MediaBrowser.Controller.Entities;
|
using MediaBrowser.Controller.Entities;
|
||||||
using MediaBrowser.Model.Entities;
|
using MediaBrowser.Model.Entities;
|
||||||
using MediaBrowser.Model.Logging;
|
using MediaBrowser.Model.Logging;
|
||||||
|
|
|
@ -19,6 +19,7 @@ using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Xml;
|
using System.Xml;
|
||||||
|
using MediaBrowser.Model.Extensions;
|
||||||
|
|
||||||
namespace MediaBrowser.XbmcMetadata.Savers
|
namespace MediaBrowser.XbmcMetadata.Savers
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue
Block a user