in src/Microsoft.VisualStudio.SlowCheetah/Transformer/JsonTransformer.cs [84:125]
public bool Transform(string sourcePath, string transformPath, string destinationPath)
{
if (string.IsNullOrWhiteSpace(sourcePath))
{
throw new ArgumentException($"{nameof(sourcePath)} cannot be null or whitespace");
}
if (string.IsNullOrWhiteSpace(transformPath))
{
throw new ArgumentException($"{nameof(transformPath)} cannot be null or whitespace");
}
if (string.IsNullOrWhiteSpace(destinationPath))
{
throw new ArgumentException($"{nameof(destinationPath)} cannot be null or whitespace");
}
if (!File.Exists(sourcePath))
{
throw new FileNotFoundException(Resources.Resources.ErrorMessage_SourceFileNotFound, sourcePath);
}
if (!File.Exists(transformPath))
{
throw new FileNotFoundException(Resources.Resources.ErrorMessage_TransformFileNotFound, transformPath);
}
var transformation = new JsonTransformation(transformPath, this.logger);
try
{
using (Stream result = transformation.Apply(sourcePath))
{
return this.TrySaveToFile(result, sourcePath, destinationPath);
}
}
catch
{
// JDT exceptions are handled by it's own logger
return false;
}
}