static void Main() { ObjectDefinition objDef = new ObjectDefinition(); objDef.Name = "PluginEngine"; objDef.Type = typeof(CompactPlugs.PluginEngine).ToString(); objDef.FileName = "CompactPlugs.dll"; objDef.Singleton = true; Property p = new Property("PluginLocator", typeof(CompactPlugs.PluginLocators.SimpleFilePluginLocator), "CompactPlugs.dll"); objDef.Properties = new Property[] { p }; CompactInjection.CompactConstructor.DefaultConstructor.AddDefinition(objDef, "default"); PluginEngine plugEngine = CompactConstructor.DefaultConstructor.New <PluginEngine>("PluginEngine"); plugEngine.Run(); Application.Run(plugEngine.WinForm as System.Windows.Forms.Form); }
public void Run() { if (null != engine) { if (pluginFileInfo.Extension == ".cs" || pluginFileInfo.Extension == ".lm" || pluginFileInfo.Extension == ".dll") { if (pluginFileInfo.Extension == ".cs" || pluginFileInfo.Extension == ".lm") { if (!engine.Compile(String.Empty)) { foreach (string error in engine.Errors) { Config.ConsoleEx.WriteLine("Error compiling plug-in (" + engine.FileName + ")" + Environment.NewLine + Environment.NewLine + error); } return; } } if (!engine.Run()) { foreach (string error in engine.Errors) { Config.ConsoleEx.WriteLine("Error running plug-in (" + engine.FileName + ")" + Environment.NewLine + Environment.NewLine + error); } } else { if (null == engines) { engines = new List <PluginEngine>(); } Engines.Add(engine); } } } }