From 433254c498d2e43acfd34e5c4fcee2fdcc2e767b Mon Sep 17 00:00:00 2001 From: softworkz Date: Fri, 5 Aug 2016 06:08:11 +0200 Subject: Async stream handling: Use interface instead of Func No functional changes --- .../HttpServer/AsyncStreamWriterFunc.cs | 56 ---------------------- 1 file changed, 56 deletions(-) delete mode 100644 MediaBrowser.Server.Implementations/HttpServer/AsyncStreamWriterFunc.cs (limited to 'MediaBrowser.Server.Implementations/HttpServer/AsyncStreamWriterFunc.cs') diff --git a/MediaBrowser.Server.Implementations/HttpServer/AsyncStreamWriterFunc.cs b/MediaBrowser.Server.Implementations/HttpServer/AsyncStreamWriterFunc.cs deleted file mode 100644 index 5aa01c706..000000000 --- a/MediaBrowser.Server.Implementations/HttpServer/AsyncStreamWriterFunc.cs +++ /dev/null @@ -1,56 +0,0 @@ -using System; -using System.Collections.Generic; -using System.IO; -using System.Threading.Tasks; -using ServiceStack; -using ServiceStack.Web; - -namespace MediaBrowser.Server.Implementations.HttpServer -{ - public class AsyncStreamWriterFunc : IStreamWriter, IAsyncStreamWriter, IHasOptions - { - /// - /// Gets or sets the source stream. - /// - /// The source stream. - private Func Writer { get; set; } - - /// - /// Gets the options. - /// - /// The options. - public IDictionary Options { get; private set; } - - public Action OnComplete { get; set; } - public Action OnError { get; set; } - - /// - /// Initializes a new instance of the class. - /// - public AsyncStreamWriterFunc(Func writer, IDictionary headers) - { - Writer = writer; - - if (headers == null) - { - headers = new Dictionary(StringComparer.OrdinalIgnoreCase); - } - Options = headers; - } - - /// - /// Writes to. - /// - /// The response stream. - public void WriteTo(Stream responseStream) - { - var task = Writer(responseStream); - Task.WaitAll(task); - } - - public async Task WriteToAsync(Stream responseStream) - { - await Writer(responseStream).ConfigureAwait(false); - } - } -} -- cgit v1.2.3