private void loadPlugins() { foreach (string dll in Directory.GetFiles(Directory.GetCurrentDirectory(), "*.dll")) { try { System.Reflection.Assembly asm = System.Reflection.Assembly.LoadFile(dll); foreach (Type t in asm.GetTypes()) { if (t.IsClass && t.IsPublic && !t.IsAbstract && t.GetInterface(typeof(CCInputInterface).FullName) != null) { CCInputInterface iplug = (CCInputInterface)asm.CreateInstance(t.FullName); iplug.init(this); inputers.Add(iplug); } if (t.IsClass && t.IsPublic && !t.IsAbstract && t.GetInterface(typeof(CCOutputInterface).FullName) != null) { CCOutputInterface oplug = (CCOutputInterface)asm.CreateInstance(t.FullName); oplug.init(); outputers.Add(oplug); } if (t.IsClass && t.IsPublic && !t.IsAbstract && t.GetInterface(typeof(CCTaskControllInterface).FullName) != null) { CCTaskControllInterface tplug = (CCTaskControllInterface)asm.CreateInstance(t.FullName); tplug.init(this); taskcontrollers.Add(tplug); } } } catch (Exception e) { //System.IO.File.AppendAllText("loadlog.txt", "catch error" + e.Message + "\n"); } } }
public void addTask(string message, string autherID, string autherName, string autherAddinfo, CCInputInterface adder, string adderAddinfo) { CCOutputInterface def = null; if (outputers.Count > 0) { def = outputers[0]; } string srcName = ""; if (adder != null) { srcName = adder.getPluginName(); } YomiageTask ntask = new YomiageTask(message, autherID, autherName, autherAddinfo, def, srcName, adderAddinfo, lastQueueCode++); foreach (CCTaskControllInterface e in taskcontrollers) { e.TaskCheck(ntask, false); } ntask.updateListItem(); queue.Enqueue(ntask); if (taskListv.InvokeRequired) { taskListv.Invoke(new addingTaskDelegate(addingTask), ntask.listviewlinkitem); } else { taskListv.Items.Add(ntask.listviewlinkitem); } afterStackExcute(); //taskListv.Items.Add(ntask.listviewlinkitem); }