2012-07-24 14:54:34 +00:00
|
|
|
|
using System;
|
|
|
|
|
using System.Linq;
|
2012-08-19 20:38:31 +00:00
|
|
|
|
using System.Threading.Tasks;
|
2012-08-15 13:20:29 +00:00
|
|
|
|
using MediaBrowser.Common.Net.Handlers;
|
2012-09-04 19:23:15 +00:00
|
|
|
|
using MediaBrowser.Common.Plugins;
|
2012-07-24 14:54:34 +00:00
|
|
|
|
using MediaBrowser.Controller;
|
2012-08-17 13:16:50 +00:00
|
|
|
|
using MediaBrowser.Model.Plugins;
|
2012-07-24 14:54:34 +00:00
|
|
|
|
|
|
|
|
|
namespace MediaBrowser.Api.HttpHandlers
|
|
|
|
|
{
|
2012-09-02 05:30:25 +00:00
|
|
|
|
public class PluginConfigurationHandler : BaseSerializationHandler<BasePluginConfiguration>
|
2012-07-24 14:54:34 +00:00
|
|
|
|
{
|
2012-09-04 19:23:15 +00:00
|
|
|
|
private BasePlugin _Plugin = null;
|
|
|
|
|
private BasePlugin Plugin
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
|
|
|
|
if (_Plugin == null)
|
|
|
|
|
{
|
|
|
|
|
string name = QueryString["assemblyfilename"];
|
|
|
|
|
|
|
|
|
|
_Plugin = Kernel.Instance.Plugins.First(p => p.AssemblyFileName.Equals(name, StringComparison.OrdinalIgnoreCase));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return _Plugin;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2012-08-19 20:38:31 +00:00
|
|
|
|
protected override Task<BasePluginConfiguration> GetObjectToSerialize()
|
2012-07-24 14:54:34 +00:00
|
|
|
|
{
|
2012-09-04 19:23:15 +00:00
|
|
|
|
return Task.FromResult<BasePluginConfiguration>(Plugin.Configuration);
|
|
|
|
|
}
|
2012-07-24 14:54:34 +00:00
|
|
|
|
|
2012-09-04 19:23:15 +00:00
|
|
|
|
public override TimeSpan CacheDuration
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
|
|
|
|
return TimeSpan.FromDays(7);
|
|
|
|
|
}
|
|
|
|
|
}
|
2012-08-22 02:50:59 +00:00
|
|
|
|
|
2012-09-04 19:23:15 +00:00
|
|
|
|
protected override Task<DateTime?> GetLastDateModified()
|
|
|
|
|
{
|
|
|
|
|
return Task.FromResult<DateTime?>(Plugin.ConfigurationDateLastModified);
|
2012-07-24 14:54:34 +00:00
|
|
|
|
}
|
2012-09-04 19:23:15 +00:00
|
|
|
|
|
2012-07-24 14:54:34 +00:00
|
|
|
|
}
|
|
|
|
|
}
|