本文整理汇总了C#中ProcessResult类的典型用法代码示例。如果您正苦于以下问题:C# ProcessResult类的具体用法?C# ProcessResult怎么用?C# ProcessResult使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ProcessResult类属于命名空间,在下文中一共展示了ProcessResult类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: doWork
public void doWork(BackgroundWorker worker, DoWorkEventArgs args)
{
Exception processEx = null;
Thread.CurrentThread.CurrentUICulture = new CultureInfo(Constantes.language);
this.modLog.Info(String.Format("Starting worker thread: [{0}]", this.getType().ToString()));
try
{
this.doSpecificWork(worker, args);
}
catch (Exception ex) {
processEx = ex;
}
finally
{
try
{
ProcessResult pr = new ProcessResult(this.getType());
pr.ProcessException = processEx;
pr.ProcessOutput = args.Result;
if (returnUpdatedDbStats)
{
pr.DbStatistics = this.chargeData.getDbStatistics();
}
// Cambiamos el resultado del objeto 'DoWorkEventArgs' (lo que devolvemos hacia fuera) por nuestro
// objeto ProcessResult, que además de tener el resultado como tal (processOutput) tiene incluida
// la posible excepción que el proceso haya podido lanzar, y las estadísticas actualizadas de BBDD.
args.Result = pr;
}
catch (Exception) { }
}
this.modLog.Info(String.Format("Finished worker thread: [{0}]", this.getType().ToString()));
}
示例2: SetValues
public void SetValues(ProcessResult result)
{
this.buttonTestDetails.Visible = false;
_result = result;
if (result.TestResults != null)
{
this.labelTestsFailingCount.Text = result.TestResults.CountFailed.ToString();
this.labelTestsPassingCount.Text = result.TestResults.CountPassed.ToString();
this.labelTestsExecutedCount.Text = result.TestResults.CountExecuted.ToString();
if (result.TestResults.CountFailed > 0)
{
this.buttonTestDetails.Visible = true;
}
if (result.TestResults.CoveredAssemblies != null)
{
foreach (CoveredAssembly assembly in result.TestResults.CoveredAssemblies)
{
listBoxCoverage.Items.Add(assembly.Name + " " + assembly.GetCoverage().ToString() + "%");
}
}
}
}
示例3: Create
/// <summary>
/// Creates a processing result with the specified state.
/// </summary>
/// <param name="state">The state.</param>
/// <param name="message">The message.</param>
/// <returns></returns>
public static ProcessResult Create(ProcessState state, string message)
{
var result = new ProcessResult();
result.State = state;
result.Message = message;
return result;
}
示例4: Execute
public ProcessResult Execute(ProcessInfo processInfo, ProjectItem item, TaskExecutionContext context)
{
var outputFile = context.GeneratePathInWorkingDirectory(item.NameOrType + ".log");
if ((this.Item == null) || (this.Context == null))
{
return this.Execute(processInfo,
item.Project.Name,
item.NameOrType,
outputFile);
}
Assert.AreEqual(this.FileName, processInfo.FileName);
var actual = processInfo.Arguments == null ? null : processInfo.Arguments.ToString();
Assert.AreEqual(this.Arguments, actual);
Assert.AreEqual(this.WorkingDirectory, processInfo.WorkingDirectory);
Assert.AreSame(this.Item, item);
Assert.AreEqual(this.Context, context);
var fileSystemMock = new Mock<IFileSystem>();
fileSystemMock.Setup(fs => fs.OpenFileForRead(outputFile)).Returns(new MemoryStream());
var result = new ProcessResult(
fileSystemMock.Object,
outputFile,
this.ExitCode,
this.TimedOut,
this.Failed);
return result;
}
示例5: Start
public ProcessResult Start()
{
ProcessResult totalResult = new ProcessResult();
if (!_fileSystem.DirectoryExists(_settings.BasePath))
{
_fileSystem.CreateDirectory(_settings.BasePath);
}
string subdir = CreateNewSubdirName(DateTime.Now);
_settings.UpdateOutputPath(subdir);
if (!_fileSystem.DirectoryExists(_settings.OutputPath))
{
_fileSystem.CreateDirectory(_settings.OutputPath);
}
foreach (BaseProcess process in _processes)
{
totalResult = process.Process();
if (totalResult.ResultCode == ExitCode.Failure)
{
break;
}
}
CleanUp();
return totalResult;
}
示例6: FillContent
public ProcessResult FillContent(XElement contentControl, IEnumerable<IContentItem> items)
{
var processResult = new ProcessResult();
var handled = false;
foreach (var contentItem in items)
{
var itemProcessResult = FillContent(contentControl, contentItem);
if (!itemProcessResult.Handled) continue;
handled = true;
if (!itemProcessResult.Success)
processResult.Errors.AddRange(itemProcessResult.Errors);
}
if (!handled) return ProcessResult.NotHandledResult;
if (processResult.Success && _isNeedToRemoveContentControls)
{
// Remove the content control for the table and replace it with its contents.
foreach (var xElement in contentControl.AncestorsAndSelf(W.sdt))
{
xElement.RemoveContentControl();
}
}
return processResult;
}
示例7: Match
public void Match(Func<AccountLine, AccountLine, bool> matchmethod)
{
this.match = matchmethod;
ProcessResult pRes = new ProcessResult(skbRepo.GetAll(), true);
do
{
pRes = ProcessMatches(pRes.UnMatched);
} while (pRes.AnyChange);
}
示例8: GetModifications
/// <summary>
/// Get modified files
/// </summary>
/// <param name="processResult">stdout process result</param>
/// <param name="from">start date and time (not used)</param>
/// <param name="to">end date and time (not used)</param>
/// <returns></returns>
public Modification[] GetModifications(ProcessResult processResult, DateTime from, DateTime to)
{
Modification[] Result = null;
string StdOut = processResult.StandardOutput;
StringReader reader = new StringReader(StdOut);
JediVCSFileInfoList Files = GetJediVCSFileInfoList(reader);
Result = GetModifiedFiles(Files);
return Result;
}
示例9: GetModificationsDoesNotCreateLabelWhenThereAreNoModifications
public void GetModificationsDoesNotCreateLabelWhenThereAreNoModifications()
{
ProcessResult result = new ProcessResult("",string.Empty, 0, false);
Modification[] emptyArray = new Modification[0];
_historyParser.SetupResult("Parse", emptyArray, typeof(TextReader), typeof(DateTime), typeof(DateTime));
_executor.ExpectAndReturn("Execute", result, new IsTypeOf(typeof(ProcessInfo)));
_executor.ExpectNoCall("Execute", typeof(ProcessInfo));
_vss.GetModifications(IntegrationResultMother.CreateSuccessful(DateTime.Now), IntegrationResultMother.CreateSuccessful(DateTime.Now));
}
示例10: Log
public static void Log(ProcessResult result)
{
using (var stream = File.Open(path, FileMode.Open, FileAccess.Write))
{
results.Add(result);
var serializer = new DataContractJsonSerializer(typeof(List<ProcessResult>));
serializer.WriteObject(stream, results);
stream.Flush();
}
}
示例11: ProcessTaskResult
public ProcessTaskResult(ProcessResult result)
{
this.result = result;
if (Failed())
{
Log.Info("Task execution failed");
Log.Info("Task output: " + result.StandardOutput);
if (! StringUtil.IsBlank(result.StandardError)) Log.Info("Task error: " + result.StandardError);
}
}
示例12: TryExecuteJava
public static bool TryExecuteJava(string command, out ProcessResult result)
{
if (command == null)
throw new ArgumentNullException("command");
var javaPath = GetJavaInstallationPath() + "\\bin\\";
var filename = javaPath + "java.exe";
return TryExecute(filename, command, out result);
}
示例13: FormatOutput
/// <summary>
/// Formata a saída
/// </summary>
/// <param name="word"></param>
/// <param name="pos"></param>
/// <param name="deadCats"></param>
private static void FormatOutput(string word, ProcessResult result)
{
if (!result.found)
{
Console.WriteLine(String.Format("Palavra não encontrada. Gatos mortos = {2}", word, result.index.ToString(), result.deadCats.ToString()));
}
else
{
Console.WriteLine(String.Format("Palavra '{0}' encontrada na posição {1}. Gatos mortos = {2}", word, result.index.ToString(), result.deadCats.ToString()));
}
}
示例14: ProcessTaskResult
/// <summary>
/// Constructor of ProcessTaskResult
/// </summary>
/// <param name="result">Process result data.</param>
/// <param name="ignoreStandardOutputOnSuccess">Set this to true if you do not want the standard output (stdout) of the process to be merged in the build log; otherwise false.</param>
public ProcessTaskResult(ProcessResult result, bool ignoreStandardOutputOnSuccess)
{
this.result = result;
this.ignoreStandardOutputOnSuccess = ignoreStandardOutputOnSuccess;
if (this.CheckIfSuccess())
{
Log.Info("Task output: " + result.StandardOutput);
string input = result.StandardError;
if (!string.IsNullOrEmpty(input))
Log.Info("Task error: " + result.StandardError);
}
}
示例15: LogStatistics
public void LogStatistics(Settings settings, ProcessResult result)
{
DateTime now = DateTime.Now;
string path = GetLogFilePath(now, settings);
string timestamp = GetTimeStamp(now);
XmlDocument doc = GetXmlDocument(path);
XmlNode root = GetRootNode(doc);
AppendTimestampNode(result, timestamp, doc, root);
Save(doc, path);
}