jellyfin-server/MediaBrowser.Common/Net/Handlers/BaseEmbeddedResourceHandler.cs
LukePulverenti Luke Pulverenti luke pulverenti 670a53258e Some minor code cleanups
2012-09-11 14:20:12 -04:00

29 lines
784 B
C#

using System.IO;
using System.Threading.Tasks;
namespace MediaBrowser.Common.Net.Handlers
{
public abstract class BaseEmbeddedResourceHandler : BaseHandler
{
protected BaseEmbeddedResourceHandler(string resourcePath)
: base()
{
ResourcePath = resourcePath;
}
protected string ResourcePath { get; set; }
public override Task<string> GetContentType()
{
return Task.FromResult(MimeTypes.GetMimeType(ResourcePath));
}
protected override Task WriteResponseToOutputStream(Stream stream)
{
return GetEmbeddedResourceStream().CopyToAsync(stream);
}
protected abstract Stream GetEmbeddedResourceStream();
}
}