Centralize list of warnings and errors. Generate artifacts from it. (#44)
We need to publish an HTML file that has more details about warnings and errors. But there are 3 different lists of issues (parsing, translation, and validation) and it would be difficult to keep everything in sync. With this commit we move the data into Issues.xml and add scripts to generate the C# classes and the HTML. Currently the generation has to be done manually, by: 1) Run GenerateIssuesClasses.cmd to update the C# classes. Requires texttransform.exe from the developer command prompt. 2) Run GenerateIssuesHtml.cmd to regenerate the html
This commit is contained in:
Родитель
8fd6e436c7
Коммит
771d2e588c
|
@ -0,0 +1,5 @@
|
|||
pushd %~dp0
|
||||
texttransform ParsingIssues.tt -out ..\LottieReader\Serialization\ParsingIssues.cs
|
||||
texttransform TranslationIssues.tt -out ..\LottieToWinComp\TranslationIssues.cs
|
||||
texttransform ValidationIssues.tt -out ..\LottieData\ValidationIssues.cs
|
||||
popd
|
|
@ -0,0 +1,3 @@
|
|||
@pushd %~dp0
|
||||
@PowerShell.exe -file "%~dpn0.ps1" %*
|
||||
@popd
|
|
@ -0,0 +1,7 @@
|
|||
# Generate the HTML version of the issues.
|
||||
$outputPath = '.\WarningsAndErrors.html'
|
||||
"Generating to $outputPath"
|
||||
|
||||
$xslt = New-Object System.Xml.Xsl.XslCompiledTransform;
|
||||
$xslt.Load('.\Issues.xslt');
|
||||
$xslt.Transform('.\Issues.xml', $outputPath);
|
|
@ -0,0 +1,231 @@
|
|||
<!--
|
||||
This file contains the issues that can be reported by LottieGen.
|
||||
-->
|
||||
<issues>
|
||||
|
||||
<!-- Parsing issues -->
|
||||
<issue>
|
||||
<id>LP0001</id>
|
||||
<text>Failed to parse JSON. {message}</text>
|
||||
<method>FailedToParseJson</method>
|
||||
</issue>
|
||||
<issue>
|
||||
<id>LP0002</id>
|
||||
<text>Fatal error: {message}</text>
|
||||
<method>FatalError</method>
|
||||
</issue>
|
||||
<issue>
|
||||
<id>LP0005</id>
|
||||
<text>Unsupported asset type: {type}</text>
|
||||
<method>AssetType</method>
|
||||
</issue>
|
||||
<issue>
|
||||
<id>LP0006</id>
|
||||
<text>Layer with render = false</text>
|
||||
<method>LayerWithRenderFalse</method>
|
||||
</issue>
|
||||
<issue>
|
||||
<id>LP0007</id>
|
||||
<text>Illustrator layers</text>
|
||||
<method>IllustratorLayers</method>
|
||||
</issue>
|
||||
<issue>
|
||||
<id>LP0008</id>
|
||||
<text>Layer effects</text>
|
||||
<method>LayerEffects</method>
|
||||
</issue>
|
||||
<issue>
|
||||
<id>LP0009</id>
|
||||
<text>Mattes</text>
|
||||
<method>Mattes</method>
|
||||
</issue>
|
||||
<issue>
|
||||
<id>LP0011</id>
|
||||
<text>Time remapping of precomp layers</text>
|
||||
<method>TimeRemappingOfPreComps</method>
|
||||
</issue>
|
||||
<issue>
|
||||
<id>LP0012</id>
|
||||
<text>Unexpected shape content type: {type}</text>
|
||||
<method>UnexpectedShapeContentType</method>
|
||||
</issue>
|
||||
<issue>
|
||||
<id>LP0013</id>
|
||||
<text>Gradient strokes</text>
|
||||
<method>GradientStrokes</method>
|
||||
</issue>
|
||||
<issue>
|
||||
<id>LP0014</id>
|
||||
<text>Polystar {property} animation</text>
|
||||
<method>PolystarAnimation</method>
|
||||
</issue>
|
||||
<issue>
|
||||
<id>LP0015</id>
|
||||
<text>Expressions</text>
|
||||
<method>Expressions</method>
|
||||
</issue>
|
||||
<issue>
|
||||
<id>LP0016</id>
|
||||
<text>Ignored field: {field}</text>
|
||||
<method>IgnoredField</method>
|
||||
</issue>
|
||||
<issue>
|
||||
<id>LP0017</id>
|
||||
<text>Unexpected field: {field}</text>
|
||||
<method>UnexpectedField</method>
|
||||
</issue>
|
||||
|
||||
<!-- Translation issues -->
|
||||
<issue>
|
||||
<id>LT0001</id>
|
||||
<text>Rectangle with animated size and TrimPath</text>
|
||||
<method>AnimatedRectangleWithTrimPath</method>
|
||||
</issue>
|
||||
<issue>
|
||||
<id>LT0002</id>
|
||||
<text>Animated trim offset with static trim offset</text>
|
||||
<method>AnimatedTrimOffsetWithStaticTrimOffset</method>
|
||||
</issue>
|
||||
<issue>
|
||||
<id>LT0003</id>
|
||||
<text>Multiplication of two or more animated values</text>
|
||||
<method>AnimationMultiplication</method>
|
||||
</issue>
|
||||
<issue>
|
||||
<id>LT0004</id>
|
||||
<text>Blend mode: {blendMode}</text>
|
||||
<method>BlendMode</method>
|
||||
</issue>
|
||||
<issue>
|
||||
<id>LT0005</id>
|
||||
<text>Combining animated shapes</text>
|
||||
<method>CombiningAnimatedShapes</method>
|
||||
</issue>
|
||||
<issue>
|
||||
<id>LT0006</id>
|
||||
<text>Gradient fill</text>
|
||||
<method>GradientFill</method>
|
||||
</issue>
|
||||
<issue>
|
||||
<id>LT0007</id>
|
||||
<text>Gradient stroke</text>
|
||||
<method>GradientStroke</method>
|
||||
</issue>
|
||||
<issue>
|
||||
<id>LT0008</id>
|
||||
<text>Image assets</text>
|
||||
<method>ImageAssets</method>
|
||||
</issue>
|
||||
<issue>
|
||||
<id>LT0009</id>
|
||||
<text>Image layers</text>
|
||||
<method>ImageLayer</method>
|
||||
</issue>
|
||||
<issue>
|
||||
<id>LT0010</id>
|
||||
<text>Merging a large number of shapes</text>
|
||||
<method>MergingALargeNumberOfShapes</method>
|
||||
</issue>
|
||||
<issue>
|
||||
<id>LT0011</id>
|
||||
<text>Multiple animated rounded corners</text>
|
||||
<method>MultipleAnimatedRoundedCorners</method>
|
||||
</issue>
|
||||
<issue>
|
||||
<id>LT0012</id>
|
||||
<text>Multiple fills</text>
|
||||
<method>MultipleFills</method>
|
||||
</issue>
|
||||
<issue>
|
||||
<id>LT0013</id>
|
||||
<text>Multiple strokes</text>
|
||||
<method>MultipleStrokes</method>
|
||||
</issue>
|
||||
<issue>
|
||||
<id>LT0014</id>
|
||||
<text>Multiple trim paths</text>
|
||||
<method>MultipleTrimPaths</method>
|
||||
</issue>
|
||||
<issue>
|
||||
<id>LT0015</id>
|
||||
<text>Opacity and color animated at the same time</text>
|
||||
<method>OpacityAndColorAnimatedTogether</method>
|
||||
</issue>
|
||||
<issue>
|
||||
<id>LT0016</id>
|
||||
<text>Path with rounded corners</text>
|
||||
<method>PathWithRoundedCorners</method>
|
||||
</issue>
|
||||
<issue>
|
||||
<id>LT0017</id>
|
||||
<text>Polystar</text>
|
||||
<method>Polystar</method>
|
||||
</issue>
|
||||
<issue>
|
||||
<id>LT0018</id>
|
||||
<text>Repeater</text>
|
||||
<method>Repeater</method>
|
||||
</issue>
|
||||
<issue>
|
||||
<id>LT0019</id>
|
||||
<text>Text layer</text>
|
||||
<method>TextLayer</method>
|
||||
</issue>
|
||||
<issue>
|
||||
<id>LT0020</id>
|
||||
<text>3d composition</text>
|
||||
<method>ThreeD</method>
|
||||
</issue>
|
||||
<issue>
|
||||
<id>LT0021</id>
|
||||
<text>3d layer</text>
|
||||
<method>ThreeDLayer</method>
|
||||
</issue>
|
||||
<issue>
|
||||
<id>LT0022</id>
|
||||
<text>Time stretch</text>
|
||||
<method>TimeStretch</method>
|
||||
</issue>
|
||||
<issue>
|
||||
<id>LT0023</id>
|
||||
<text>Mask with invert</text>
|
||||
<method>MaskWithInvert</method>
|
||||
</issue>
|
||||
<issue>
|
||||
<id>LT0024</id>
|
||||
<text>Mask mode: {mode}</text>
|
||||
<method>MaskWithUnsupportedMode</method>
|
||||
</issue>
|
||||
<issue>
|
||||
<id>LT0025</id>
|
||||
<text>Mask with alpha value other than 1</text>
|
||||
<method>MaskWithAlpha</method>
|
||||
</issue>
|
||||
<issue>
|
||||
<id>LT0026</id>
|
||||
<text>Mask with multiple shapes</text>
|
||||
<method>MultipleShapeMasks</method>
|
||||
</issue>
|
||||
<issue>
|
||||
<id>LT0027</id>
|
||||
<text>CombiningMultipleShapes</text>
|
||||
<method>CombiningMultipleShapes</method>
|
||||
</issue>
|
||||
|
||||
<!-- Validation issues -->
|
||||
<issue>
|
||||
<id>LV0001</id>
|
||||
<text>Layer {layerName} has in-point after out-point</text>
|
||||
<method>LayerHasInPointAfterOutPoint</method>
|
||||
</issue>
|
||||
<issue>
|
||||
<id>LV0002</id>
|
||||
<text>Layer {layerName} is in a cycle</text>
|
||||
<method>LayerInCycle</method>
|
||||
</issue>
|
||||
<issue>
|
||||
<id>LV0003</id>
|
||||
<text>Invalid layer parent: {layerParent}</text>
|
||||
<method>InvalidLayerParent</method>
|
||||
</issue>
|
||||
</issues>
|
|
@ -0,0 +1,34 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
|
||||
<xsl:output method="html" encoding="utf-8" indent="yes" />
|
||||
|
||||
<xsl:template match="/">
|
||||
<xsl:text disable-output-escaping='yes'><!DOCTYPE html></xsl:text>
|
||||
<html>
|
||||
<head>
|
||||
<title>Lottie-Windows warnings and errors</title>
|
||||
</head>
|
||||
<body>
|
||||
<div>List of errors and warnings.</div>
|
||||
<table>
|
||||
<xsl:for-each select="issues/issue">
|
||||
<tr>
|
||||
<td>
|
||||
<a>
|
||||
<xsl:attribute name="name">
|
||||
<xsl:value-of select="id"/>
|
||||
</xsl:attribute>
|
||||
</a>
|
||||
<xsl:value-of select="id"/>
|
||||
</td>
|
||||
<td>
|
||||
<xsl:value-of select="text"/>
|
||||
</td>
|
||||
</tr>
|
||||
</xsl:for-each>
|
||||
</table>
|
||||
</body>
|
||||
</html>
|
||||
</xsl:template>
|
||||
|
||||
</xsl:stylesheet>
|
|
@ -0,0 +1,80 @@
|
|||
<#@ template debug="false" hostspecific="false" language="C#" #>
|
||||
<#@ assembly name="System.Core" #>
|
||||
<#@ assembly name="System.Xml" #>
|
||||
<#@ assembly name="System.Xml.Linq" #>
|
||||
<#@ import namespace="System.Linq" #>
|
||||
<#@ import namespace="System.Text" #>
|
||||
<#@ import namespace="System.Text.RegularExpressions" #>
|
||||
<#@ import namespace="System.Collections.Generic" #>
|
||||
<#@ import namespace="System.Xml.Linq" #>
|
||||
<#@ output extension=".cs" encoding="utf-8" #>
|
||||
// Licensed to the .NET Foundation under one or more agreements.
|
||||
// The .NET Foundation licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
namespace <#=namespaceName#>
|
||||
{
|
||||
/// <summary>
|
||||
/// Issues.
|
||||
/// </summary>
|
||||
sealed class <#=className#>
|
||||
{
|
||||
readonly HashSet<(string Code, string Description)> _issues = new HashSet<(string Code, string Description)>();
|
||||
readonly bool _throwOnIssue;
|
||||
|
||||
internal <#=className#>(bool throwOnIssue)
|
||||
{
|
||||
_throwOnIssue = throwOnIssue;
|
||||
}
|
||||
|
||||
internal (string Code, string Description)[] GetIssues() => _issues.ToArray();
|
||||
<#
|
||||
var regex = new Regex("({.*?})");
|
||||
|
||||
var doc = XDocument.Load("Issues.xml");
|
||||
foreach (var issue in doc.Root.Elements())
|
||||
{
|
||||
var id = issue.Element("id").Value;
|
||||
if (id.StartsWith(prefixFilter))
|
||||
{
|
||||
var text = issue.Element("text").Value;
|
||||
var method = issue.Element("method").Value;
|
||||
|
||||
// Look for parameters in the string.
|
||||
var parameterMatches = regex.Matches(text);
|
||||
|
||||
// Create parameters for each of the parameters in the text.
|
||||
var parameters = regex.Matches(text).Cast<Match>().Select(m => $"string {m.Value.Substring(1, m.Value.Length - 2)}").Distinct().ToArray();
|
||||
var parameterList = string.Join(", ", parameters);
|
||||
var hasParameters = parameters.Any();
|
||||
|
||||
WriteLine("");
|
||||
WriteLine($" internal void {method}({parameterList}) => Report(\"{id}\", {(hasParameters ? "$" : "")}\"{text}\");");
|
||||
}
|
||||
}
|
||||
#>
|
||||
|
||||
void Report(string code, string description)
|
||||
{
|
||||
_issues.Add((code, description));
|
||||
|
||||
if (_throwOnIssue)
|
||||
{
|
||||
throw new NotSupportedException($"{code}: {description}");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,6 @@
|
|||
<#@ include file="IssuesClassGenerator.t4" #>
|
||||
<#+
|
||||
const string className = "ParsingIssues";
|
||||
const string namespaceName = "Microsoft.Toolkit.Uwp.UI.Lottie.LottieData.Serialization";
|
||||
const string prefixFilter = "LP";
|
||||
#>
|
|
@ -0,0 +1,6 @@
|
|||
<#@ include file="IssuesClassGenerator.t4" #>
|
||||
<#+
|
||||
const string className = "TranslationIssues";
|
||||
const string namespaceName = "Microsoft.Toolkit.Uwp.UI.Lottie.LottieToWinComp";
|
||||
const string prefixFilter = "LT";
|
||||
#>
|
|
@ -0,0 +1,6 @@
|
|||
<#@ include file="IssuesClassGenerator.t4" #>
|
||||
<#+
|
||||
const string className = "ValidationIssues";
|
||||
const string namespaceName = "Microsoft.Toolkit.Uwp.UI.Lottie.LottieData";
|
||||
const string prefixFilter = "LV";
|
||||
#>
|
|
@ -0,0 +1,187 @@
|
|||
<!DOCTYPE html><html>
|
||||
<head>
|
||||
<META http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||
<title>Lottie-Windows warnings and errors</title>
|
||||
</head>
|
||||
<body>
|
||||
<div>List of errors and warnings.</div>
|
||||
<table>
|
||||
<tr>
|
||||
<td><a name="LP0001"></a>LP0001</td>
|
||||
<td>Failed to parse JSON. {message}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a name="LP0002"></a>LP0002</td>
|
||||
<td>Fatal error: {message}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a name="LP0005"></a>LP0005</td>
|
||||
<td>Unsupported asset type: {type}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a name="LP0006"></a>LP0006</td>
|
||||
<td>Layer with render = false</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a name="LP0007"></a>LP0007</td>
|
||||
<td>Illustrator layers</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a name="LP0008"></a>LP0008</td>
|
||||
<td>Layer effects</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a name="LP0009"></a>LP0009</td>
|
||||
<td>Mattes</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a name="LP0011"></a>LP0011</td>
|
||||
<td>Time remapping of precomp layers</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a name="LP0012"></a>LP0012</td>
|
||||
<td>Unexpected shape content type: {type}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a name="LP0013"></a>LP0013</td>
|
||||
<td>Gradient strokes</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a name="LP0014"></a>LP0014</td>
|
||||
<td>Polystar {property} animation</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a name="LP0015"></a>LP0015</td>
|
||||
<td>Expressions</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a name="LP0016"></a>LP0016</td>
|
||||
<td>Ignored field: {field}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a name="LP0017"></a>LP0017</td>
|
||||
<td>Unexpected field: {field}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a name="LT0001"></a>LT0001</td>
|
||||
<td>Rectangle with animated size and TrimPath</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a name="LT0002"></a>LT0002</td>
|
||||
<td>Animated trim offset with static trim offset</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a name="LT0003"></a>LT0003</td>
|
||||
<td>Multiplication of two or more animated values</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a name="LT0004"></a>LT0004</td>
|
||||
<td>Blend mode: {blendMode}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a name="LT0005"></a>LT0005</td>
|
||||
<td>Combining animated shapes</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a name="LT0006"></a>LT0006</td>
|
||||
<td>Gradient fill</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a name="LT0007"></a>LT0007</td>
|
||||
<td>Gradient stroke</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a name="LT0008"></a>LT0008</td>
|
||||
<td>Image assets</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a name="LT0009"></a>LT0009</td>
|
||||
<td>Image layers</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a name="LT0010"></a>LT0010</td>
|
||||
<td>Merging a large number of shapes</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a name="LT0011"></a>LT0011</td>
|
||||
<td>Multiple animated rounded corners</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a name="LT0012"></a>LT0012</td>
|
||||
<td>Multiple fills</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a name="LT0013"></a>LT0013</td>
|
||||
<td>Multiple strokes</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a name="LT0014"></a>LT0014</td>
|
||||
<td>Multiple trim paths</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a name="LT0015"></a>LT0015</td>
|
||||
<td>Opacity and color animated at the same time</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a name="LT0016"></a>LT0016</td>
|
||||
<td>Path with rounded corners</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a name="LT0017"></a>LT0017</td>
|
||||
<td>Polystar</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a name="LT0018"></a>LT0018</td>
|
||||
<td>Repeater</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a name="LT0019"></a>LT0019</td>
|
||||
<td>Text layer</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a name="LT0020"></a>LT0020</td>
|
||||
<td>3d composition</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a name="LT0021"></a>LT0021</td>
|
||||
<td>3d layer</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a name="LT0022"></a>LT0022</td>
|
||||
<td>Time stretch</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a name="LT0023"></a>LT0023</td>
|
||||
<td>Mask with invert</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a name="LT0024"></a>LT0024</td>
|
||||
<td>Mask mode: {mode}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a name="LT0025"></a>LT0025</td>
|
||||
<td>Mask with alpha value other than 1</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a name="LT0026"></a>LT0026</td>
|
||||
<td>Mask with multiple shapes</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a name="LT0027"></a>LT0027</td>
|
||||
<td>CombiningMultipleShapes</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a name="LV0001"></a>LV0001</td>
|
||||
<td>Layer {layerName} has in-point after out-point</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a name="LV0002"></a>LV0002</td>
|
||||
<td>Layer {layerName} is in a cycle</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a name="LV0003"></a>LV0003</td>
|
||||
<td>Invalid layer parent: {layerParent}</td>
|
||||
</tr>
|
||||
</table>
|
||||
</body>
|
||||
</html>
|
|
@ -17,7 +17,7 @@ namespace Microsoft.Toolkit.Uwp.UI.Lottie.LottieData
|
|||
sealed class LottieCompositionValidator
|
||||
{
|
||||
readonly LottieComposition _lottieComposition;
|
||||
readonly ValidationIssues _issues = new ValidationIssues();
|
||||
readonly ValidationIssues _issues = new ValidationIssues(throwOnIssue: false);
|
||||
|
||||
LottieCompositionValidator(LottieComposition lottieComposition)
|
||||
{
|
||||
|
|
|
@ -1,36 +1,51 @@
|
|||
// Licensed to the .NET Foundation under one or more agreements.
|
||||
// Licensed to the .NET Foundation under one or more agreements.
|
||||
// The .NET Foundation licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
namespace Microsoft.Toolkit.Uwp.UI.Lottie.LottieData
|
||||
{
|
||||
/// <summary>
|
||||
/// Issues.
|
||||
/// </summary>
|
||||
sealed class ValidationIssues
|
||||
{
|
||||
readonly HashSet<(string Code, string Description)> _issues = new HashSet<(string Code, string Description)>();
|
||||
readonly bool _throwOnIssue;
|
||||
|
||||
internal ValidationIssues(bool throwOnIssue)
|
||||
{
|
||||
_throwOnIssue = throwOnIssue;
|
||||
}
|
||||
|
||||
internal (string Code, string Description)[] GetIssues() => _issues.ToArray();
|
||||
|
||||
internal void LayerHasInPointAfterOutPoint(string layerName)
|
||||
{
|
||||
Report("LV0001", $"Layer {layerName} has in-point after out-point");
|
||||
}
|
||||
internal void LayerHasInPointAfterOutPoint(string layerName) => Report("LV0001", $"Layer {layerName} has in-point after out-point");
|
||||
|
||||
internal void LayerInCycle(string layerName)
|
||||
{
|
||||
Report("LV0002", $"Layer {layerName} is in a cycle");
|
||||
}
|
||||
internal void LayerInCycle(string layerName) => Report("LV0002", $"Layer {layerName} is in a cycle");
|
||||
|
||||
internal void InvalidLayerParent(string layerParent)
|
||||
{
|
||||
Report("LV0003", $"Invalid layer parent: {layerParent}");
|
||||
}
|
||||
internal void InvalidLayerParent(string layerParent) => Report("LV0003", $"Invalid layer parent: {layerParent}");
|
||||
|
||||
void Report(string code, string description)
|
||||
{
|
||||
_issues.Add((code, description));
|
||||
|
||||
if (_throwOnIssue)
|
||||
{
|
||||
throw new NotSupportedException($"{code}: {description}");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -45,7 +45,7 @@ namespace Microsoft.Toolkit.Uwp.UI.Lottie.LottieData.Serialization
|
|||
};
|
||||
|
||||
readonly AnimatableColorParser _animatableColorParser;
|
||||
readonly ParsingIssues _issues = new ParsingIssues();
|
||||
readonly ParsingIssues _issues = new ParsingIssues(throwOnIssue: false);
|
||||
|
||||
Options _options;
|
||||
|
||||
|
@ -97,7 +97,7 @@ namespace Microsoft.Toolkit.Uwp.UI.Lottie.LottieData.Serialization
|
|||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
var issueCollector = new ParsingIssues();
|
||||
var issueCollector = new ParsingIssues(throwOnIssue: false);
|
||||
issueCollector.FailedToParseJson(e.Message);
|
||||
issues = issueCollector.GetIssues();
|
||||
return null;
|
||||
|
|
|
@ -1,95 +1,73 @@
|
|||
// Licensed to the .NET Foundation under one or more agreements.
|
||||
// Licensed to the .NET Foundation under one or more agreements.
|
||||
// The .NET Foundation licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
namespace Microsoft.Toolkit.Uwp.UI.Lottie.LottieData.Serialization
|
||||
{
|
||||
/// <summary>
|
||||
/// Issues.
|
||||
/// </summary>
|
||||
sealed class ParsingIssues
|
||||
{
|
||||
readonly HashSet<(string Code, string Description)> _issues = new HashSet<(string Code, string Description)>();
|
||||
readonly bool _throwOnIssue;
|
||||
|
||||
internal ParsingIssues(bool throwOnIssue)
|
||||
{
|
||||
_throwOnIssue = throwOnIssue;
|
||||
}
|
||||
|
||||
internal (string Code, string Description)[] GetIssues() => _issues.ToArray();
|
||||
|
||||
internal void FailedToParseJson(string message)
|
||||
{
|
||||
Report("LP0001", $"Failed to parse JSON. {message}");
|
||||
}
|
||||
internal void FailedToParseJson(string message) => Report("LP0001", $"Failed to parse JSON. {message}");
|
||||
|
||||
internal void FatalError(string message)
|
||||
{
|
||||
Report("LP0002", $"Fatal error: {message}");
|
||||
}
|
||||
internal void FatalError(string message) => Report("LP0002", $"Fatal error: {message}");
|
||||
|
||||
internal void AssetType(string type)
|
||||
{
|
||||
Report("LP0005", $"Unsupported asset type: {type}");
|
||||
}
|
||||
internal void AssetType(string type) => Report("LP0005", $"Unsupported asset type: {type}");
|
||||
|
||||
internal void LayerWithRenderFalse()
|
||||
{
|
||||
Report("LP0006", "Layer with render = false");
|
||||
}
|
||||
internal void LayerWithRenderFalse() => Report("LP0006", "Layer with render = false");
|
||||
|
||||
internal void IllustratorLayers()
|
||||
{
|
||||
Report("LP0007", "Illustrator layers");
|
||||
}
|
||||
internal void IllustratorLayers() => Report("LP0007", "Illustrator layers");
|
||||
|
||||
internal void LayerEffects()
|
||||
{
|
||||
Report("LP0008", "Layer effects");
|
||||
}
|
||||
internal void LayerEffects() => Report("LP0008", "Layer effects");
|
||||
|
||||
internal void Mattes()
|
||||
{
|
||||
Report("LP0009", "Mattes");
|
||||
}
|
||||
internal void Mattes() => Report("LP0009", "Mattes");
|
||||
|
||||
/*
|
||||
LP0010: Masks has been removed. We now support masks.
|
||||
*/
|
||||
internal void TimeRemappingOfPreComps() => Report("LP0011", "Time remapping of precomp layers");
|
||||
|
||||
internal void TimeRemappingOfPreComps()
|
||||
{
|
||||
Report("LP0011", "Time remapping of precomp layers");
|
||||
}
|
||||
internal void UnexpectedShapeContentType(string type) => Report("LP0012", $"Unexpected shape content type: {type}");
|
||||
|
||||
internal void UnexpectedShapeContentType(string type)
|
||||
{
|
||||
Report("LP0012", $"Unexpected shape content type: {type}");
|
||||
}
|
||||
internal void GradientStrokes() => Report("LP0013", "Gradient strokes");
|
||||
|
||||
internal void GradientStrokes()
|
||||
{
|
||||
Report("LP0013", "Gradient strokes");
|
||||
}
|
||||
internal void PolystarAnimation(string property) => Report("LP0014", $"Polystar {property} animation");
|
||||
|
||||
internal void PolystarAnimation(string property)
|
||||
{
|
||||
Report("LP0014", $"Polystar {property} animation");
|
||||
}
|
||||
internal void Expressions() => Report("LP0015", "Expressions");
|
||||
|
||||
internal void Expressions()
|
||||
{
|
||||
Report("LP0015", "Expressions");
|
||||
}
|
||||
internal void IgnoredField(string field) => Report("LP0016", $"Ignored field: {field}");
|
||||
|
||||
internal void IgnoredField(string field)
|
||||
{
|
||||
Report("LP0016", $"Ignored field: {field}");
|
||||
}
|
||||
|
||||
internal void UnexpectedField(string field)
|
||||
{
|
||||
Report("LP0017", $"Unexpected field: {field}");
|
||||
}
|
||||
internal void UnexpectedField(string field) => Report("LP0017", $"Unexpected field: {field}");
|
||||
|
||||
void Report(string code, string description)
|
||||
{
|
||||
_issues.Add((code, description));
|
||||
|
||||
if (_throwOnIssue)
|
||||
{
|
||||
throw new NotSupportedException($"{code}: {description}");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -284,7 +284,7 @@ namespace Microsoft.Toolkit.Uwp.UI.Lottie.LottieToWinComp
|
|||
|
||||
if (mask.Mode != Mask.MaskMode.Additive)
|
||||
{
|
||||
_unsupported.MaskWithUnsupportedMode(mask.Mode);
|
||||
_unsupported.MaskWithUnsupportedMode(mask.Mode.ToString());
|
||||
}
|
||||
|
||||
// Translation currently does not support having multiple paths for masks.
|
||||
|
@ -391,7 +391,7 @@ namespace Microsoft.Toolkit.Uwp.UI.Lottie.LottieToWinComp
|
|||
|
||||
if (layer.BlendMode != BlendMode.Normal)
|
||||
{
|
||||
_unsupported.BlendMode(layer.BlendMode);
|
||||
_unsupported.BlendMode(layer.BlendMode.ToString());
|
||||
}
|
||||
|
||||
if (layer.TimeStretch != 1)
|
||||
|
|
|
@ -1,17 +1,28 @@
|
|||
// Licensed to the .NET Foundation under one or more agreements.
|
||||
// Licensed to the .NET Foundation under one or more agreements.
|
||||
// The .NET Foundation licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Microsoft.Toolkit.Uwp.UI.Lottie.LottieData;
|
||||
|
||||
namespace Microsoft.Toolkit.Uwp.UI.Lottie.LottieToWinComp
|
||||
{
|
||||
/// <summary>
|
||||
/// Issues.
|
||||
/// </summary>
|
||||
sealed class TranslationIssues
|
||||
{
|
||||
readonly HashSet<(string Code, string Description)> _issues = new HashSet<(string, string)>();
|
||||
readonly HashSet<(string Code, string Description)> _issues = new HashSet<(string Code, string Description)>();
|
||||
readonly bool _throwOnIssue;
|
||||
|
||||
internal TranslationIssues(bool throwOnIssue)
|
||||
|
@ -21,140 +32,59 @@ namespace Microsoft.Toolkit.Uwp.UI.Lottie.LottieToWinComp
|
|||
|
||||
internal (string Code, string Description)[] GetIssues() => _issues.ToArray();
|
||||
|
||||
internal void AnimatedRectangleWithTrimPath()
|
||||
{
|
||||
Report("LT0001", "Rectangle with animated size and TrimPath");
|
||||
}
|
||||
internal void AnimatedRectangleWithTrimPath() => Report("LT0001", "Rectangle with animated size and TrimPath");
|
||||
|
||||
internal void AnimatedTrimOffsetWithStaticTrimOffset()
|
||||
{
|
||||
Report("LT0002", "Animated trim offset with static trim offset");
|
||||
}
|
||||
internal void AnimatedTrimOffsetWithStaticTrimOffset() => Report("LT0002", "Animated trim offset with static trim offset");
|
||||
|
||||
internal void AnimationMultiplication()
|
||||
{
|
||||
Report("LT0003", "Multiplication of two or more animated values");
|
||||
}
|
||||
internal void AnimationMultiplication() => Report("LT0003", "Multiplication of two or more animated values");
|
||||
|
||||
internal void BlendMode(BlendMode blendMode)
|
||||
{
|
||||
Report("LT0004", $"Blend mode: {blendMode}");
|
||||
}
|
||||
internal void BlendMode(string blendMode) => Report("LT0004", $"Blend mode: {blendMode}");
|
||||
|
||||
internal void CombiningAnimatedShapes()
|
||||
{
|
||||
Report("LT0005", "Combining animated shapes");
|
||||
}
|
||||
internal void CombiningAnimatedShapes() => Report("LT0005", "Combining animated shapes");
|
||||
|
||||
internal void GradientFill()
|
||||
{
|
||||
Report("LT0006", "Gradient fill");
|
||||
}
|
||||
internal void GradientFill() => Report("LT0006", "Gradient fill");
|
||||
|
||||
internal void GradientStroke()
|
||||
{
|
||||
Report("LT0007", "Gradient stroke");
|
||||
}
|
||||
internal void GradientStroke() => Report("LT0007", "Gradient stroke");
|
||||
|
||||
internal void ImageAssets()
|
||||
{
|
||||
Report("LT0008", "Image assets");
|
||||
}
|
||||
internal void ImageAssets() => Report("LT0008", "Image assets");
|
||||
|
||||
internal void ImageLayer()
|
||||
{
|
||||
Report("LT0009", "Image layers");
|
||||
}
|
||||
internal void ImageLayer() => Report("LT0009", "Image layers");
|
||||
|
||||
internal void MergingALargeNumberOfShapes()
|
||||
{
|
||||
Report("LT0010", "Merging a large number of shapes");
|
||||
}
|
||||
internal void MergingALargeNumberOfShapes() => Report("LT0010", "Merging a large number of shapes");
|
||||
|
||||
internal void MultipleAnimatedRoundedCorners()
|
||||
{
|
||||
Report("LT0011", "Multiple animated rounded corners");
|
||||
}
|
||||
internal void MultipleAnimatedRoundedCorners() => Report("LT0011", "Multiple animated rounded corners");
|
||||
|
||||
internal void MultipleFills()
|
||||
{
|
||||
Report("LT0012", "Multiple fills");
|
||||
}
|
||||
internal void MultipleFills() => Report("LT0012", "Multiple fills");
|
||||
|
||||
internal void MultipleStrokes()
|
||||
{
|
||||
Report("LT0013", "Multiple strokes");
|
||||
}
|
||||
internal void MultipleStrokes() => Report("LT0013", "Multiple strokes");
|
||||
|
||||
internal void MultipleTrimPaths()
|
||||
{
|
||||
Report("LT0014", "Multiple trim paths");
|
||||
}
|
||||
internal void MultipleTrimPaths() => Report("LT0014", "Multiple trim paths");
|
||||
|
||||
internal void OpacityAndColorAnimatedTogether()
|
||||
{
|
||||
Report("LT0015", "Opacity and color animated at the same time");
|
||||
}
|
||||
internal void OpacityAndColorAnimatedTogether() => Report("LT0015", "Opacity and color animated at the same time");
|
||||
|
||||
internal void PathWithRoundedCorners()
|
||||
{
|
||||
Report("LT0016", "Path with rounded corners");
|
||||
}
|
||||
internal void PathWithRoundedCorners() => Report("LT0016", "Path with rounded corners");
|
||||
|
||||
internal void Polystar()
|
||||
{
|
||||
Report("LT0017", "Polystar");
|
||||
}
|
||||
internal void Polystar() => Report("LT0017", "Polystar");
|
||||
|
||||
internal void Repeater()
|
||||
{
|
||||
Report("LT0018", "Repeater");
|
||||
}
|
||||
internal void Repeater() => Report("LT0018", "Repeater");
|
||||
|
||||
internal void TextLayer()
|
||||
{
|
||||
Report("LT0019", "Text layer");
|
||||
}
|
||||
internal void TextLayer() => Report("LT0019", "Text layer");
|
||||
|
||||
internal void ThreeD()
|
||||
{
|
||||
Report("LT0020", "3d composition");
|
||||
}
|
||||
internal void ThreeD() => Report("LT0020", "3d composition");
|
||||
|
||||
internal void ThreeDLayer()
|
||||
{
|
||||
Report("LT0021", "3d layer");
|
||||
}
|
||||
internal void ThreeDLayer() => Report("LT0021", "3d layer");
|
||||
|
||||
internal void TimeStretch()
|
||||
{
|
||||
Report("LT0022", "Time stretch");
|
||||
}
|
||||
internal void TimeStretch() => Report("LT0022", "Time stretch");
|
||||
|
||||
internal void MaskWithInvert()
|
||||
{
|
||||
Report("LT0023", "Mask with invert");
|
||||
}
|
||||
internal void MaskWithInvert() => Report("LT0023", "Mask with invert");
|
||||
|
||||
internal void MaskWithUnsupportedMode(Mask.MaskMode mode)
|
||||
{
|
||||
Report("LT0024", $"Mask mode: {mode}");
|
||||
}
|
||||
internal void MaskWithUnsupportedMode(string mode) => Report("LT0024", $"Mask mode: {mode}");
|
||||
|
||||
internal void MaskWithAlpha()
|
||||
{
|
||||
Report("LT0025", "Mask with alpha value other than 1");
|
||||
}
|
||||
internal void MaskWithAlpha() => Report("LT0025", "Mask with alpha value other than 1");
|
||||
|
||||
internal void MultipleShapeMasks()
|
||||
{
|
||||
Report("LT0026", "Mask with multiple shapes");
|
||||
}
|
||||
internal void MultipleShapeMasks() => Report("LT0026", "Mask with multiple shapes");
|
||||
|
||||
internal void CombiningMultipleShapes()
|
||||
{
|
||||
Report("LT0027", "CombiningMultipleShapes");
|
||||
}
|
||||
internal void CombiningMultipleShapes() => Report("LT0027", "CombiningMultipleShapes");
|
||||
|
||||
void Report(string code, string description)
|
||||
{
|
||||
|
|
Загрузка…
Ссылка в новой задаче