本文整理汇总了C#中MediaPortal.Common.PluginManager.PluginRuntime类的典型用法代码示例。如果您正苦于以下问题:C# PluginRuntime类的具体用法?C# PluginRuntime怎么用?C# PluginRuntime使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
PluginRuntime类属于MediaPortal.Common.PluginManager命名空间,在下文中一共展示了PluginRuntime类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Activated
public void Activated(PluginRuntime pluginRuntime)
{
messageQueue = new AsynchronousMessageQueue(this,
new string[] {SystemMessaging.CHANNEL, PlayerManagerMessaging.CHANNEL});
messageQueue.MessageReceived += OnMessageReceived;
messageQueue.Start();
}
示例2: BuildItem
public object BuildItem(PluginItemMetadata itemData, PluginRuntime plugin)
{
BuilderHelper.CheckParameter("ServiceClassName", itemData);
string serviceClassName = itemData.Attributes["ServiceClassName"];
object serviceInstance = plugin.InstantiatePluginObject(serviceClassName);
if (serviceInstance == null)
{
ServiceRegistration.Get<ILogger>().Warn("ServiceBuilder: Could not instantiate service class '{0}' in plugin '{1}' (id: '{2}')",
serviceClassName, itemData.PluginRuntime.Metadata.Name, itemData.PluginRuntime.Metadata.PluginId);
return null;
}
string registrationClassAssembly;
if (!itemData.Attributes.TryGetValue("RegistrationClassAssembly", out registrationClassAssembly))
registrationClassAssembly = null;
string registrationClassName;
if (!itemData.Attributes.TryGetValue("RegistrationClassName", out registrationClassName))
registrationClassName = null;
Type registrationType;
if (string.IsNullOrEmpty(registrationClassName))
registrationType = serviceInstance.GetType();
else
registrationType = string.IsNullOrEmpty(registrationClassAssembly) ? plugin.GetPluginType(registrationClassName) :
Type.GetType(registrationClassName + ", " + registrationClassAssembly);
if (registrationType == null)
{
ServiceRegistration.Get<ILogger>().Warn("ServiceBuilder: Could not instantiate service registration type '{0}' (Assembly: '{1}') in plugin '{2}' (id: '{3}')",
registrationClassName, registrationClassAssembly, itemData.PluginRuntime.Metadata.Name, itemData.PluginRuntime.Metadata.PluginId);
return null;
}
return new ServiceItem(registrationType, serviceInstance);
}
示例3: Activated
public void Activated(PluginRuntime pluginRuntime)
{
if (_isInitialized)
return;
_isInitialized = true;
// All non-default media item aspects must be registered
var miatr = ServiceRegistration.Get<IMediaItemAspectTypeRegistration>();
miatr.RegisterLocallyKnownMediaItemAspectType(OnlineVideosAspect.Metadata);
InitializeOnlineVideoSettings();
// create a message queue for OnlineVideos to broadcast that the list of site utils was rebuild
_messageQueue = new AsynchronousMessageQueue(this, new string[] { OnlineVideosMessaging.CHANNEL });
_messageQueue.Start();
// load and update sites in a background thread, it takes time and we are on the Main thread delaying MP2 startup
ServiceRegistration.Get<IThreadPool>().Add(
InitialSitesUpdateAndLoad,
"OnlineVideos Initial Sites Load & Update",
QueuePriority.Low,
ThreadPriority.BelowNormal,
AfterInitialLoad);
}
示例4: Activated
public void Activated(PluginRuntime pluginRuntime)
{
ServiceRegistration.Set<ITvHandler>(new SlimTvHandler());
// Register recording section in MediaLibrary
RecordingsLibrary.RegisterOnMediaLibrary();
}
示例5: BuildItem
public object BuildItem(PluginItemMetadata itemData, PluginRuntime plugin)
{
BuilderHelper.CheckParameter("ClassName", itemData);
BuilderHelper.CheckParameter("ProviderName", itemData);
BuilderHelper.CheckParameter("Priority", itemData);
return new ThumbnailProviderRegistration(plugin.GetPluginType(itemData.Attributes["ClassName"]), itemData.Id, itemData.Attributes["ProviderName"], itemData.Attributes["Priority"]);
}
示例6: Activated
public void Activated(PluginRuntime pluginRuntime)
{
var meta = pluginRuntime.Metadata;
Logger.Info(string.Format("{0} v{1} [{2}] by {3}", meta.Name, meta.PluginVersion, meta.Description, meta.Author));
DvDevice device = ServiceRegistration.Get<IBackendServer>().UPnPBackendServer.FindDevicesByDeviceTypeAndVersion(UPnPTypesAndIds.BACKEND_SERVER_DEVICE_TYPE, UPnPTypesAndIds.BACKEND_SERVER_DEVICE_TYPE_VERSION, true).FirstOrDefault();
if (device != null)
{
var serverSettings = new ServerSettingsImpl();
Logger.Debug("ServerSettings: Registering ServerSettings service.");
device.AddService(serverSettings);
Logger.Debug("ServerSettings: Adding ServerSettings service to MP2 backend root device");
// List all assemblies
InitPluginAssemblyList();
// Set our own resolver to lookup types from any of assemblies from Plugins subfolder.
SettingsSerializer.CustomAssemblyResolver = PluginsAssemblyResolver;
// AppDomain.CurrentDomain.AssemblyResolve += PluginsAssemblyResolver;
Logger.Debug("ServerSettings: Adding Plugins folder to private path");
}
else
{
Logger.Error("ServerSettings: MP2 backend root device not found!");
}
}
示例7: BuildItem
public object BuildItem(PluginItemMetadata itemData, PluginRuntime plugin)
{
BuilderHelper.CheckParameter("ClassName", itemData);
BuilderHelper.CheckParameter("Caption", itemData);
BuilderHelper.CheckParameter("Sort", itemData);
return new MediaItemActionExtension(plugin.GetPluginType(itemData.Attributes["ClassName"]), itemData.Attributes["Caption"], itemData.Attributes["Sort"], itemData.Id);
}
示例8: BuildSection
protected static ConfigSectionMetadata BuildSection(PluginItemMetadata itemData, PluginRuntime plugin)
{
string location = ConfigBaseMetadata.ConcatLocations(itemData.RegistrationLocation, itemData.Id);
string text = null;
string iconSmallPath = null;
string iconLargePath = null;
foreach (KeyValuePair<string, string> attr in itemData.Attributes)
{
switch (attr.Key)
{
case "Text":
text = attr.Value;
break;
case "IconSmallPath":
iconSmallPath = attr.Value;
break;
case "IconLargePath":
iconLargePath = attr.Value;
break;
default:
throw new ArgumentException("'ConfigSection' builder doesn't define an attribute '" + attr.Key + "'");
}
}
if (text == null)
throw new ArgumentException("'ConfigSection' item needs an attribute 'Text'");
return new ConfigSectionMetadata(location, text,
plugin.Metadata.GetAbsolutePath(iconSmallPath),
plugin.Metadata.GetAbsolutePath(iconLargePath));
}
示例9: Activated
public void Activated(PluginRuntime pluginRuntime)
{
EmulatorsCore.Init(new EmulatorsSettings());
importer = new Importer();
EmulatorsCore.Database.OnItemDeleting += Database_OnItemDeleting;
ServiceRegistration.Set<IEmulatorsService>(this);
ImporterMessaging.SendImporterMessage(ImporterMessaging.MessageType.Init);
}
示例10: BuildItem
public object BuildItem(PluginItemMetadata itemData, PluginRuntime plugin)
{
BuilderHelper.CheckParameter("Type", itemData);
BuilderHelper.CheckParameter("Directory", itemData);
return new PluginResource(
(PluginResourceType) Enum.Parse(typeof (PluginResourceType), itemData.Attributes["Type"]),
plugin.Metadata.GetAbsolutePath(itemData.Attributes["Directory"]));
}
示例11: Activated
public void Activated(PluginRuntime pluginRuntime)
{
var meta = pluginRuntime.Metadata;
Logger.Info(string.Format("{0} v{1} [{2}] by {3}", meta.Name, meta.PluginVersion, meta.Description, meta.Author));
ServiceRegistration.Get<IMessageBroker>().RegisterMessageReceiver(SystemMessaging.CHANNEL, this);
SubscribeToMessages();
//Logger.Debug("UPnPRenderPlugin: Adding UPNP device as a root device");
//ServiceRegistration.Get<IFrontendServer>().UPnPFrontendServer.AddRootDevice(_device);
}
示例12: Activated
public void Activated(PluginRuntime pluginRuntime)
{
var meta = pluginRuntime.Metadata;
Logger.Info(string.Format("{0} v{1} [{2}] by {3}", meta.Name, meta.PluginVersion, meta.Description, meta.Author));
Logger.Debug("MediaServerPlugin: Adding UPNP device as a root device");
ServiceRegistration.Get<IBackendServer>().UPnPBackendServer.AddRootDevice(_device);
ServiceRegistration.Get<IResourceServer>().AddHttpModule(new DlnaResourceAccessModule());
}
示例13: RevokeItem
public void RevokeItem(object item, PluginItemMetadata itemData, PluginRuntime plugin)
{
BackgroundType type;
string typeName = GetBackgroundAndType(itemData.Attributes, out type);
switch (type)
{
case BackgroundType.Manager:
plugin.RevokePluginObject(typeName);
break;
}
}
示例14: Activated
public void Activated(PluginRuntime pluginRuntime)
{
var meta = pluginRuntime.Metadata;
Logger.Info(string.Format("{0} v{1} [{2}] by {3}", meta.Name, meta.PluginVersion, meta.Description, meta.Author));
IResourceServer server = ServiceRegistration.Get<IResourceServer>();
if (server != null)
{
ServiceRegistration.Set<IFanArtService>(new FanArtService());
_fanartModule = new FanartAccessModule();
server.AddHttpModule(_fanartModule);
}
}
示例15: Activated
public void Activated(PluginRuntime pluginRuntime)
{
ISystemResolver systemResolver = ServiceRegistration.Get<ISystemResolver>();
var appKey = systemResolver.SystemType == SystemType.Server ? KEY_SERVER : KEY_CLIENT;
// The appkey and shared key can be found in onetrueeror.com
OneTrue.Configuration.Credentials(appKey.Item1, appKey.Item2);
OneTrue.Configuration.CatchWinFormsExceptions();
OneTrue.Configuration.Advanced.UploadReportFailed += OnUploadReportFailed;
// Exchange the logger by the error reporting wrapper
var currentLogger = ServiceRegistration.Get<ILogger>();
var errorLogger = new ErrorLogWrapper(currentLogger);
ServiceRegistration.Set<ILogger>(errorLogger);
}