mirror of
https://github.com/jellyfin/jellyfin.git
synced 2024-09-06 19:37:55 +02:00
28 lines
789 B
C#
28 lines
789 B
C#
using System.IO;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace MediaBrowser.Common.Net.Handlers
|
|
{
|
|
public abstract class BaseEmbeddedResourceHandler : BaseHandler
|
|
{
|
|
public BaseEmbeddedResourceHandler(string resourcePath)
|
|
: base()
|
|
{
|
|
ResourcePath = resourcePath;
|
|
}
|
|
|
|
protected string ResourcePath { get; set; }
|
|
|
|
public override Task<string> GetContentType()
|
|
{
|
|
return Task.FromResult<string>(MimeTypes.GetMimeType(ResourcePath));
|
|
}
|
|
|
|
protected override Task WriteResponseToOutputStream(Stream stream)
|
|
{
|
|
return GetEmbeddedResourceStream().CopyToAsync(stream);
|
|
}
|
|
|
|
protected abstract Stream GetEmbeddedResourceStream();
|
|
}
|
|
}
|