diff options
Diffstat (limited to 'MediaBrowser.Common.Implementations')
| -rw-r--r-- | MediaBrowser.Common.Implementations/HttpClientManager/HttpClientManager.cs | 12 | ||||
| -rw-r--r-- | MediaBrowser.Common.Implementations/IO/CommonFileSystem.cs | 32 |
2 files changed, 40 insertions, 4 deletions
diff --git a/MediaBrowser.Common.Implementations/HttpClientManager/HttpClientManager.cs b/MediaBrowser.Common.Implementations/HttpClientManager/HttpClientManager.cs index a49a0a0db..c29924c35 100644 --- a/MediaBrowser.Common.Implementations/HttpClientManager/HttpClientManager.cs +++ b/MediaBrowser.Common.Implementations/HttpClientManager/HttpClientManager.cs @@ -292,7 +292,9 @@ namespace MediaBrowser.Common.Implementations.HttpClientManager StatusCode = httpResponse.StatusCode, - ContentType = httpResponse.ContentType + ContentType = httpResponse.ContentType, + + Headers = httpResponse.Headers }; } @@ -318,7 +320,9 @@ namespace MediaBrowser.Common.Implementations.HttpClientManager StatusCode = httpResponse.StatusCode, - ContentType = httpResponse.ContentType + ContentType = httpResponse.ContentType, + + Headers = httpResponse.Headers }; } } @@ -495,7 +499,9 @@ namespace MediaBrowser.Common.Implementations.HttpClientManager StatusCode = httpResponse.StatusCode, - ContentType = httpResponse.ContentType + ContentType = httpResponse.ContentType, + + Headers = httpResponse.Headers }; } } diff --git a/MediaBrowser.Common.Implementations/IO/CommonFileSystem.cs b/MediaBrowser.Common.Implementations/IO/CommonFileSystem.cs index 3e02d96f6..98e81981d 100644 --- a/MediaBrowser.Common.Implementations/IO/CommonFileSystem.cs +++ b/MediaBrowser.Common.Implementations/IO/CommonFileSystem.cs @@ -1,4 +1,5 @@ -using MediaBrowser.Common.IO; +using MediaBrowser.Common.Extensions; +using MediaBrowser.Common.IO; using MediaBrowser.Model.Logging; using System; using System.IO; @@ -332,5 +333,34 @@ namespace MediaBrowser.Common.Implementations.IO return path.TrimEnd(Path.DirectorySeparatorChar); } + + public string SubstitutePath(string path, string from, string to) + { + if (string.IsNullOrWhiteSpace(path)) + { + throw new ArgumentNullException("path"); + } + if (string.IsNullOrWhiteSpace(from)) + { + throw new ArgumentNullException("from"); + } + if (string.IsNullOrWhiteSpace(to)) + { + throw new ArgumentNullException("to"); + } + + path = path.Replace(from, to, StringComparison.OrdinalIgnoreCase); + + if (to.IndexOf('/') != -1) + { + path = path.Replace('\\', '/'); + } + else + { + path = path.Replace('/', '\\'); + } + + return path; + } } } |
