public List <StrData> GetStrData(string s) { List <StrData> list = new List <StrData> (); if (s != null) { string[] str = s.Split('*'); StrData d = new StrData(); for (int i = 0; i < str.Length; i++) { int index = i % 2; switch (index) { case 0: d = new StrData(); d.id = int.Parse(str[i]); break; case 1: d.num = int.Parse(str[i]); list.Add(d); break; } } } return(list); }
public static List <StrDataCollection> Read(string path) { if (!File.Exists(path)) { return(new List <StrDataCollection>()); } XmlDocument doc = new XmlDocument(); doc.Load(path); XmlNode rootNode = doc.GetElementsByTagName("Root")[0]; if (rootNode == null) { return(new List <StrDataCollection>()); } List <StrDataCollection> list = new List <StrDataCollection>(); foreach (XmlNode typeNode in rootNode.ChildNodes) { StrDataCollection collectionItem = new StrDataCollection() { Type = typeNode.Attributes["Type"].Value.ToString(), StrDatas = new List <StrData>() }; foreach (XmlNode node in typeNode.ChildNodes) { StrData fitData = new StrData(); if (node.Attributes["Name"] != null) { fitData.Name = node.Attributes["Name"].Value.ToString(); } if (node.Attributes["StrType"] != null) { fitData.StrType = node.Attributes["StrType"].Value.ToString(); } if (node.Attributes["Weight"] != null) { fitData.Weight = Convert.ToDouble(node.Attributes["Weight"].Value.ToString()); } if (node.Attributes["FitLength"] != null) { fitData.FitLength = Convert.ToDouble(node.Attributes["FitLength"].Value.ToString()); } if (node.Attributes["PieceLength"] != null) { fitData.PieceLength = Convert.ToDouble(node.Attributes["PieceLength"].Value.ToString()); } if (node.Attributes["PieceNum"] != null) { fitData.PieceNum = Convert.ToInt32(node.Attributes["PieceNum"].Value.ToString()); } if (node.Attributes["GoldPieceNum"] != null) { fitData.GoldPieceNum = Convert.ToInt32(node.Attributes["GoldPieceNum"].Value.ToString()); } if (node.Attributes["LNum"] != null) { fitData.LNum = Convert.ToInt32(node.Attributes["LNum"].Value.ToString()); } if (node.Attributes["DampLength"] != null) { fitData.DampLength = Convert.ToDouble(node.Attributes["DampLength"].Value.ToString()); } if (node.Attributes["SuTubleLen"] != null) { fitData.SuTubleLen = Convert.ToDouble(node.Attributes["SuTubleLen"].Value.ToString()); } if (node.Attributes["SoftLineLen"] != null) { fitData.SoftLineLen = Convert.ToDouble(node.Attributes["SoftLineLen"].Value.ToString()); } collectionItem.StrDatas.Add(fitData); } list.Add(collectionItem); } return(list); }
//更新塔库配置参数 protected void UpdateTowerPara(out string waring) { waring = ""; StrData upIndStr, midIndStr, dnIndStr, grdStr, upJumpStr, midJumpStr, dnJumpStr; if (TowerParas.UpIndStrDataName != null && TowerParas.UpIndStrDataName != "") { upIndStr = globalInst.GetLocalStrDataByName("一般子串", TowerParas.UpIndStrDataName); } else { upIndStr = new StrData(); waring += "上相导线串 "; } if (TowerParas.MidIndStrDataName != null && TowerParas.MidIndStrDataName != "") { midIndStr = globalInst.GetLocalStrDataByName("一般子串", TowerParas.MidIndStrDataName); } else { midIndStr = new StrData(); waring += "中相导线串 "; } if (TowerParas.DnIndStrDataName != null && TowerParas.DnIndStrDataName != "") { dnIndStr = globalInst.GetLocalStrDataByName("一般子串", TowerParas.DnIndStrDataName); } else { dnIndStr = new StrData(); waring += "下相导线串 "; } if (TowerParas.GrdStrDataName != null && TowerParas.GrdStrDataName != "") { grdStr = globalInst.GetLocalStrDataByName("一般子串", TowerParas.GrdStrDataName); } else { grdStr = new StrData(); waring += "地线线串 "; } if (TowerParas.UpJumpStrDataName != null && TowerParas.UpJumpStrDataName != "") { upJumpStr = globalInst.GetLocalStrDataByName("硬跳线", TowerParas.UpJumpStrDataName); } else { upJumpStr = new StrData(); waring += "上相跳线串 "; } if (TowerParas.MidJumpStrDataName != null && TowerParas.MidJumpStrDataName != "") { midJumpStr = globalInst.GetLocalStrDataByName("硬跳线", TowerParas.MidJumpStrDataName); } else { midJumpStr = new StrData(); waring += "中相跳线串 "; } if (TowerParas.DnJumpStrDataName != null && TowerParas.DnJumpStrDataName != "") { dnJumpStr = globalInst.GetLocalStrDataByName("硬跳线", TowerParas.DnJumpStrDataName); } else { dnJumpStr = new StrData(); waring += "下相跳线串 "; } StrDatas = new ElecCalsStrDatas(); StrDatas.UpIndStr.SetIGPara(upIndStr.Weight, upIndStr.LNum, upIndStr.PieceNum, upIndStr.PieceLength, upIndStr.GoldPieceNum, upIndStr.FitLength, upIndStr.DampLength); StrDatas.MidIndStr.SetIGPara(midIndStr.Weight, midIndStr.LNum, midIndStr.PieceNum, midIndStr.PieceLength, midIndStr.GoldPieceNum, midIndStr.FitLength, midIndStr.DampLength); StrDatas.DnIndStr.SetIGPara(dnIndStr.Weight, dnIndStr.LNum, dnIndStr.PieceNum, dnIndStr.PieceLength, dnIndStr.GoldPieceNum, dnIndStr.FitLength, dnIndStr.DampLength); StrDatas.GrdStr.SetIGPara(grdStr.Weight, grdStr.LNum, grdStr.PieceNum, grdStr.PieceLength, grdStr.GoldPieceNum, grdStr.FitLength, grdStr.DampLength); StrDatas.UpJumpStr.SetJumPara(upJumpStr.Weight, upJumpStr.LNum, upJumpStr.PieceNum, upJumpStr.GoldPieceNum, upJumpStr.SoftLineLen, upJumpStr.JGBNum, upJumpStr.SuTubleLen, TowerParas.SuTubleDia, TowerParas.SuTubleWei); StrDatas.MidJumpStr.SetJumPara(midJumpStr.Weight, midJumpStr.LNum, midJumpStr.PieceNum, midJumpStr.GoldPieceNum, midJumpStr.SoftLineLen, midJumpStr.JGBNum, midJumpStr.SuTubleLen, TowerParas.SuTubleDia, TowerParas.SuTubleWei); StrDatas.DnJumpStr.SetJumPara(dnJumpStr.Weight, dnJumpStr.LNum, dnJumpStr.PieceNum, dnJumpStr.GoldPieceNum, dnJumpStr.SoftLineLen, dnJumpStr.JGBNum, dnJumpStr.SuTubleLen, TowerParas.SuTubleDia, TowerParas.SuTubleWei); Wire jump; if (TowerParas.JumpName != null && TowerParas.JumpName != "") { jump = globalInst.GetLocalWireByName(true, TowerParas.JumpName); } else { jump = new Wire(); waring += "跳线 "; } JumpWirePara = new ElecCalsWire(jump.ModelSpecification, 1, jump.SectionArea, jump.ExternalDiameter, jump.UnitLengthMass, jump.ModulusElasticity, jump.LineCoefficient, jump.RatedBreakingForce, 0, 0, TowerParas.JumpDevideNum); }