public static Package Create(XElement element) { return(new Package() { LibraryName = element.Ancestors(XName.Get("library")).First().Attribute("name").Value, Name = element.GetString("name"), Description = element.GetChildString("description"), Wires = (from childWires in element.Descendants("wire") select Wire.Create(childWires)).ToList(), Texts = (from childTexts in element.Descendants("text") select Text.Create(childTexts)).ToList(), SMDs = (from childSMDs in element.Descendants("smd") select SMD.Create(childSMDs)).ToList(), Pads = (from childPads in element.Descendants("pad") select Pad.Create(childPads)).ToList(), Holes = (from childPads in element.Descendants("hole") select Hole.Create(childPads)).ToList(), Circles = (from childCircles in element.Descendants("circle") select Circle.Create(childCircles)).ToList(), Rects = (from childCircles in element.Descendants("rect") select Rect.Create(childCircles)).ToList(), }); }
public static SMD Create(XElement element) { var smd = new SMD() { Layer = element.GetInt32("layer"), Name = element.GetString("name"), OriginX = element.GetDouble("x"), OriginY = element.GetDouble("y"), DX = element.GetDouble("dx"), DY = element.GetDouble("dy"), Roundness = element.GetDoubleNullable("roundness"), RotateStr = element.GetString("rot") }; return(smd); }