From 582edde742d8c694a90fc6bd93a603245ae1358e Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Mon, 12 Aug 2013 15:13:36 -0400 Subject: [PATCH] added cancellation token to get image stream --- .../ApiClient/ApiClientExtensions.cs | 23 +++++++++++++++++++ MediaBrowser.Model/ApiClient/IApiClient.cs | 4 +++- MediaBrowser.Model/MediaBrowser.Model.csproj | 1 + 3 files changed, 27 insertions(+), 1 deletion(-) create mode 100644 MediaBrowser.Model/ApiClient/ApiClientExtensions.cs diff --git a/MediaBrowser.Model/ApiClient/ApiClientExtensions.cs b/MediaBrowser.Model/ApiClient/ApiClientExtensions.cs new file mode 100644 index 0000000000..20b707edd9 --- /dev/null +++ b/MediaBrowser.Model/ApiClient/ApiClientExtensions.cs @@ -0,0 +1,23 @@ +using System.IO; +using System.Threading; +using System.Threading.Tasks; + +namespace MediaBrowser.Model.ApiClient +{ + /// + /// Class ApiClientExtensions + /// + public static class ApiClientExtensions + { + /// + /// Gets the image stream async. + /// + /// The API client. + /// The URL. + /// Task{Stream}. + public static Task GetImageStreamAsync(this IApiClient apiClient, string url) + { + return apiClient.GetImageStreamAsync(url, CancellationToken.None); + } + } +} diff --git a/MediaBrowser.Model/ApiClient/IApiClient.cs b/MediaBrowser.Model/ApiClient/IApiClient.cs index 7180ed5bcd..02589d7ead 100644 --- a/MediaBrowser.Model/ApiClient/IApiClient.cs +++ b/MediaBrowser.Model/ApiClient/IApiClient.cs @@ -14,6 +14,7 @@ using MediaBrowser.Model.Users; using System; using System.Collections.Generic; using System.IO; +using System.Threading; using System.Threading.Tasks; namespace MediaBrowser.Model.ApiClient @@ -113,9 +114,10 @@ namespace MediaBrowser.Model.ApiClient /// Gets an image stream based on a url /// /// The URL. + /// The cancellation token. /// Task{Stream}. /// url - Task GetImageStreamAsync(string url); + Task GetImageStreamAsync(string url, CancellationToken cancellationToken); /// /// Gets a BaseItem diff --git a/MediaBrowser.Model/MediaBrowser.Model.csproj b/MediaBrowser.Model/MediaBrowser.Model.csproj index 1c4f798f49..8f1194f7ff 100644 --- a/MediaBrowser.Model/MediaBrowser.Model.csproj +++ b/MediaBrowser.Model/MediaBrowser.Model.csproj @@ -41,6 +41,7 @@ +