public static ElementShape Create(XElement element) { ElementShape item = new ElementShape(); foreach (XAttribute attribute in element.Attributes()) { switch (attribute.Name.LocalName) { case "uid": item.uid = ReaderUtil.ConvertGuid(attribute.Value, Guid.Empty); break; case "name": item.name = ReaderUtil.ConvertGuid(attribute.Value, Guid.Empty); break; } } item.rc = (from Element in element.Elements(ElementRect.Name) select ElementRect.Create(Element) ).ToArray(); item.drawpath = (from Element in element.Elements(ElementDrawPath.Name) select ElementDrawPath.Create(Element) ).ToArray(); return(item); }
public static ElementDrawPath Create(XElement element) { if (element == null) { return(null); } ElementDrawPath item = new ElementDrawPath(); foreach (XAttribute attribute in element.Attributes()) { switch (attribute.Name.LocalName) { case "area": item.area = ReaderUtil.ConvertSingle(attribute.Value, 0.0f); break; } } item.pt = (from Element in element.Elements(ElementPoint.Name) select ElementPoint.Create(Element) ).ToArray(); return(item); }