From d327095b4b02fad69472921c98db0fb493fc9061 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Wed, 10 Apr 2013 13:11:23 -0400 Subject: [PATCH] more dashboard code consolidation --- .../Api/DashboardService.cs | 42 +------------------ 1 file changed, 1 insertion(+), 41 deletions(-) diff --git a/MediaBrowser.WebDashboard/Api/DashboardService.cs b/MediaBrowser.WebDashboard/Api/DashboardService.cs index 32c258961b..5fb88c4fec 100644 --- a/MediaBrowser.WebDashboard/Api/DashboardService.cs +++ b/MediaBrowser.WebDashboard/Api/DashboardService.cs @@ -131,6 +131,7 @@ namespace MediaBrowser.WebDashboard.Api /// The user manager. /// The app host. /// The library manager. + /// The server configuration manager. public DashboardService(ITaskManager taskManager, IUserManager userManager, IServerApplicationHost appHost, ILibraryManager libraryManager, IServerConfigurationManager serverConfigurationManager) { _taskManager = taskManager; @@ -320,47 +321,6 @@ namespace MediaBrowser.WebDashboard.Api private Stream GetRawResourceStream(string path) { return new FileStream(GetDashboardResourcePath(path), FileMode.Open, FileAccess.Read, FileShare.ReadWrite, StreamDefaults.DefaultFileStreamBufferSize, true); - - // This code is used when the files are embedded resources - //return GetType().Assembly.GetManifestResourceStream("MediaBrowser.WebDashboard.Html." + ConvertUrlToResourcePath(path)); - } - - /// - /// Converts the URL to a manifest resource path. - /// - /// The URL. - /// System.String. - private string ConvertUrlToResourcePath(string url) - { - var parts = url.Split('/'); - var normalizedParts = new string[parts.Length]; - - for (var i = 0; i < parts.Length; i++) - { - // We have to do some tricky string replacements for all parts of the path except the last - if (i < parts.Length - 1) - { - // Find the index of the first period as well as the first dash - var periodIndex = parts[i].IndexOf('.'); - var slashIndex = parts[i].IndexOf('-'); - - // Replace all periods with "._" and dashes with "_" - normalizedParts[i] = parts[i].Replace(".", "._").Replace("-", "_"); - - // If the first period occurred before the first slash, change it back from "._" to just "." - if (periodIndex < slashIndex) - { - var regex = new Regex("\\._"); - normalizedParts[i] = regex.Replace(normalizedParts[i], ".", 1); - } - } - else - { - normalizedParts[i] = parts[i]; - } - } - - return string.Join(".", normalizedParts); } ///