public void passToEngine(string[] workString) { FluxEngineWorkObject ewObject = new FluxEngineWorkObject(); ewObject.sEngineName = workString[0]; ewObject.sPluginName = workString[1]; ewObject.sTaskUUID = workString[2]; ewObject.sPluginWork = workString[3]; lock (alAvailableThreadIDs) { ewObject.iThreadID = int.Parse(alAvailableThreadIDs[0].ToString()); alAvailableThreadIDs.RemoveAt(0); } Type tThisEngineType = Type.GetType(ewObject.sEngineName); Assembly thisAssembly = Assembly.GetExecutingAssembly(); foreach (Type type in thisAssembly.GetTypes()) { if (type.IsClass == true && type == tThisEngineType) { lock (htEngines) { FluxEngine engineClassObject; if (htEngines.ContainsKey(ewObject.iThreadID)) { engineClassObject = (FluxEngine)htEngines[ewObject.iThreadID]; engineClassObject.Abort(); htEngines.Remove(ewObject.iThreadID); } engineClassObject = (FluxEngine)Activator.CreateInstance(type, new object[] { ewObject }); engineClassObject._fireFailed += new IPluginEvent(this.fireFailed); engineClassObject._fireSuccess += new IPluginEvent(this.fireSuccess); engineClassObject._fireSaveWork += new IPluginEvent(this.fireSaveWork); engineClassObject._fireResponseTime += new IPluginResponseTime(fireResponseTime_LastResponse); type.InvokeMember("Work", BindingFlags.InvokeMethod, null, engineClassObject, new object[] { }); htEngines.Add(ewObject.iThreadID, engineClassObject); } break; } } }
public FluxEngine(FluxEngineWorkObject ewobject) { ewObject = ewobject; }