66 lines
No EOL
2.6 KiB
C#
66 lines
No EOL
2.6 KiB
C#
using System.Xml;
|
|
using TeaBox.Macros;
|
|
|
|
namespace TeaBox.BuildVersion
|
|
{
|
|
internal class MakeXboxOnePatchCommand : MakeXboxOnePackageCommand
|
|
{
|
|
protected override void PrePackageImpl()
|
|
{
|
|
UpdateChunkMappingForPatch();
|
|
base.PrePackageImpl();
|
|
}
|
|
|
|
protected override void PackageDataAssemblyImpl(IStep stepcontext)
|
|
{
|
|
CopyExecutableFromOutput(stepcontext);
|
|
CopyDataMasterToDiscWorkingDirectory(stepcontext);
|
|
CopyPatchDataToDiscWorkingDirectory(stepcontext);
|
|
}
|
|
|
|
protected void UpdateChunkMappingForPatch()
|
|
{
|
|
// Values of attributes for FileGroup Element Of Xml
|
|
const string destinationPathString = @"\";
|
|
const string sourcePathString = @".\";
|
|
const string includeString = "patch_durango.ipk";
|
|
|
|
// Instantiate New XmlDocument And Load XML From File
|
|
var xmlDocument = new XmlDocument();
|
|
xmlDocument.Load(LayoutPath);
|
|
|
|
// Create Chunk Element
|
|
var chunkElement = xmlDocument.CreateElement("Chunk");
|
|
// Set Chunk Attributes
|
|
// Id Attribute
|
|
var idAttribute = xmlDocument.CreateAttribute("Id");
|
|
idAttribute.Value = "2";
|
|
chunkElement.Attributes.Append(idAttribute);
|
|
|
|
// Create FileGroup Element under Chunk/Id
|
|
var fileGroupElement = xmlDocument.CreateElement("FileGroup");
|
|
// Set FileGroup Attributes
|
|
// DestinationPath attribute
|
|
var destinationAttribue = xmlDocument.CreateAttribute("DestinationPath");
|
|
destinationAttribue.Value = destinationPathString;
|
|
fileGroupElement.Attributes.Append(destinationAttribue);
|
|
// SourcePath attribute
|
|
var sourcePathAttribute = xmlDocument.CreateAttribute("SourcePath");
|
|
sourcePathAttribute.Value = sourcePathString;
|
|
fileGroupElement.Attributes.Append(sourcePathAttribute);
|
|
// Include attribute
|
|
var includeStringAttribute = xmlDocument.CreateAttribute("Include");
|
|
includeStringAttribute.Value = includeString;
|
|
fileGroupElement.Attributes.Append(includeStringAttribute);
|
|
|
|
// Insert FileGroup As Child of Chunk Element
|
|
chunkElement.InsertAfter(fileGroupElement, chunkElement.FirstChild);
|
|
// Insert Chunk As Node Of Package
|
|
var parentNode = xmlDocument.SelectSingleNode("Package");
|
|
parentNode.InsertAfter(chunkElement, parentNode.FirstChild);
|
|
|
|
// Save the XmlDocument
|
|
xmlDocument.Save(LayoutPath);
|
|
}
|
|
}
|
|
} |