in src/Microsoft.VisualStudio.SlowCheetah/Transformer/XmlTransformer.cs [110:152]
public bool Transform(string sourcePath, string transformPath, string destinationPath)
{
if (string.IsNullOrWhiteSpace(sourcePath))
{
throw new ArgumentNullException(nameof(sourcePath));
}
if (string.IsNullOrWhiteSpace(transformPath))
{
throw new ArgumentNullException(nameof(transformPath));
}
if (string.IsNullOrWhiteSpace(destinationPath))
{
throw new ArgumentNullException(nameof(destinationPath));
}
if (!File.Exists(sourcePath))
{
throw new FileNotFoundException(Resources.Resources.ErrorMessage_SourceFileNotFound, sourcePath);
}
if (!File.Exists(transformPath))
{
throw new FileNotFoundException(Resources.Resources.ErrorMessage_TransformFileNotFound, transformPath);
}
using (XmlTransformableDocument document = new XmlTransformableDocument())
using (XmlTransformation transformation = new XmlTransformation(transformPath, this.logger))
{
document.PreserveWhitespace = true;
document.Load(sourcePath);
var success = transformation.Apply(document);
if (success)
{
document.Save(destinationPath);
}
return success;
}
}