aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.Common.Implementations
diff options
context:
space:
mode:
authorLuke Pulverenti <luke.pulverenti@gmail.com>2015-10-17 11:05:12 -0400
committerLuke Pulverenti <luke.pulverenti@gmail.com>2015-10-17 11:05:12 -0400
commit034c0b95b2f9cc6440bac8b5844abfdc97db8990 (patch)
treeb591233733fb2aa79ac0c57a1b516ca90d9f155c /MediaBrowser.Common.Implementations
parent317a4872299b9c3fcc9b43eceff7c06cb696ab72 (diff)
3.0.5768.1
Diffstat (limited to 'MediaBrowser.Common.Implementations')
-rw-r--r--MediaBrowser.Common.Implementations/BaseApplicationHost.cs11
-rw-r--r--MediaBrowser.Common.Implementations/Configuration/BaseConfigurationManager.cs21
2 files changed, 24 insertions, 8 deletions
diff --git a/MediaBrowser.Common.Implementations/BaseApplicationHost.cs b/MediaBrowser.Common.Implementations/BaseApplicationHost.cs
index 97c856035..6dc97100d 100644
--- a/MediaBrowser.Common.Implementations/BaseApplicationHost.cs
+++ b/MediaBrowser.Common.Implementations/BaseApplicationHost.cs
@@ -416,6 +416,8 @@ namespace MediaBrowser.Common.Implementations
/// </summary>
protected virtual void FindParts()
{
+ RegisterModules();
+
ConfigurationManager.AddParts(GetExports<IConfigurationFactory>());
Plugins = GetExports<IPlugin>();
}
@@ -481,7 +483,6 @@ namespace MediaBrowser.Common.Implementations
IsoManager = new IsoManager();
RegisterSingleInstance(IsoManager);
- RegisterModules();
return Task.FromResult (true);
}
@@ -524,6 +525,14 @@ namespace MediaBrowser.Common.Implementations
}
catch (ReflectionTypeLoadException ex)
{
+ if (ex.LoaderExceptions != null)
+ {
+ foreach (var loaderException in ex.LoaderExceptions)
+ {
+ Logger.Error("LoaderException: " + loaderException.Message);
+ }
+ }
+
// If it fails we can still get a list of the Types it was able to resolve
return ex.Types.Where(t => t != null);
}
diff --git a/MediaBrowser.Common.Implementations/Configuration/BaseConfigurationManager.cs b/MediaBrowser.Common.Implementations/Configuration/BaseConfigurationManager.cs
index 0bcc5c711..7bbc1abd7 100644
--- a/MediaBrowser.Common.Implementations/Configuration/BaseConfigurationManager.cs
+++ b/MediaBrowser.Common.Implementations/Configuration/BaseConfigurationManager.cs
@@ -10,6 +10,7 @@ using System.IO;
using System.Linq;
using System.Threading;
using CommonIO;
+using MediaBrowser.Common.Extensions;
namespace MediaBrowser.Common.Implementations.Configuration
{
@@ -33,7 +34,7 @@ namespace MediaBrowser.Common.Implementations.Configuration
/// Occurs when [configuration updating].
/// </summary>
public event EventHandler<ConfigurationUpdateEventArgs> NamedConfigurationUpdating;
-
+
/// <summary>
/// Occurs when [named configuration updated].
/// </summary>
@@ -89,8 +90,8 @@ namespace MediaBrowser.Common.Implementations.Configuration
}
}
- private ConfigurationStore[] _configurationStores = {};
- private IConfigurationFactory[] _configurationFactories = {};
+ private ConfigurationStore[] _configurationStores = { };
+ private IConfigurationFactory[] _configurationFactories = { };
/// <summary>
/// Initializes a new instance of the <see cref="BaseConfigurationManager" /> class.
@@ -228,9 +229,15 @@ namespace MediaBrowser.Common.Implementations.Configuration
{
var file = GetConfigurationFile(key);
- var configurationType = _configurationStores
- .First(i => string.Equals(i.Key, key, StringComparison.OrdinalIgnoreCase))
- .ConfigurationType;
+ var configurationInfo = _configurationStores
+ .FirstOrDefault(i => string.Equals(i.Key, key, StringComparison.OrdinalIgnoreCase));
+
+ if (configurationInfo == null)
+ {
+ throw new ResourceNotFoundException("Configuration with key " + key + " not found.");
+ }
+
+ var configurationType = configurationInfo.ConfigurationType;
lock (_configurationSyncLock)
{
@@ -285,7 +292,7 @@ namespace MediaBrowser.Common.Implementations.Configuration
NewConfiguration = configuration
}, Logger);
-
+
_configurations.AddOrUpdate(key, configuration, (k, v) => configuration);
var path = GetConfigurationFile(key);