public static ElementRect Create(XElement element) { if (element == null) { return(null); } ElementRect item = new ElementRect(); foreach (XAttribute attribute in element.Attributes()) { switch (attribute.Name.LocalName) { case "width": item.width = ReaderUtil.ConvertSingle(attribute.Value, 0.0f); break; case "length": item.length = ReaderUtil.ConvertSingle(attribute.Value, 0.0f); break; case "w": item.w = ReaderUtil.ConvertSingle(attribute.Value, 0.0f); break; case "h": item.h = ReaderUtil.ConvertSingle(attribute.Value, 0.0f); break; case "rot": item.rot = ReaderUtil.ConvertSingle(attribute.Value, 0.0f); break; case "area": item.area = ReaderUtil.ConvertSingle(attribute.Value, 0.0f); break; } } return(item); }
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); }