本文整理汇总了C#中IPlugin.GetWipeObjects方法的典型用法代码示例。如果您正苦于以下问题:C# IPlugin.GetWipeObjects方法的具体用法?C# IPlugin.GetWipeObjects怎么用?C# IPlugin.GetWipeObjects使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IPlugin
的用法示例。
在下文中一共展示了IPlugin.GetWipeObjects方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetObjects
public NativeMethods.WObject[] GetObjects()
{
List<NativeMethods.WObject> items = new List<NativeMethods.WObject>();
if(_assemblies == null) {
throw new Exception("Assemblies not set");
}
if(_assemblies.Count == 0 || _pluginIds == null || (_pluginIds != null && _pluginIds.Count == 0)) {
return null;
}
// initialize
int count = _pluginIds.Count;
manager = new PluginManager();
loadedAssemblies = 0;
stopped = false;
try {
Plugin p = null;
for(int i = 0; i < _pluginIds.Count; i++) {
if(stopped) {
return null;
}
try {
p = GetPlugin(_pluginIds[i]);
if(p != null) {
if(p.Instantiated == false) {
Debug.ReportWarning("Plugin not instantiated. Plugin: {0}", p.Name);
continue;
}
// load the plugin
if(p.PluginObject.Load()) {
// set the settings
if(_pluginSettings != null) {
if(_pluginSettings.LoadPluginSettings(p) == false) {
Debug.ReportWarning("Failed to load settings. Plugin: {0}", p.Name);
continue;
}
}
// set the active plugin
activePlugin = p.PluginObject;
IWipeObject[] obj = activePlugin.GetWipeObjects();
activePlugin = null; // plugin no longer needed
if(obj == null || obj.Length == 0) {
continue;
}
// add the objects
for(int j = 0; j < obj.Length; j++) {
if(stopped) {
return null;
}
if(obj[i] is PluginWipeObject) {
// skip plugin objects
continue;
}
obj[i].Options = _options;
obj[i].WipeMethodId = _wipeMethodId;
if(obj[i].SingleObject) {
items.Add(obj[i].GetObject());
}
else {
items.AddRange(obj[i].GetObjects());
}
}
}
else {
Debug.ReportWarning("Failed to load plugin. Plugin: {0}", p.Name);
}
}
}
catch(Exception ex) {
// report the exception to the session
if(OnPluginException != null) {
OnPluginException(p, ex);
}
}
}
}
catch(Exception e) {
Debug.ReportError("Exception while running plugins. Exception {0}", e.Message);
}
finally {
// unload the plugins
manager.DestroyAllPlugins();
}
return items.ToArray();
}