本文整理汇总了C#中IPlugin.PluginScope方法的典型用法代码示例。如果您正苦于以下问题:C# IPlugin.PluginScope方法的具体用法?C# IPlugin.PluginScope怎么用?C# IPlugin.PluginScope使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IPlugin
的用法示例。
在下文中一共展示了IPlugin.PluginScope方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ValidatePlugin
//Kontrola jestli plugin obsahuje vsechny potrebne metody
//TODO - nelze ale zjisit jestli metodu obsahuje jinak nez tim ze ji vola - nepouzivame tedy
//
public static bool ValidatePlugin(IPlugin plugin)
{
List<string> missingMethods = new List<string>();
try
{
plugin.Name();
}
catch (MissingMemberException)
{
missingMethods.Add("Name");
}
try
{
plugin.Description();
}
catch (MissingMemberException)
{
missingMethods.Add("Description");
}
try
{
plugin.Version();
}
catch (MissingMemberException)
{
missingMethods.Add("Version");
}
try
{
//Tuto metodu pouzivame pouze v DLLExecute neni ji tedy nutne kontrolovatna DLR
plugin.PluginScope();
}
catch (MissingMemberException)
{
missingMethods.Add("PluginScope");
}
try
{
plugin.Execute(null, null);
}
catch (MissingMemberException)
{
missingMethods.Add("Execute");
}
catch (Exception) {}
try
{
plugin.Install(null, null);
}
catch (MissingMemberException)
{
missingMethods.Add("Install");
}
catch (Exception) { }
try
{
plugin.Test(null, null);
}
catch (MissingMemberException)
{
missingMethods.Add("Test");
}
catch (Exception) {}
try
{
plugin.GetInstance();
}
catch (Exception)
{
missingMethods.Add("GetInstance");
}
if (missingMethods.Count > 0)
{
var log = NaverticaLog.GetInstance();
log.LogError(missingMethods.Contains("Name") ? "" : plugin.Name(), "Missing methods in plugin: " + missingMethods.JoinStrings(", "));
}
return missingMethods.Count == 0;
}