Skip to content

Commit

Permalink
fix #100
Browse files Browse the repository at this point in the history
  • Loading branch information
jogibear9988 committed Oct 27, 2024
1 parent 0068338 commit 00fdaf0
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 8 deletions.
7 changes: 4 additions & 3 deletions Source/SVGImage/SVG/Animation/AnimateTransform.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,10 @@ public sealed class AnimateTransform : AnimationBase

public AnimateTransform(SVG svg, XmlNode node, Shape parent)
: base(svg, node, parent)
{
this.Type = (AnimateTransformType)Enum.Parse(typeof(AnimateTransformType),
XmlUtil.AttrValue(node, "type", "translate"), true);
{
var valTranslate = XmlUtil.AttrValue(node, "type", "translate");
if (Enum.TryParse<AnimateTransformType>(valTranslate, true, out var parsed))
this.Type = parsed;
this.From = XmlUtil.AttrValue(node, "from", null);
this.To = XmlUtil.AttrValue(node, "to", null);
this.AttributeName = XmlUtil.AttrValue(node, "attributeName", null);
Expand Down
13 changes: 8 additions & 5 deletions Source/SVGImage/SVG/Shapes/Shape.cs
Original file line number Diff line number Diff line change
Expand Up @@ -252,12 +252,14 @@ protected virtual void Parse(SVG svg, string name, string value)
}
if (name == SVGTags.sStrokeLinecap)
{
this.GetStroke(svg).LineCap = (Stroke.eLineCap)Enum.Parse(typeof(Stroke.eLineCap), value);
if (Enum.TryParse<Stroke.eLineCap>(value, true, out var parsed))
this.GetStroke(svg).LineCap = parsed;
return;
}
if (name == SVGTags.sStrokeLinejoin)
{
this.GetStroke(svg).LineJoin = (Stroke.eLineJoin)Enum.Parse(typeof(Stroke.eLineJoin), value);
{
if (Enum.TryParse<Stroke.eLineJoin>(value, true, out var parsed))
this.GetStroke(svg).LineJoin = parsed;
return;
}
if (name == SVGTags.sFilterProperty)
Expand Down Expand Up @@ -302,8 +304,9 @@ protected virtual void Parse(SVG svg, string name, string value)
return;
}
if (name == SVGTags.sFillRule)
{
this.GetFill(svg).FillRule = (Fill.eFillRule)Enum.Parse(typeof(Fill.eFillRule), value);
{
if (Enum.TryParse<Fill.eFillRule>(value, true, out var parsed))
this.GetFill(svg).FillRule = parsed;
return;
}
if (name == SVGTags.sOpacity)
Expand Down

0 comments on commit 00fdaf0

Please sign in to comment.