diff options
| author | Luke Pulverenti <luke.pulverenti@gmail.com> | 2013-04-10 13:11:23 -0400 |
|---|---|---|
| committer | Luke Pulverenti <luke.pulverenti@gmail.com> | 2013-04-10 13:11:23 -0400 |
| commit | d327095b4b02fad69472921c98db0fb493fc9061 (patch) | |
| tree | 07e3a13961569b3318c962b726f367be0af20eee | |
| parent | 7097b9aa7515fa437012fea82ab6c91db0ec8cda (diff) | |
more dashboard code consolidation
| -rw-r--r-- | MediaBrowser.WebDashboard/Api/DashboardService.cs | 42 |
1 files changed, 1 insertions, 41 deletions
diff --git a/MediaBrowser.WebDashboard/Api/DashboardService.cs b/MediaBrowser.WebDashboard/Api/DashboardService.cs index 32c258961..5fb88c4fe 100644 --- a/MediaBrowser.WebDashboard/Api/DashboardService.cs +++ b/MediaBrowser.WebDashboard/Api/DashboardService.cs @@ -131,6 +131,7 @@ namespace MediaBrowser.WebDashboard.Api /// <param name="userManager">The user manager.</param> /// <param name="appHost">The app host.</param> /// <param name="libraryManager">The library manager.</param> + /// <param name="serverConfigurationManager">The server configuration manager.</param> 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)); - } - - /// <summary> - /// Converts the URL to a manifest resource path. - /// </summary> - /// <param name="url">The URL.</param> - /// <returns>System.String.</returns> - 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); } /// <summary> |
