diff options
| author | LukePulverenti <luke.pulverenti@gmail.com> | 2013-02-20 21:40:36 -0500 |
|---|---|---|
| committer | LukePulverenti <luke.pulverenti@gmail.com> | 2013-02-20 21:40:36 -0500 |
| commit | 509156cbc3497ff8daabefd3dba843f5b085701a (patch) | |
| tree | b97879f175ee1ca225354b367eb3d287dd8cd25b /MediaBrowser.Common | |
| parent | 767cdc1f6f6a63ce997fc9476911e2c361f9d402 (diff) | |
remove core plugin output from source control
Diffstat (limited to 'MediaBrowser.Common')
| -rw-r--r-- | MediaBrowser.Common/Kernel/BaseKernel.cs | 27 | ||||
| -rw-r--r-- | MediaBrowser.Common/Net/HttpServer.cs | 80 |
2 files changed, 63 insertions, 44 deletions
diff --git a/MediaBrowser.Common/Kernel/BaseKernel.cs b/MediaBrowser.Common/Kernel/BaseKernel.cs index a4cd81665..616a0305c 100644 --- a/MediaBrowser.Common/Kernel/BaseKernel.cs +++ b/MediaBrowser.Common/Kernel/BaseKernel.cs @@ -3,7 +3,6 @@ using MediaBrowser.Common.IO; using MediaBrowser.Common.Localization; using MediaBrowser.Common.Mef; using MediaBrowser.Common.Net; -using MediaBrowser.Common.Net.Handlers; using MediaBrowser.Common.Plugins; using MediaBrowser.Common.ScheduledTasks; using MediaBrowser.Common.Serialization; @@ -17,7 +16,6 @@ using System; using System.Collections.Generic; using System.ComponentModel.Composition; using System.ComponentModel.Composition.Hosting; -using System.ComponentModel.Composition.Primitives; using System.Deployment.Application; using System.Diagnostics; using System.IO; @@ -517,6 +515,31 @@ namespace MediaBrowser.Common.Kernel yield return pluginAssembly; } + var runningDirectory = Path.GetDirectoryName(Process.GetCurrentProcess().MainModule.FileName); + var corePluginDirectory = Path.Combine(runningDirectory, "CorePlugins"); + + // This will prevent the .dll file from getting locked, and allow us to replace it when needed + pluginAssemblies = Directory.EnumerateFiles(corePluginDirectory, "*.dll", SearchOption.TopDirectoryOnly) + .Select(file => + { + try + { + return Assembly.Load(File.ReadAllBytes((file))); + } + catch (Exception ex) + { + _failedPluginAssemblies.Add(file); + Logger.ErrorException("Error loading {0}", ex, file); + return null; + } + + }).Where(a => a != null); + + foreach (var pluginAssembly in pluginAssemblies) + { + yield return pluginAssembly; + } + // Include composable parts in the Model assembly yield return typeof (SystemInfo).Assembly; diff --git a/MediaBrowser.Common/Net/HttpServer.cs b/MediaBrowser.Common/Net/HttpServer.cs index efd6d9d32..7bb81c1ca 100644 --- a/MediaBrowser.Common/Net/HttpServer.cs +++ b/MediaBrowser.Common/Net/HttpServer.cs @@ -209,56 +209,52 @@ namespace MediaBrowser.Common.Net RaiseReceiveWebRequest(context); - Task.Run(() => + try { - try - { - ProcessRequest(context); - } - catch (InvalidOperationException ex) - { - HandleException(context.Response, ex, 422); - - throw; - } - catch (ResourceNotFoundException ex) - { - HandleException(context.Response, ex, 404); + ProcessRequest(context); + } + catch (InvalidOperationException ex) + { + HandleException(context.Response, ex, 422); - throw; - } - catch (FileNotFoundException ex) - { - HandleException(context.Response, ex, 404); + throw; + } + catch (ResourceNotFoundException ex) + { + HandleException(context.Response, ex, 404); - throw; - } - catch (DirectoryNotFoundException ex) - { - HandleException(context.Response, ex, 404); + throw; + } + catch (FileNotFoundException ex) + { + HandleException(context.Response, ex, 404); - throw; - } - catch (UnauthorizedAccessException ex) - { - HandleException(context.Response, ex, 401); + throw; + } + catch (DirectoryNotFoundException ex) + { + HandleException(context.Response, ex, 404); - throw; - } - catch (ArgumentException ex) - { - HandleException(context.Response, ex, 400); + throw; + } + catch (UnauthorizedAccessException ex) + { + HandleException(context.Response, ex, 401); - throw; - } - catch (Exception ex) - { - HandleException(context.Response, ex, 500); + throw; + } + catch (ArgumentException ex) + { + HandleException(context.Response, ex, 400); - throw; - } + throw; + } + catch (Exception ex) + { + HandleException(context.Response, ex, 500); - }); + throw; + } } /// <summary> |
