public static ElementPackageBody Create(XElement element) { if (element == null) { return(null); } ElementPackageBody item = new ElementPackageBody(); foreach (XAttribute attribute in element.Attributes()) { switch (attribute.Name.LocalName) { 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; case "thickness": item.thickness = ReaderUtil.ConvertSingle(attribute.Value, 0.0f); break; case "gap": item.gap = ReaderUtil.ConvertSingle(attribute.Value, 0.0f); break; case "wptp": item.wptp = ReaderUtil.ConvertSingle(attribute.Value, 0.0f); break; case "hptp": item.hptp = ReaderUtil.ConvertSingle(attribute.Value, 0.0f); break; case "pitch": item.pitch = ReaderUtil.ConvertSingle(attribute.Value, 0.0f); break; } } return(item); }
public static ElementPackage Create(XElement element) { if (element == null) { return(null); } ElementPackage item = new ElementPackage(); 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 "type": item.type = attribute.Value; break; case "pkgInspGroup": item.pkgInspGroup = attribute.Value; break; case "maker": item.maker = attribute.Value; break; case "pkgApplyLevel": item.pkgApplyLevel = ReaderUtil.ConvertInt32(attribute.Value, 0); break; case "fOrgOffsetAng": item.fOrgOffsetAng = ReaderUtil.ConvertInt32(attribute.Value, 0); break; } } item.pkgbody = (from Element in element.Elements(ElementPackageBody.Name) select ElementPackageBody.Create(Element) ).ToArray(); item.pkgpins = (from Element in element.Elements(ElementPackagePins.Name) select ElementPackagePins.Create(Element) ).ToArray(); return(item); }