2021-11-09 12:36:25 -05:00
|
|
|
// Copyright Epic Games, Inc. All Rights Reserved.
|
|
|
|
|
|
|
|
|
|
using EpicGames.Core;
|
|
|
|
|
using Microsoft.Extensions.Logging;
|
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using System.Xml;
|
|
|
|
|
|
|
|
|
|
namespace EpicGames.BuildGraph
|
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// A task invocation
|
|
|
|
|
/// </summary>
|
|
|
|
|
public class BgTask
|
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Line number in a source file that this task was declared. Optional; used for log messages.
|
|
|
|
|
/// </summary>
|
2021-11-16 14:07:30 -05:00
|
|
|
public BgScriptLocation Location { get; }
|
2021-11-09 12:36:25 -05:00
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Name of the task
|
|
|
|
|
/// </summary>
|
|
|
|
|
public string Name { get; set; }
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Arguments for the task
|
|
|
|
|
/// </summary>
|
|
|
|
|
public Dictionary<string, string> Arguments { get; } = new Dictionary<string, string>();
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Constructor
|
|
|
|
|
/// </summary>
|
2021-11-16 14:07:30 -05:00
|
|
|
public BgTask(BgScriptLocation Location, string Name)
|
2021-11-09 12:36:25 -05:00
|
|
|
{
|
2021-11-16 14:07:30 -05:00
|
|
|
this.Location = Location;
|
2021-11-09 12:36:25 -05:00
|
|
|
this.Name = Name;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Write to an xml file
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="Writer"></param>
|
|
|
|
|
public void Write(XmlWriter Writer)
|
|
|
|
|
{
|
|
|
|
|
Writer.WriteStartElement(Name);
|
|
|
|
|
foreach (KeyValuePair<string, string> Argument in Arguments)
|
|
|
|
|
{
|
|
|
|
|
Writer.WriteAttributeString(Argument.Key, Argument.Value);
|
|
|
|
|
}
|
|
|
|
|
Writer.WriteEndElement();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|