From fc735e918723f5bfdd64979afa4995a6fec80e7c Mon Sep 17 00:00:00 2001 From: LukePulverenti Luke Pulverenti luke pulverenti Date: Mon, 3 Sep 2012 17:56:30 -0400 Subject: Tweaked plugin downloading a bit --- MediaBrowser.Common/Plugins/BasePlugin.cs | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) (limited to 'MediaBrowser.Common/Plugins/BasePlugin.cs') diff --git a/MediaBrowser.Common/Plugins/BasePlugin.cs b/MediaBrowser.Common/Plugins/BasePlugin.cs index e36a31c68..d2e186e12 100644 --- a/MediaBrowser.Common/Plugins/BasePlugin.cs +++ b/MediaBrowser.Common/Plugins/BasePlugin.cs @@ -24,7 +24,7 @@ namespace MediaBrowser.Common.Plugins } } - protected override Type ConfigurationType + public override Type ConfigurationType { get { return typeof(TConfigurationType); } } @@ -35,12 +35,12 @@ namespace MediaBrowser.Common.Plugins /// public abstract class BasePlugin : IDisposable { - private IKernel Kernel { get; set; } + public IKernel IKernel { get; set; } /// /// Gets or sets the plugin's current context /// - protected KernelContext Context { get { return Kernel.KernelContext; } } + protected KernelContext Context { get { return IKernel.KernelContext; } } /// /// Gets the name of the plugin @@ -50,7 +50,7 @@ namespace MediaBrowser.Common.Plugins /// /// Gets the type of configuration this plugin uses /// - protected abstract Type ConfigurationType { get; } + public abstract Type ConfigurationType { get; } /// /// Gets the plugin version @@ -74,6 +74,8 @@ namespace MediaBrowser.Common.Plugins } } + public DateTime ConfigurationDateLastModified { get; private set; } + /// /// Gets the path to the assembly file /// @@ -81,7 +83,7 @@ namespace MediaBrowser.Common.Plugins { get { - return Path.Combine(Kernel.ApplicationPaths.PluginsPath, AssemblyFileName); + return Path.Combine(IKernel.ApplicationPaths.PluginsPath, AssemblyFileName); } } @@ -102,7 +104,7 @@ namespace MediaBrowser.Common.Plugins { get { - return Path.Combine(Kernel.ApplicationPaths.PluginConfigurationsPath, ConfigurationFileName); + return Path.Combine(IKernel.ApplicationPaths.PluginConfigurationsPath, ConfigurationFileName); } } @@ -118,7 +120,7 @@ namespace MediaBrowser.Common.Plugins { // Give the folder name the same name as the config file name // We can always make this configurable if/when needed - _DataFolderPath = Path.Combine(Kernel.ApplicationPaths.PluginsPath, Path.GetFileNameWithoutExtension(ConfigurationFileName)); + _DataFolderPath = Path.Combine(IKernel.ApplicationPaths.PluginsPath, Path.GetFileNameWithoutExtension(ConfigurationFileName)); if (!Directory.Exists(_DataFolderPath)) { @@ -154,7 +156,7 @@ namespace MediaBrowser.Common.Plugins /// public void Initialize(IKernel kernel) { - Kernel = kernel; + IKernel = kernel; ReloadConfiguration(); @@ -183,12 +185,14 @@ namespace MediaBrowser.Common.Plugins if (!File.Exists(ConfigurationFilePath)) { Configuration = Activator.CreateInstance(ConfigurationType) as BasePluginConfiguration; + XmlSerializer.SerializeToFile(Configuration, ConfigurationFilePath); } else { Configuration = XmlSerializer.DeserializeFromFile(ConfigurationType, ConfigurationFilePath) as BasePluginConfiguration; - Configuration.DateLastModified = File.GetLastWriteTime(ConfigurationFilePath); } + + ConfigurationDateLastModified = File.GetLastWriteTime(ConfigurationFilePath); } } } -- cgit v1.2.3