示例#1
0
        public static ElementPart Create(XElement element)
        {
            if (element == null)
            {
                return(null);
            }

            ElementPart item = new ElementPart();

            foreach (XAttribute attribute in element.Attributes())
            {
                switch (attribute.Name.LocalName)
                {
                case "name": item.name = attribute.Value; break;

                case "AlterPart": item.AlterPart = attribute.Value; break;

                case "uid": item.uid = ReaderUtil.ConvertGuid(attribute.Value, Guid.Empty); break;

                case "footprint": item.footprint = attribute.Value; break;

                case "pkg": item.pkg = attribute.Value; break;

                case "orgPkgName": item.orgPkgName = attribute.Value; break;

                case "xoffset": item.xoffset = ReaderUtil.ConvertSingle(attribute.Value, 0.0f); break;

                case "yoffset": item.yoffset = ReaderUtil.ConvertSingle(attribute.Value, 0.0f); break;

                case "OffsetAngForUsrRefAng":
                    item.OffsetAngForUsrRefAng = ReaderUtil.ConvertSingle(attribute.Value, 0.0f); break;
                }
            }
            return(item);
        }
示例#2
0
        public static ElementParts Create(XElement element)
        {
            if (element == null)
            {
                return(null);
            }

            ElementParts item = new ElementParts();

            item.ItemDic
                = (from Element in element.Elements(ElementPart.Name)
                   select ElementPart.Create(Element)
                   ).ToDictionary(x => x.name);
            return(item);
        }