33 lines
642 B
C#
33 lines
642 B
C#
|
using System.Reflection;
|
||
|
using System.Web;
|
||
|
|
||
|
namespace Shoko;
|
||
|
|
||
|
[Protocol("res")]
|
||
|
class ResProtoHandler : ProtoHandler
|
||
|
{
|
||
|
public ResProtoHandler(Uri url)
|
||
|
{
|
||
|
URL = url;
|
||
|
}
|
||
|
|
||
|
public override void Load()
|
||
|
{
|
||
|
var path = HttpUtility.HtmlDecode(new UriBuilder(URL).Path);
|
||
|
Status = "OK";
|
||
|
Loaded = true;
|
||
|
MediaType = "text/plain";
|
||
|
try
|
||
|
{
|
||
|
Content = Assembly.GetExecutingAssembly().GetManifestResourceStream(path);
|
||
|
}
|
||
|
catch
|
||
|
{
|
||
|
Status = "not found";
|
||
|
Loaded = false;
|
||
|
}
|
||
|
}
|
||
|
public override void Render()
|
||
|
{
|
||
|
}
|
||
|
}
|