本文整理汇总了C#中Microsoft.Build.Framework.TaskFinishedEventArgs类的典型用法代码示例。如果您正苦于以下问题:C# TaskFinishedEventArgs类的具体用法?C# TaskFinishedEventArgs怎么用?C# TaskFinishedEventArgs使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
TaskFinishedEventArgs类属于Microsoft.Build.Framework命名空间,在下文中一共展示了TaskFinishedEventArgs类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: VerifyEventType
public void VerifyEventType()
{
BuildFinishedEventArgs buildFinished = new BuildFinishedEventArgs("Message", "Keyword", true);
BuildStartedEventArgs buildStarted = new BuildStartedEventArgs("Message", "Help");
BuildMessageEventArgs lowMessage = new BuildMessageEventArgs("Message", "help", "sender", MessageImportance.Low);
TaskStartedEventArgs taskStarted = new TaskStartedEventArgs("message", "help", "projectFile", "taskFile", "taskName");
TaskFinishedEventArgs taskFinished = new TaskFinishedEventArgs("message", "help", "projectFile", "taskFile", "taskName", true);
TaskCommandLineEventArgs commandLine = new TaskCommandLineEventArgs("commandLine", "taskName", MessageImportance.Low);
BuildWarningEventArgs warning = new BuildWarningEventArgs("SubCategoryForSchemaValidationErrors", "MSB4000", "file", 1, 2, 3, 4, "message", "help", "sender");
BuildErrorEventArgs error = new BuildErrorEventArgs("SubCategoryForSchemaValidationErrors", "MSB4000", "file", 1, 2, 3, 4, "message", "help", "sender");
TargetStartedEventArgs targetStarted = new TargetStartedEventArgs("message", "help", "targetName", "ProjectFile", "targetFile");
TargetFinishedEventArgs targetFinished = new TargetFinishedEventArgs("message", "help", "targetName", "ProjectFile", "targetFile", true);
ProjectStartedEventArgs projectStarted = new ProjectStartedEventArgs(-1, "message", "help", "ProjectFile", "targetNames", null, null, null);
ProjectFinishedEventArgs projectFinished = new ProjectFinishedEventArgs("message", "help", "ProjectFile", true);
ExternalProjectStartedEventArgs externalStartedEvent = new ExternalProjectStartedEventArgs("message", "help", "senderName", "projectFile", "targetNames");
VerifyLoggingPacket(buildFinished, LoggingEventType.BuildFinishedEvent);
VerifyLoggingPacket(buildStarted, LoggingEventType.BuildStartedEvent);
VerifyLoggingPacket(lowMessage, LoggingEventType.BuildMessageEvent);
VerifyLoggingPacket(taskStarted, LoggingEventType.TaskStartedEvent);
VerifyLoggingPacket(taskFinished, LoggingEventType.TaskFinishedEvent);
VerifyLoggingPacket(commandLine, LoggingEventType.TaskCommandLineEvent);
VerifyLoggingPacket(warning, LoggingEventType.BuildWarningEvent);
VerifyLoggingPacket(error, LoggingEventType.BuildErrorEvent);
VerifyLoggingPacket(targetStarted, LoggingEventType.TargetStartedEvent);
VerifyLoggingPacket(targetFinished, LoggingEventType.TargetFinishedEvent);
VerifyLoggingPacket(projectStarted, LoggingEventType.ProjectStartedEvent);
VerifyLoggingPacket(projectFinished, LoggingEventType.ProjectFinishedEvent);
VerifyLoggingPacket(externalStartedEvent, LoggingEventType.CustomEvent);
}
示例2: EventArgsCtors
public void EventArgsCtors()
{
TaskFinishedEventArgs targetFinishedEvent = new TaskFinishedEventArgs2();
targetFinishedEvent = new TaskFinishedEventArgs("Message", "HelpKeyword", "ProjectFile", "TaskFile", "TaskName", true);
targetFinishedEvent = new TaskFinishedEventArgs("Message", "HelpKeyword", "ProjectFile", "TaskFile", "TaskName", true, DateTime.Now);
targetFinishedEvent = new TaskFinishedEventArgs(null, null, null, null, null, true);
targetFinishedEvent = new TaskFinishedEventArgs(null, null, null, null, null, true, DateTime.Now);
}
示例3: BuildMessage
public BuildMessage(TaskFinishedEventArgs args)
{
EventType = args.GetType().Name.Replace("EventArgs", "");
Message = args.Message;
ProjectFile = args.ProjectFile;
Succeeded = args.Succeeded;
TaskFile = args.TaskFile;
TaskName = args.TaskName;
HelpKeyword = args.HelpKeyword;
SenderName = args.SenderName;
Timestamp = args.Timestamp;
ThreadId = args.ThreadId;
}
示例4: AssignmentTest
public void AssignmentTest ()
{
TaskFinishedEventArgs tfea;
string message = "message";
string helpKeyword = "helpKeyword";
string projectFile = "projectFile";
string taskFile = "taskFile";
string taskName = "taskName";
bool succeeded = true;
tfea = new TaskFinishedEventArgs (message, helpKeyword, projectFile, taskFile, taskName, succeeded);
Assert.AreEqual (message, tfea.Message, "Message");
Assert.AreEqual (helpKeyword, tfea.HelpKeyword, "HelpKeyword");
Assert.AreEqual (projectFile, tfea.ProjectFile, "ProjectFile");
Assert.AreEqual (taskFile, tfea.TaskFile, "TaskFile");
Assert.AreEqual (taskName, tfea.TaskName, "TaskName");
Assert.AreEqual (succeeded, tfea.Succeeded, "Succeeded");
}
示例5: TaskFinished
void TaskFinished(object sender, TaskFinishedEventArgs e)
{
AppendLine(string.Format("#####Task Finished:{0}", e.Message.EscapeMarkdownCharacters()));
if (IsVerbosityAtLeast(LoggerVerbosity.Detailed)) {
AppendLine(e.ToPropertyValues().ToMarkdownTable().ToMarkdown());
}
var startInfo = _tasksStarted.Pop();
var execInfo = new TaskExecutionInfo(startInfo, e);
TaskExecutionInfo previousExecInfo;
this._taskExecuted.TryGetValue(e.TaskName, out previousExecInfo);
if (previousExecInfo != null) {
execInfo.TimeSpent = execInfo.TimeSpent.Add(previousExecInfo.TimeSpent);
}
this._taskExecuted[execInfo.Name] = execInfo;
}
示例6: eventSource_TaskFinishedHandler
private void eventSource_TaskFinishedHandler(object sender, TaskFinishedEventArgs e)
{
LogStageFinished(e.Succeeded, e.Timestamp);
}
示例7: TaskFinishedHandler
public abstract void TaskFinishedHandler(object sender, TaskFinishedEventArgs e);
示例8: OnTaskFinished
void OnTaskFinished(object sender, TaskFinishedEventArgs e)
{
if (isActive) {
baseLogger.Shutdown();
isActive = false;
}
}
示例9: TestLoggingEventCustomerSerialization
public void TestLoggingEventCustomerSerialization()
{
Hashtable loggingTypeCacheWrites = new Hashtable();
stream.Position = 0;
BuildEventContext context = new BuildEventContext(1,3,5,7);
GenericBuildEventArg genericBuildEvent = new GenericBuildEventArg("Message","Help","Sender");
genericBuildEvent.BuildEventContext = context;
NodeLoggingEvent genericBuildEventLoggingEvent = new NodeLoggingEvent(genericBuildEvent);
genericBuildEventLoggingEvent.WriteToStream(writer, loggingTypeCacheWrites);
GenericCustomBuildEventArg genericCustomEvent = new GenericCustomBuildEventArg("FooFighter");
genericCustomEvent.BuildEventContext = context;
NodeLoggingEvent genericCustomEventLoggingEvent = new NodeLoggingEvent(genericCustomEvent);
genericCustomEventLoggingEvent.WriteToStream(writer, loggingTypeCacheWrites);
BuildErrorEventArgs errorEvent = new BuildErrorEventArgs("Subcategory", "Code", "File", 1, 2, 3, 4, "Message", "HelpKeyword", "SenderName");
errorEvent.BuildEventContext = context;
NodeLoggingEvent errorEventLoggingEvent = new NodeLoggingEvent(errorEvent);
errorEventLoggingEvent.WriteToStream(writer, loggingTypeCacheWrites);
BuildMessageEventArgs messageEvent = new BuildMessageEventArgs("Message", "HelpKeyword", "SenderName",MessageImportance.High);
messageEvent.BuildEventContext = context;
NodeLoggingEvent messageEventLoggingEvent = new NodeLoggingEvent(messageEvent);
messageEventLoggingEvent.WriteToStream(writer, loggingTypeCacheWrites);
BuildWarningEventArgs warningEvent = new BuildWarningEventArgs("Subcategory", "Code", "File", 1, 2, 3, 4, "Message", "HelpKeyword", "SenderName");
warningEvent.BuildEventContext = context;
NodeLoggingEvent warningEventLoggingEvent = new NodeLoggingEvent(warningEvent);
warningEventLoggingEvent.WriteToStream(writer, loggingTypeCacheWrites);
ProjectStartedEventArgs projectStartedEvent = new ProjectStartedEventArgs( 8,"Message", "HelpKeyword", "ProjectFile", "TargetNames", null, null, new BuildEventContext(7,8,9,10));
projectStartedEvent.BuildEventContext = context;
NodeLoggingEvent projectStartedEventLoggingEvent = new NodeLoggingEvent(projectStartedEvent);
projectStartedEventLoggingEvent.WriteToStream(writer, loggingTypeCacheWrites);
ProjectFinishedEventArgs projectFinishedEvent = new ProjectFinishedEventArgs("Message", "HelpKeyword","ProjectFile",true);
projectFinishedEvent.BuildEventContext = context;
NodeLoggingEvent projectFinishedEventLoggingEvent = new NodeLoggingEvent(projectFinishedEvent);
projectFinishedEventLoggingEvent.WriteToStream(writer, loggingTypeCacheWrites);
TargetStartedEventArgs targetStartedEvent = new TargetStartedEventArgs("Message", "HelpKeyword", "TargetName", "ProjectFile", "TargetFile");
targetStartedEvent.BuildEventContext = context;
NodeLoggingEvent targetStartedEventLoggingEvent = new NodeLoggingEvent(targetStartedEvent);
targetStartedEventLoggingEvent.WriteToStream(writer, loggingTypeCacheWrites);
TargetFinishedEventArgs targetFinished = new TargetFinishedEventArgs("Message", "HelpKeyword","TargetName", "ProjectFile", "TargetFile", true);
targetFinished.BuildEventContext = context;
NodeLoggingEvent targetFinishedEventLoggingEvent = new NodeLoggingEvent(targetFinished);
targetFinishedEventLoggingEvent.WriteToStream(writer, loggingTypeCacheWrites);
TaskStartedEventArgs taskStartedEvent = new TaskStartedEventArgs("Message", "HelpKeyword", "ProjectFile", "TaskFile", "TaskName");
taskStartedEvent.BuildEventContext = context;
NodeLoggingEvent taskStartedEventLoggingEvent = new NodeLoggingEvent(taskStartedEvent);
taskStartedEventLoggingEvent.WriteToStream(writer, loggingTypeCacheWrites);
TaskFinishedEventArgs taskFinishedEvent = new TaskFinishedEventArgs("Message", "HelpKeyword", "ProjectFile", "TaskFile", "TaskName", true);
taskFinishedEvent.BuildEventContext = context;
NodeLoggingEvent taskFinishedEventLoggingEvent = new NodeLoggingEvent(taskFinishedEvent);
taskFinishedEventLoggingEvent.WriteToStream(writer, loggingTypeCacheWrites);
BuildFinishedEventArgs buildFinishedEvent = new BuildFinishedEventArgs("Message","Help",true);
buildFinishedEvent.BuildEventContext = context;
NodeLoggingEvent buildFinishedEventEventLoggingEvent = new NodeLoggingEvent(buildFinishedEvent);
buildFinishedEventEventLoggingEvent.WriteToStream(writer, loggingTypeCacheWrites);
BuildStartedEventArgs buildStartedEvent = new BuildStartedEventArgs("Message","Help");
buildStartedEvent.BuildEventContext = context;
NodeLoggingEvent buildStartedEventLoggingEvent = new NodeLoggingEvent(buildStartedEvent);
buildStartedEventLoggingEvent.WriteToStream(writer, loggingTypeCacheWrites);
TaskCommandLineEventArgs commandlineEventArg = new TaskCommandLineEventArgs("CommandLine","TaskName", MessageImportance.High);
commandlineEventArg.BuildEventContext = context;
NodeLoggingEvent commandlineEventArgLoggingEvent = new NodeLoggingEvent(commandlineEventArg);
commandlineEventArgLoggingEvent.WriteToStream(writer, loggingTypeCacheWrites);
Hashtable loggingTypeCacheReads = new Hashtable();
long streamWriteEndPosition = stream.Position;
stream.Position = 0;
NodeLoggingEvent nodeLoggingEvent = new NodeLoggingEvent(null);
nodeLoggingEvent.CreateFromStream(reader, loggingTypeCacheReads);
Assert.IsTrue(nodeLoggingEvent.BuildEvent.GetType() == typeof(GenericBuildEventArg));
nodeLoggingEvent = new NodeLoggingEvent(null);
nodeLoggingEvent.CreateFromStream(reader, loggingTypeCacheReads);
Assert.IsTrue(nodeLoggingEvent.BuildEvent.GetType() == typeof(GenericCustomBuildEventArg));
nodeLoggingEvent = new NodeLoggingEvent(null);
nodeLoggingEvent.CreateFromStream(reader, loggingTypeCacheReads);
Assert.IsTrue(nodeLoggingEvent.BuildEvent.GetType() == typeof(BuildErrorEventArgs));
nodeLoggingEvent = new NodeLoggingEvent(null);
nodeLoggingEvent.CreateFromStream(reader, loggingTypeCacheReads);
Assert.IsTrue(nodeLoggingEvent.BuildEvent.GetType() == typeof(BuildMessageEventArgs));
nodeLoggingEvent = new NodeLoggingEvent(null);
nodeLoggingEvent.CreateFromStream(reader, loggingTypeCacheReads);
Assert.IsTrue(nodeLoggingEvent.BuildEvent.GetType() == typeof(BuildWarningEventArgs));
nodeLoggingEvent = new NodeLoggingEvent(null);
//.........这里部分代码省略.........
示例10: VerifyTaskFinished
/// <summary>
/// Compare two task finished events
/// </summary>
private static void VerifyTaskFinished(TaskFinishedEventArgs genericEvent, TaskFinishedEventArgs newGenericEvent)
{
Assert.IsTrue(genericEvent.Succeeded == newGenericEvent.Succeeded, "Expected Succeeded to Match");
Assert.IsTrue(string.Compare(genericEvent.ProjectFile, newGenericEvent.ProjectFile, StringComparison.OrdinalIgnoreCase) == 0, "Expected ProjectFile to Match");
Assert.IsTrue(string.Compare(genericEvent.TaskFile, newGenericEvent.TaskFile, StringComparison.OrdinalIgnoreCase) == 0, "Expected TaskFile to Match");
Assert.IsTrue(string.Compare(genericEvent.TaskName, newGenericEvent.TaskName, StringComparison.OrdinalIgnoreCase) == 0, "Expected TaskName to Match");
}
示例11: TestTaskFinishedEventArgs
public void TestTaskFinishedEventArgs()
{
// Test using reasonable values
TaskFinishedEventArgs genericEvent = new TaskFinishedEventArgs("Message", "HelpKeyword", "ProjectFile", "TaskFile", "TaskName", true);
genericEvent.BuildEventContext = new BuildEventContext(5, 4, 3, 2);
// Serialize
genericEvent.WriteToStream(_writer);
long streamWriteEndPosition = _stream.Position;
// Deserialize and Verify
_stream.Position = 0;
TaskFinishedEventArgs newGenericEvent = new TaskFinishedEventArgs(null, null, null, null, null, false);
newGenericEvent.CreateFromStream(_reader, _eventArgVersion);
long streamReadEndPosition = _stream.Position;
Assert.IsTrue(streamWriteEndPosition == streamReadEndPosition, "Stream End Positions Should Match");
VerifyGenericEventArg(genericEvent, newGenericEvent);
VerifyTaskFinished(genericEvent, newGenericEvent);
//Test using empty strings
_stream.Position = 0;
// Make sure empty strings are passed correctly
genericEvent = new TaskFinishedEventArgs(string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, true);
genericEvent.BuildEventContext = new BuildEventContext(5, 4, 3, 2);
// Serialize
genericEvent.WriteToStream(_writer);
streamWriteEndPosition = _stream.Position;
// Deserialize and Verify
_stream.Position = 0;
newGenericEvent = new TaskFinishedEventArgs(null, null, null, null, null, false);
newGenericEvent.CreateFromStream(_reader, _eventArgVersion);
streamReadEndPosition = _stream.Position;
Assert.IsTrue(streamWriteEndPosition == streamReadEndPosition, "Stream End Positions Should Match");
VerifyGenericEventArg(genericEvent, newGenericEvent);
VerifyTaskFinished(genericEvent, newGenericEvent);
//Test using null strings
_stream.Position = 0;
// Make sure null string are passed correctly
genericEvent = new TaskFinishedEventArgs(null, null, null, null, null, true);
genericEvent.BuildEventContext = null;
// Serialize
genericEvent.WriteToStream(_writer);
streamWriteEndPosition = _stream.Position;
// Deserialize and Verify
_stream.Position = 0;
newGenericEvent = new TaskFinishedEventArgs("Something", "Something", "Something", "Something", "Something", false);
newGenericEvent.CreateFromStream(_reader, _eventArgVersion);
streamReadEndPosition = _stream.Position;
Assert.IsTrue(streamWriteEndPosition == streamReadEndPosition, "Stream End Positions Should Match");
VerifyGenericEventArg(genericEvent, newGenericEvent);
VerifyTaskFinished(genericEvent, newGenericEvent);
}
示例12: OnTaskFinished
// registered when only specific tasks should be forwarded
void OnTaskFinished(object sender, TaskFinishedEventArgs e)
{
if (program.currentJob.InterestingTaskNames.Contains(e.TaskName))
OnEvent(sender, e);
}
示例13: TaskFinishedHandler
/// <summary>
/// Handler for task finished events
/// </summary>
/// <param name="sender">sender (should be null)</param>
/// <param name="e">event arguments</param>
public override void TaskFinishedHandler(object sender, TaskFinishedEventArgs e)
{
// Done with the task, so shift everything left again.
this.currentIndentLevel--;
if (this.showPerfSummary)
{
PerformanceCounter counter = GetPerformanceCounter(e.TaskName, ref taskPerformanceCounters);
// Place the counter "in scope" meaning the task is done executing.
counter.InScope = false;
}
// if verbosity is detailed or diagnostic
if (IsVerbosityAtLeast(LoggerVerbosity.Detailed))
{
setColor(ConsoleColor.Cyan);
WriteLinePretty(e.Message);
resetColor();
}
}
示例14: TaskFinished
void TaskFinished(object sender, TaskFinishedEventArgs e)
{
XmlElement taskElement = taskElements.Pop();
taskElement.Attributes.Append(CreateFinishedAttribute(e.Timestamp));
if (base.IsVerbosityAtLeast(LoggerVerbosity.Detailed))
{
taskElement.Attributes.Append(CreateAttribute("FinishMessage", e.Message));
taskElement.Attributes.Append(CreateAttribute("ProjectFile", e.ProjectFile));
taskElement.Attributes.Append(CreateAttribute("TaskFile", e.TaskFile));
}
buildTypeList.Pop();
}
示例15: TaskExecutionInfo
public TaskExecutionInfo(TaskStartedEventArgs startedArgs, TaskFinishedEventArgs finishedArgs)
{
this.Name = startedArgs.TaskName;
this.TimeSpent = finishedArgs.Timestamp.Subtract(startedArgs.Timestamp);
}