public BaseLine(LinkType type, int firstId, int secondId, LinkLanes lanesNum) { LinkType = type; FirstEndId = firstId; SecondEndId = secondId; LanesNum = lanesNum; }
public override ModelBase CreateObjectByName(string objectName) { SystemStru sys; string xmlPath = string.Format(@"{0}\{1}.xml", PathManager.GetSysPath(), objectName); if (!File.Exists(xmlPath)) { MessageBox.Show("CreateObject_SystemStru:没有该SystemStru对应的XML文件!"); return(null); } XDocument xd = XDocument.Load(xmlPath); //根元素的Attribute XElement rt = xd.Element("SystemStru"); int cntsNum = int.Parse(rt.Attribute("CntsNum").Value); sys = new SystemStru(cntsNum); sys.Name = rt.Attribute("Name").Value; sys.Type = rt.Attribute("Type").Value; //取CntNames的值赋值到CntsName XElement cntNames = rt.Element("CntNames"); foreach (var e in cntNames.Elements()) { int cntSn = int.Parse(e.Attribute("CntSn").Value); string cntName = e.Attribute("CntName").Value; sys.CntNames[cntSn] = cntName; } //取links赋值到backPlane.linkDir XElement links = rt.Element("Links"); for (int i = 0; i < cntsNum; i++) { List <SystemStruLink> linksList = new List <SystemStruLink>(); //找到同一槽位的links,然后添加到list var slotLinks = from link in links.Elements() where int.Parse(link.Attribute("FirstEndId").Value) == i select link; foreach (var link in slotLinks) { LinkType type = (LinkType)Enum.Parse(typeof(LinkType), link.Attribute("Type").Value); LinkLanes laneNum = (LinkLanes)Enum.Parse(typeof(LinkLanes), link.Attribute("DataWidth").Value); var tempLink = new SystemStruLink(i , int.Parse(link.Attribute("FirstEndPos").Value) , int.Parse(link.Attribute("SecondEndId").Value) , int.Parse(link.Attribute("SecondEndPos").Value) , type , laneNum); linksList.Add(tempLink); } sys.LinksArray[i] = linksList; } return(sys); }
public ComponentLine(LinkType type, int firstId, int secondId, LinkLanes lanesNum) : base(type, firstId, secondId, lanesNum) { }
public RawSubLink(int end1Pos, int end2Pos, LinkLanes dataWidth) { End1Pos = end1Pos; End2Pos = end2Pos; DataWidth = dataWidth; }
public RawSubLink(int end1Pos, int end2Pos) { End1Pos = end1Pos; End2Pos = end2Pos; DataWidth = LinkLanes.X1; }
public SystemStruLink(int end1Id, int end1Pos, int end2Id, int end2Pos, LinkType type, LinkLanes lanes) : base(end1Id, end1Pos, end2Id, end2Pos, type) { base.LanesNum = lanes; base.EndRadius = 3; }