本文整理汇总了C#中ProcessResult类的典型用法代码示例。如果您正苦于以下问题:C# ProcessResult类的具体用法?C# ProcessResult怎么用?C# ProcessResult使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ProcessResult类属于命名空间,在下文中一共展示了ProcessResult类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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()));
}
开发者ID:100052610,项目名称:PFC,代码行数:35,代码来源:AbstractWorker.cs
示例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() + "%");
}
}
}
}
开发者ID:StefanN,项目名称:DojoTimer-for-.Net,代码行数:25,代码来源:FormStatusReport.cs
示例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;
}
开发者ID:CragonGame,项目名称:GameCloud.IM,代码行数:13,代码来源:ProcessResult.cs
示例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;
}
开发者ID:kascomp,项目名称:CruiseControl.NET,代码行数:28,代码来源:ProcessExecutorStub.cs
示例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;
}
开发者ID:StefanN,项目名称:DojoTimer-for-.Net,代码行数:30,代码来源:ContinuousIntegrationClientProcess.cs
示例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;
}
开发者ID:BorisVaskin,项目名称:TemplateEngine.Docx,代码行数:28,代码来源:TableProcessor.cs
示例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);
}
开发者ID:haugholt,项目名称:MoneyOverview,代码行数:9,代码来源:InternalMatcher.cs
示例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;
}
开发者ID:tseel,项目名称:ccnet.freevcs.plugin,代码行数:16,代码来源:JediVCSHistoryParser.cs
示例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));
}
开发者ID:kascomp,项目名称:CruiseControl.NET,代码行数:10,代码来源:VssApplyLabelTest.cs
示例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();
}
}
开发者ID:ue4sucks,项目名称:ue4sucks,代码行数:10,代码来源:ProcessLog.cs
示例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);
}
}
开发者ID:vardars,项目名称:ci-factory,代码行数:10,代码来源:ProcessTaskResult.cs
示例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);
}
开发者ID:MartinF,项目名称:Dynamo.Jiss,代码行数:10,代码来源:ExecuteHelper.cs
示例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()));
}
}
开发者ID:felipecembranelli,项目名称:WordSearch,代码行数:17,代码来源:Program.cs
示例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);
}
}
开发者ID:BiYiTuan,项目名称:CruiseControl.NET,代码行数:18,代码来源:ProcessTaskResult.cs
示例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);
}
开发者ID:StefanN,项目名称:DojoTimer-for-.Net,代码行数:13,代码来源:StatisticsLogger.cs
示例16: ReadStandardErrorOnlyReturnsOutputLines
public void ReadStandardErrorOnlyReturnsOutputLines()
{
var filename = "testoutput.txt";
var fileSystemMock = GenerateFileSystemMock(filename, "OLine 1", "ELine 2");
var result = new ProcessResult(
fileSystemMock.Object,
filename,
0,
false);
var actual = result.ReadStandardError().ToArray();
var expected = new[] { "Line 2" };
CollectionAssert.AreEqual(expected, actual);
}
开发者ID:BiYiTuan,项目名称:CruiseControl.NET,代码行数:13,代码来源:ProcessResultTests.cs
示例17: FillContent
public void FillContent(XElement contentControl, IContentItem item)
{
if (!(item is ImageContent))
{
_processResult = ProcessResult.NotHandledResult;
return;
}
var field = item as ImageContent;
// If image bytes was not provided, then doing nothing
if (field.Binary == null || field.Binary.Length == 0) { return; }
// If there isn't a field with that name, add an error to the error string,
// and continue with next field.
if (contentControl == null)
{
_processResult.Errors.Add(String.Format("Field Content Control '{0}' not found.",
field.Name));
return;
}
var blip = contentControl.DescendantsAndSelf(A.blip).First();
if (blip == null)
{
_processResult.Errors.Add(String.Format("Image to replace for '{0}' not found.",
field.Name));
return;
}
// Creating a new image part
var imagePart = _context.WordDocument.MainDocumentPart.AddImagePart(field.MIMEType);
// Writing image bytes to it
using (BinaryWriter writer = new BinaryWriter(imagePart.GetStream()))
{
writer.Write(field.Binary);
}
// Setting reference for CC to newly uploaded image
blip.Attribute(R.embed).Value = _context.WordDocument.MainDocumentPart.GetIdOfPart(imagePart);
//var imageId = blip.Attribute(R.embed).Value;
//var xmlPart = _context.WordDocument.MainDocumentPart.GetPartById(imageId);
//if (xmlPart is ImagePart)
//{
// ImagePart imagePart = xmlPart as ImagePart;
// using (BinaryWriter writer = new BinaryWriter(imagePart.GetStream()))
// {
// writer.Write(field.Binary);
// }
//}
}
开发者ID:BorisVaskin,项目名称:TemplateEngine.Docx,代码行数:51,代码来源:ImageProcessor.cs
示例18: FillContent
public ProcessResult FillContent(XElement contentControl, IEnumerable<IContentItem> items)
{
_processResult = new ProcessResult();
foreach (var contentItem in items)
{
FillContent(contentControl, contentItem);
}
if (_processResult.Success && _isNeedToRemoveContentControls)
contentControl.RemoveContentControl();
return _processResult;
}
开发者ID:BorisVaskin,项目名称:TemplateEngine.Docx,代码行数:15,代码来源:FieldsProcessor.cs
示例19: TryExecute
public static bool TryExecute(string filename, string args, out ProcessResult result)
{
// Set HomeDirectory for shorter paths ?
if (filename == null)
throw new ArgumentNullException("filename");
if (args == null)
args = string.Empty;
string output = string.Empty;
string error = string.Empty;
int exitCode = -1;
var processStartInfo = new ProcessStartInfo(filename, args)
{
CreateNoWindow = true,
WindowStyle = ProcessWindowStyle.Hidden,
UseShellExecute = false,
RedirectStandardOutput = true,
RedirectStandardError = true
// WorkingDirectory ?
};
// Try Execute
try
{
using (var process = Process.Start(processStartInfo))
{
output = process.StandardOutput.ReadToEnd();
error = process.StandardError.ReadToEnd();
exitCode = process.ExitCode;
//if (!process.HasExited) // Needed ? Dispose will probably fix this ?
// process.Kill();
}
}
catch (Exception e)
{
// Store exeception in ExecuteResult ?
// Log error somehow ? try/catch in caller instead ?
// Output to output, or ErrorList ?
}
result = new ProcessResult(output, error, exitCode);
return result.ExitCode == 0;
}
开发者ID:MartinF,项目名称:Dynamo.Jiss,代码行数:47,代码来源:ExecuteHelper.cs
示例20: StartProcess
public static ProcessResult StartProcess(string workingDirectory, string cmdName, string argument, ProcessWindowStyle style = ProcessWindowStyle.Hidden)
{
ProcessResult rlt = new ProcessResult();
Process proc = new Process();
proc.StartInfo.UseShellExecute = false;
proc.StartInfo.RedirectStandardOutput = true;
proc.StartInfo.FileName = cmdName;
proc.StartInfo.Arguments = argument;
proc.StartInfo.WindowStyle = style;
proc.StartInfo.WorkingDirectory = workingDirectory;
proc.StartInfo.CreateNoWindow = true;
proc.Start();
StreamReader reader = proc.StandardOutput;
proc.WaitForExit();
rlt.Process = proc;
return rlt;
}
开发者ID:mind0n,项目名称:hive,代码行数:17,代码来源:Native.FileSystem.cs
注:本文中的ProcessResult类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论