public static ElementComponents Create(XElement element) { if (element == null) { return(null); } ElementComponents item = new ElementComponents(); item.component = (from Element in element.Elements(ElementComponent.Name) select ElementComponent.Create(Element) ).ToArray(); return(item); }
public static ElementComponent Create(XElement element) { if (element == null) { return(null); } ElementComponent item = new ElementComponent(); foreach (XAttribute attribute in element.Attributes()) { switch (attribute.Name.LocalName) { case "name": item.name = attribute.Value; break; case "userName": item.userName = attribute.Value; break; case "bExec": item.bExec = ReaderUtil.ConvertBoolean(attribute.Value, false); break; case "group": item.group = ReaderUtil.ConvertInt32(attribute.Value, 0); break; case "Filter": item.Filter = ReaderUtil.ConvertBoolean(attribute.Value, false); break; case "bOriExec": item.bOriExec = ReaderUtil.ConvertBoolean(attribute.Value, false); break; case "part": item.part = attribute.Value; break; case "partguid": item.partguid = ReaderUtil.ConvertGuid(attribute.Value, Guid.Empty); break; case "OrgPart": item.OrgPart = attribute.Value; break; case "AlterPart": item.AlterPart = attribute.Value; break; case "copyPackage": item.copyPackage = attribute.Value; break; case "si": item.si = attribute.Value; 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 "fAngleByCompItSelf": item.fAngleByCompItSelf = ReaderUtil.ConvertSingle(attribute.Value, 0.0f); break; case "bModifiedForBadComp": item.bModifiedForBadComp = ReaderUtil.ConvertBoolean(attribute.Value, false); break; case "bDontAttachPkg": item.bDontAttachPkg = ReaderUtil.ConvertBoolean(attribute.Value, false); break; case "inspGroupUid": item.inspGroupUid = attribute.Value; break; case "bChkAbsence": item.bChkAbsence = ReaderUtil.ConvertBoolean(attribute.Value, false); break; case "fAngleForInsp": item.fAngleForInsp = ReaderUtil.ConvertSingle(attribute.Value, 0.0f); break; case "fAngleCutomerOrg": item.fAngleCutomerOrg = ReaderUtil.ConvertSingle(attribute.Value, 0.0f); break; case "footprint": item.footprint = attribute.Value; break; case "fovPosType": item.fovPosType = ReaderUtil.ConvertInt32(attribute.Value, 0); break; case "OrgfovPosType": item.OrgfovPosType = ReaderUtil.ConvertInt32(attribute.Value, 0); break; case "fovX": item.fovX = ReaderUtil.ConvertSingle(attribute.Value, 0.0f); break; case "fovY": item.fovY = ReaderUtil.ConvertSingle(attribute.Value, 0.0f); break; case "nCompPkgVerification": item.nCompPkgVerification = ReaderUtil.ConvertInt32(attribute.Value, 0); break; case "nCompInspVerification": item.nCompInspVerification = ReaderUtil.ConvertInt32(attribute.Value, 0); break; case "beforeDivideCenterX": item.beforeDivideCenterX = ReaderUtil.ConvertSingle(attribute.Value, 0.0f); break; case "beforeDivideCenterY": item.beforeDivideCenterY = ReaderUtil.ConvertSingle(attribute.Value, 0.0f); break; case "bDivided": item.bDivided = ReaderUtil.ConvertBoolean(attribute.Value, false); break; case "beforeDivideCompName": item.beforeDivideCompName = attribute.Value; break; case "beforeDivideBodyCenterX": item.beforeDivideBodyCenterX = ReaderUtil.ConvertSingle(attribute.Value, 0.0f); break; case "beforeDivideBodyCenterY": item.beforeDivideBodyCenterY = ReaderUtil.ConvertSingle(attribute.Value, 0.0f); break; } } item.rect = new RectangleF( item.x + 40 + item.x, (67.73f - 40 - item.y) + item.y, 10.0f, 10.0f); return(item); }