public string ExecuteOper(SerialPort portTemp, string operName) { Init(portTemp, operName); string result = null; CommandsInfo commandsInfo = FindOperationCommandByName(); foreach (CommandsOperInfo operinfo in commandsInfo.CommandsOperation) { string opername = operinfo.OperationName; Assembly assembly = Assembly.Load(assemblyName); Type type = assembly.GetType(assemblyName + "." + opername); IOperation op = (IOperation)Activator.CreateInstance(type); result = op.Execute(portTemp, operinfo).ToString(); } return(result); }
private CommandsInfo FindOperationCommandByName() { CommandsInfo commandsInfo = commandsAssemble.Commands.Where(o => o.CommandsName == operationName).FirstOrDefault(); return(commandsInfo); }