in src/StructuredLogger/Serialization/XmlLogReader.cs [205:289]
private void PopulateAttributes(BaseNode node)
{
var item = node as Item;
if (item != null)
{
item.Name = GetString(AttributeNames.Name);
item.Text = GetString(AttributeNames.Text);
return;
}
var message = node as Message;
if (message != null)
{
message.IsLowRelevance = GetBoolean(AttributeNames.IsLowRelevance);
message.Timestamp = GetDateTime(AttributeNames.Timestamp);
return;
}
// then, shared "fall-through" tests that are common to many types of nodes
var namedNode = node as NamedNode;
if (namedNode != null)
{
namedNode.Name = GetString(AttributeNames.Name);
}
var textNode = node as TextNode;
if (textNode != null)
{
textNode.Text = GetString(AttributeNames.Text);
}
var timedNode = node as TimedNode;
if (timedNode != null)
{
AddStartAndEndTime(timedNode);
timedNode.NodeId = GetInteger(AttributeNames.NodeId);
}
// finally, concrete tests with early exit, sorted by commonality
var diagnostic = node as AbstractDiagnostic;
if (diagnostic != null)
{
diagnostic.Code = GetString(AttributeNames.Code);
diagnostic.File = GetString(AttributeNames.File);
diagnostic.LineNumber = GetInteger(AttributeNames.LineNumber);
diagnostic.ColumnNumber = GetInteger(AttributeNames.ColumnNumber);
diagnostic.EndLineNumber = GetInteger(AttributeNames.EndLineNumber);
diagnostic.EndColumnNumber = GetInteger(AttributeNames.EndColumnNumber);
diagnostic.ProjectFile = GetString(AttributeNames.ProjectFile);
return;
}
var task = node as Task;
if (task != null)
{
task.FromAssembly = GetString(AttributeNames.FromAssembly);
task.CommandLineArguments = GetString(AttributeNames.CommandLineArguments);
task.SourceFilePath = GetString(AttributeNames.File);
return;
}
var target = node as Target;
if (target != null)
{
target.IsLowRelevance = GetBoolean(AttributeNames.IsLowRelevance);
target.DependsOnTargets = GetString(AttributeNames.DependsOnTargets);
target.SourceFilePath = GetString(AttributeNames.File);
return;
}
var project = node as Project;
if (project != null)
{
project.ProjectFile = GetString(AttributeNames.ProjectFile);
return;
}
var build = node as Build;
if (build != null)
{
build.Succeeded = GetBoolean(AttributeNames.Succeeded);
build.IsAnalyzed = GetBoolean(AttributeNames.IsAnalyzed);
return;
}
}