public string GetExecuteCommandWithCustomResultStatement(AlgorithmDescription targetAlgorithmDescription, ComputeDeviceInfo targetComputeDeviceInfo, string port, string customResultProcessingStatement) { string attributeKey = "ScalarExecuteCommand"; return(GetCompleteExecuteCommandWithResultProcessingStatement(targetAlgorithmDescription, targetComputeDeviceInfo, port, attributeKey, customResultProcessingStatement)); }
private string GetCompleteExecuteCommandWithResultProcessingStatement(AlgorithmDescription targetAlgorithmDescription, ComputeDeviceInfo targetComputeDeviceInfo, string port, string attributeKey = "ScalarExecuteCommand", string customResultProcessingStatement = null) { string errorList = ""; if (targetAlgorithmDescription.Id != AlgorithmId) { errorList += "[ERROR] PresetDescription::GetCompleteExecuteCommand() - Preset.AlgorithmId does not match with given 'targetAlgorithmDescription'\n"; } if (targetComputeDeviceInfo.ComputeDeviceId != ComputeDeviceId) { errorList += "[ERROR] PresetDescription::GetCompleteExecuteCommand() - Preset.ComputeDeviceId does not match with given 'targetComputeDeviceInfo'\n"; } if (errorList != "") { Console.ForegroundColor = ConsoleColor.Red; Console.WriteLine(errorList); Console.ResetColor(); return(null); } string ipAddress = targetComputeDeviceInfo.IpAddress; string algorithmCommand = null; switch (attributeKey) { case "ScalarExecuteCommand": algorithmCommand = targetAlgorithmDescription.GetScalarExecuteCommand(ipAddress, port); break; case "InitCommand": algorithmCommand = targetAlgorithmDescription.GetInitCommand(ipAddress, port); break; case "UnloadCommand": algorithmCommand = targetAlgorithmDescription.GetUnloadCommand(ipAddress, port); break; } // If custom result processing statement is found, encode-append-send if (customResultProcessingStatement != null) { algorithmCommand += "\\n" + EncodeStringForTransmission(customResultProcessingStatement, ipAddress, port); return(algorithmCommand); } else if (ResultProcessingStatement == null || ResultProcessingStatement == "") { return(algorithmCommand); } else { algorithmCommand += "\\n" + EncodeStringForTransmission(ResultProcessingStatement, ipAddress, port); return(algorithmCommand); } }
public string GetCompleteUnloadCommand(AlgorithmDescription targetAlgorithmDescription, ComputeDeviceInfo targetComputeDeviceInfo, string port) { string attributeKey = "UnloadCommand"; return(GetCompleteExecuteCommandWithResultProcessingStatement(targetAlgorithmDescription, targetComputeDeviceInfo, port, attributeKey)); }