From 2e03cb0916f69b324fe654f92f1642b21eb92005 Mon Sep 17 00:00:00 2001 From: LukePulverenti Luke Pulverenti luke pulverenti Date: Sat, 14 Jul 2012 16:45:11 -0400 Subject: Improved loading performance even more by switching from XmlDocument to XmlReader. Also added more api improvements. --- MediaBrowser.HtmlBrowser/Plugin.cs | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'MediaBrowser.HtmlBrowser/Plugin.cs') diff --git a/MediaBrowser.HtmlBrowser/Plugin.cs b/MediaBrowser.HtmlBrowser/Plugin.cs index 47277797f..1599881d0 100644 --- a/MediaBrowser.HtmlBrowser/Plugin.cs +++ b/MediaBrowser.HtmlBrowser/Plugin.cs @@ -3,6 +3,7 @@ using System.Reactive.Linq; using MediaBrowser.Common.Net.Handlers; using MediaBrowser.Common.Plugins; using MediaBrowser.Controller; +using MediaBrowser.HtmlBrowser.Handlers; namespace MediaBrowser.HtmlBrowser { @@ -12,11 +13,18 @@ namespace MediaBrowser.HtmlBrowser { var httpServer = Kernel.Instance.HttpServer; - /*httpServer.Where(ctx => ctx.Request.Url.LocalPath.EndsWith("/browser/index.html", StringComparison.OrdinalIgnoreCase)).Subscribe(ctx => ctx.Respond(new EmbeddedResourceHandler(ctx, "MediaBrowser.HtmlBrowser.Html.index.html"))); + httpServer.Where(ctx => ctx.LocalPath.IndexOf("/browser/", StringComparison.OrdinalIgnoreCase) != -1).Subscribe(ctx => + { + string localPath = ctx.LocalPath; + string srch = "/browser/"; - httpServer.Where(ctx => ctx.Request.Url.LocalPath.EndsWith("/browser/resource", StringComparison.OrdinalIgnoreCase)).Subscribe(ctx => ctx.Respond(new EmbeddedResourceHandler(ctx))); + int index = localPath.IndexOf(srch, StringComparison.OrdinalIgnoreCase); - httpServer.Where(ctx => ctx.Request.Url.LocalPath.EndsWith("/browser/favicon.ico", StringComparison.OrdinalIgnoreCase)).Subscribe(ctx => ctx.Respond(new EmbeddedResourceHandler(ctx, "MediaBrowser.HtmlBrowser.Html.css.images.favicon.ico")));*/ + string resource = localPath.Substring(index + srch.Length); + + ctx.Respond(new EmbeddedResourceHandler(ctx, resource)); + + }); } } } -- cgit v1.2.3