public static ElementFootprint Create(XElement element) { if (element == null) { return(null); } ElementFootprint item = new ElementFootprint(); foreach (XAttribute attribute in element.Attributes()) { switch (attribute.Name.LocalName) { case "name": item.name = attribute.Value; break; case "uid": item.uid = ReaderUtil.ConvertGuid(attribute.Value, Guid.Empty); break; } } item.Items = (from Element in element.Elements(ElementPin.Name) select ElementPin.Create(Element) ).ToArray(); return(item); }
public static ElementPin Create(XElement element) { ElementPin item = new ElementPin(); foreach (XAttribute attribute in element.Attributes()) { switch (attribute.Name.LocalName) { case "name": item.name = attribute.Value; break; case "uid": item.uid = ReaderUtil.ConvertGuid(attribute.Value, Guid.Empty); break; case "shuid": item.shuid = ReaderUtil.ConvertGuid(attribute.Value, Guid.Empty); break; case "x": item.x = ReaderUtil.ConvertSingle(attribute.Value, 0.0f); break; case "y": item.y = ReaderUtil.ConvertSingle(attribute.Value, 0.0f); break; case "rot": item.rot = ReaderUtil.ConvertSingle(attribute.Value, 0.0f); break; } } return(item); }