private void DelegateInvoke_PreInvokeCallback(object sender, ThreadResults results, object[] pars) { FunctionModule m = (FunctionModule)sender; m.BelongThread = results.Thread; Logger.Log("Thread " + sender.ToString() + " started"); }
protected static T GetInstance <T>() where T : FunctionModule, new() { if (_instance == null) { _instance = new T(); } return((T)_instance); }
private void DirectoryOnEnum(string path) { XReader xr; string rlt = path; if (File.Exists(path)) { string typName; Assembly asm; xr = new XReader(path); try { //instanceType = xr["Plugin"]["$Instance"].Value; asm = Assembly.LoadFrom(PluginDirectory + xr.Reset()["Plugin"]["$File"].Value); typName = xr.Reset()["Plugin"]["$Type"].Value; // ModuleBase module = (ModuleBase)asm.CreateInstance(typName); FunctionModule module = (FunctionModule)CreateModuleInstanceByTypeName(typName, asm); if (module == null) { return; } module.BaseDir = path; //module.ConfigFileFullPath = path + "\\Plugin.Config"; PluginItem pl = new PluginItem(); pl.Asm = asm; pl.Module = module; bool isRegisted = RegistPlugin(pl); if (OnPluginsLoad != null) { //OnPluginsLoad(this, pl); ClassHelper.AsyncInvokeDelegates(OnPluginsLoad, DelegateInvoke_PreInvokeCallback, DelegateInvoke_PostInvokeCallback, new object[] { this, pl }); } } catch (Exception e) { //MessageBox.Show(e.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); Exceptions.Log(e); } } }