private string InvokeExternalExe(PlatformType platformType, SystemLoadType systemLoadType, string podName, string startTime, string endTime) { var exePath = _mDMOptions.ExternalExePath;//"C:/home/Work/DevDiv/MDMetricsClientSampleCode/bin/Debug/MDMetricsClientSampleCode.exe"; var argsBuilder = new StringBuilder(); argsBuilder.Append(podName).Append(" ") .Append(platformType.ToString()).Append(" ") .Append(systemLoadType.ToString()).Append(" ") .Append(startTime).Append(" ") .Append(endTime).Append(" ") .Append(_mDMOptions.ResultPath); var task = RunProcessAsync(exePath, argsBuilder.ToString()); if (task && File.Exists(_mDMOptions.ResultPath)) { string content; using (StreamReader file = new StreamReader(_mDMOptions.ResultPath, true)) { content = file.ReadToEnd(); } File.Delete(_mDMOptions.ResultPath); return(content); } else { Console.WriteLine("Exe has not completed successfully!"); } return(null); }