private static XElement WriteShadow(Shadow shadow) { var shadowEl = new XElement("shadow", shadow.Path); if (shadow.OffsetX != default) { shadowEl.Add(new XAttribute("xOff", shadow.OffsetX)); } if (shadow.OffsetY != default) { shadowEl.Add(new XAttribute("yOff", shadow.OffsetY)); } return(shadowEl); }
private Shadow ReadShadow(XElement shadowEl) { var shadow = new Shadow(shadowEl.Value); foreach (var shadowAttr in shadowEl.Attributes()) { var shadowAttrName = shadowAttr.Name.ToString(); switch (shadowAttrName) { case "xOff": shadow.OffsetX = int.Parse(shadowAttr.Value); break; case "yOff": shadow.OffsetY = int.Parse(shadowAttr.Value); break; default: log.Debug($"Unknown shadow attribute: '{shadowAttrName}'."); break; } } return(shadow); }