From e206725b734f9a6226faa78ff2d0ecd2f551acc1 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Thu, 13 Oct 2016 17:13:30 -0400 Subject: [PATCH] update images --- .../BaseApplicationHost.cs | 9 ++++++- .../IO/MemoryStreamProvider.cs | 27 ++++++++++++++----- .../Library/Resolvers/TV/SeriesResolver.cs | 16 +++++------ 3 files changed, 36 insertions(+), 16 deletions(-) diff --git a/MediaBrowser.Common.Implementations/BaseApplicationHost.cs b/MediaBrowser.Common.Implementations/BaseApplicationHost.cs index 4099c9c56..e68fee829 100644 --- a/MediaBrowser.Common.Implementations/BaseApplicationHost.cs +++ b/MediaBrowser.Common.Implementations/BaseApplicationHost.cs @@ -234,7 +234,14 @@ namespace MediaBrowser.Common.Implementations JsonSerializer = CreateJsonSerializer(); - MemoryStreamProvider = new MemoryStreamProvider(); + if (Environment.OSVersion.Platform == PlatformID.Win32NT) + { + MemoryStreamProvider = new RecyclableMemoryStreamProvider(); + } + else + { + MemoryStreamProvider = new MemoryStreamProvider(); + } OnLoggerLoaded(true); LogManager.LoggerLoaded += (s, e) => OnLoggerLoaded(false); diff --git a/MediaBrowser.Common.Implementations/IO/MemoryStreamProvider.cs b/MediaBrowser.Common.Implementations/IO/MemoryStreamProvider.cs index 364055283..c42947481 100644 --- a/MediaBrowser.Common.Implementations/IO/MemoryStreamProvider.cs +++ b/MediaBrowser.Common.Implementations/IO/MemoryStreamProvider.cs @@ -1,15 +1,10 @@ -using System; -using System.Collections.Generic; -using System.IO; -using System.Linq; -using System.Text; -using System.Threading.Tasks; +using System.IO; using MediaBrowser.Common.IO; using Microsoft.IO; namespace MediaBrowser.Common.Implementations.IO { - public class MemoryStreamProvider : IMemoryStreamProvider + public class RecyclableMemoryStreamProvider : IMemoryStreamProvider { readonly RecyclableMemoryStreamManager _manager = new RecyclableMemoryStreamManager(); @@ -28,4 +23,22 @@ namespace MediaBrowser.Common.Implementations.IO return _manager.GetStream("RecyclableMemoryStream", buffer, 0, buffer.Length); } } + + public class MemoryStreamProvider : IMemoryStreamProvider + { + public MemoryStream CreateNew() + { + return new MemoryStream(); + } + + public MemoryStream CreateNew(int capacity) + { + return new MemoryStream(capacity); + } + + public MemoryStream CreateNew(byte[] buffer) + { + return new MemoryStream(buffer); + } + } } diff --git a/MediaBrowser.Server.Implementations/Library/Resolvers/TV/SeriesResolver.cs b/MediaBrowser.Server.Implementations/Library/Resolvers/TV/SeriesResolver.cs index 870e8b55a..1e480e265 100644 --- a/MediaBrowser.Server.Implementations/Library/Resolvers/TV/SeriesResolver.cs +++ b/MediaBrowser.Server.Implementations/Library/Resolvers/TV/SeriesResolver.cs @@ -62,14 +62,14 @@ namespace MediaBrowser.Server.Implementations.Library.Resolvers.TV var collectionType = args.GetCollectionType(); if (string.Equals(collectionType, CollectionType.TvShows, StringComparison.OrdinalIgnoreCase)) { - if (args.ContainsFileSystemEntryByName("tvshow.nfo")) - { - return new Series - { - Path = args.Path, - Name = Path.GetFileName(args.Path) - }; - } + //if (args.ContainsFileSystemEntryByName("tvshow.nfo")) + //{ + // return new Series + // { + // Path = args.Path, + // Name = Path.GetFileName(args.Path) + // }; + //} var configuredContentType = _libraryManager.GetConfiguredContentType(args.Path); if (!string.Equals(configuredContentType, CollectionType.TvShows, StringComparison.OrdinalIgnoreCase))