Normal
This is from GuiWindowManager.cs, and I'm not sure I fully understand it.[code] static public void LoadPlugin(string strFile) { try { Assembly assem = Assembly.LoadFrom(strFile); if (assem!=null) { Type[] types = assem.GetExportedTypes(); foreach (Type t in types) { try { if (t.IsClass) { TypeFilter myFilter = new TypeFilter(MyInterfaceFilter); Type[] foundInterfaces=t.FindInterfaces(myFilter,"MediaPortal.GUI.Library.ISetupForm"); if (foundInterfaces.Length>0) { object newObj=(object)Activator.CreateInstance(t); ISetupForm setup=(ISetupForm)newObj; if (setup.CanEnable()) { if (!PlugInEnabled(setup.PluginName())) { return; } } } } } catch (System.NullReferenceException) { } } foreach (Type t in types) { try { if (t.IsClass) { if (t.IsSubclassOf (typeof(GUIWindow))) { object newObj=(object)Activator.CreateInstance(t); GUIWindow win=(GUIWindow)newObj; win.Init(); GUIWindowManager.Add(ref win); //Log.Write(" found plugin:{0} in {1}",t.ToString(), strFile); } } } catch (System.NullReferenceException) { } } } } catch (Exception ex) { string strEx=ex.Message; } }[/code]
This is from GuiWindowManager.cs, and I'm not sure I fully understand it.
[code] static public void LoadPlugin(string strFile)
{
try
Assembly assem = Assembly.LoadFrom(strFile);
if (assem!=null)
Type[] types = assem.GetExportedTypes();
foreach (Type t in types)
if (t.IsClass)
TypeFilter myFilter = new TypeFilter(MyInterfaceFilter);
Type[] foundInterfaces=t.FindInterfaces(myFilter,"MediaPortal.GUI.Library.ISetupForm");
if (foundInterfaces.Length>0)
object newObj=(object)Activator.CreateInstance(t);
ISetupForm setup=(ISetupForm)newObj;
if (setup.CanEnable())
if (!PlugInEnabled(setup.PluginName()))
return;
}
catch (System.NullReferenceException)
if (t.IsSubclassOf (typeof(GUIWindow)))
GUIWindow win=(GUIWindow)newObj;
win.Init();
GUIWindowManager.Add(ref win);
//Log.Write(" found plugin:{0} in {1}",t.ToString(), strFile);
catch (Exception ex)
string strEx=ex.Message;
}[/code]