public void ConvertTemplate() { foreach (var item in Templates) { string datPath = item.Name.Substring(0, item.Name.Length - 3) + "dat"; DES.DesDecrypt(item.Name, datPath, "12345678"); TowerTemplateReader templateReader = new TowerTemplateReader(TowerTypeStringConvert.TowerStringToType(item.TowerType)); TowerTemplate template = templateReader.Read(datPath); string dirPath = datPath.Substring(0, datPath.LastIndexOf('\\')); string templateName = datPath.Substring(datPath.LastIndexOf('\\') + 1); string newDirPath = dirPath + "\\新模板\\"; if (!Directory.Exists(newDirPath)) { Directory.CreateDirectory(newDirPath); } string newTemplatePath = newDirPath + templateName; NewTowerTemplateReader newTemplateReader = new NewTowerTemplateReader(TowerTypeStringConvert.TowerStringToType(item.TowerType)); newTemplateReader.Save(newTemplatePath, template); } }
public void TestMethod1_NewTemplateReadAndSave() { var openFileDialog = new Microsoft.Win32.OpenFileDialog() { Filter = "DLL Files (*.dll)|*.dll" }; if (openFileDialog.ShowDialog() != true) { return; } string datPath = openFileDialog.FileName.Substring(0, openFileDialog.FileName.Length - 3) + "dat"; DES.DesDecrypt(openFileDialog.FileName, datPath, "12345678"); TowerTemplateReader templateReader = new TowerTemplateReader(TowerTypeEnum.LineTower); TowerTemplate template = templateReader.Read(datPath); string newDatPath = openFileDialog.FileName.Substring(0, openFileDialog.FileName.Length - 4) + "New.dat"; NewTowerTemplateReader newTemplateReader = new NewTowerTemplateReader(TowerTypeEnum.LineTower); newTemplateReader.Save(newDatPath, template); TowerTemplate newTemplate = newTemplateReader.Read(newDatPath); }
//解码没有加密的结构计算模板 public bool DecodeEncryTemplate(TowerTypeEnum towerType, string templatesPath) { TowerTemplateReader templateReader = new TowerTemplateReader(towerType); Template = templateReader.Read(templatesPath); WorkConditions = ConvertTemplateToSpec(Template); return(true); }
//解码加密的结构计算模板 public bool DecodeTemplate(TowerTypeEnum towerType, string templatesPath) { string file = templatesPath.Substring(0, templatesPath.Length - 3) + "dat"; DES.DesDecrypt(templatesPath, file, "12345678"); TowerTemplateReader templateReader = new TowerTemplateReader(towerType); Template = templateReader.Read(file); WorkConditions = ConvertTemplateToSpec(Template); return(true); }
public void TestMethod6() { var openFileDialog = new Microsoft.Win32.OpenFileDialog() { Filter = "DLL Files (*.dll)|*.dll" }; if (openFileDialog.ShowDialog() != true) { return; } var openTemplateDialog = new Microsoft.Win32.OpenFileDialog() { Filter = "Excel Files (*.xlsx)|*.xlsx" }; if (openTemplateDialog.ShowDialog() != true) { return; } var saveFileDialog = new Microsoft.Win32.SaveFileDialog() { Filter = "Dat Files (*.dat)|*.dat", }; if (saveFileDialog.ShowDialog() != true) { return; } DES.DesDecrypt(openFileDialog.FileName, saveFileDialog.FileName, "12345678"); TowerTemplateReader TemplateReader = new TowerTemplateReader(TowerTypeEnum.CornerTower); Mode.TowerTemplate template = TemplateReader.Read(saveFileDialog.FileName); StruCalseBaseParas formulaParas = new StruCalseBaseParas(); formulaParas.Type = TowerTypeEnum.CornerTower; formulaParas.LoadRatio = 1; formulaParas.IsMethod1Selected = false; //结构重要性系数 formulaParas.R1Install = 1.0f; formulaParas.R0Normal = 1.1f; //荷载分项系数 formulaParas.RGBad = 1.2f; formulaParas.RGGood = 1.00f; formulaParas.RQ = 1.4f; //formulaParas.RGCheck01 = 1.3f; //可变荷载组合系数 formulaParas.VcFNormal = 1f; formulaParas.VcFInstall = 0.9f; formulaParas.VcFBroken = 0.9f; formulaParas.VcFUnevenIce = 0.9f; formulaParas.VcFCheck = 0.75f; //其他参数 formulaParas.WindAdjustFactor = 1f; formulaParas.OtherWindAdjustFactor = 1.00f; formulaParas.DynamicCoef = 1.1f; formulaParas.LiftCoefJumper = 2f; formulaParas.TempStayWireAngle = 45f; formulaParas.TractionAgnle = 20f; formulaParas.IsMethod1Selected = false; //formulaParas.RA = 1.5f; StruLineParas[] lineParas = new StruLineParas[] { new StruLineParas { TstringNum = 0, WireExtraLoad = 4, TwireExtraLoad = 0, AnchorTension = 47.49f, TemporaryTension = 10f, AngleMin = 20f, AngleMax = 40f, isTurnRight = true, DrawingCoef = 1.05f, PulleyTensionDif = 0, }, new StruLineParas { TstringNum = 0, WireExtraLoad = 4, TwireExtraLoad = 0, AnchorTension = 47.49f, TemporaryTension = 10f, AngleMin = 20f, AngleMax = 40f, isTurnRight = true, DrawingCoef = 1.05f, PulleyTensionDif = 0, }, new StruLineParas { TstringNum = 1, WireExtraLoad = 12, TwireExtraLoad = 6, AnchorTension = 412.14f, TemporaryTension = 40f, AngleMin = 20f, AngleMax = 40f, isTurnRight = true, DrawingCoef = 1.1f, PulleyTensionDif = 50, }, new StruLineParas { TstringNum = 1, WireExtraLoad = 12, TwireExtraLoad = 6, AnchorTension = 412.14f, TemporaryTension = 40f, AngleMin = 20f, AngleMax = 40f, isTurnRight = true, DrawingCoef = 1.1f, PulleyTensionDif = 50, }, new StruLineParas { TstringNum = 1, WireExtraLoad = 12, TwireExtraLoad = 6, AnchorTension = 412.14f, TemporaryTension = 40f, AngleMin = 20f, AngleMax = 40f, isTurnRight = true, DrawingCoef = 1.1f, PulleyTensionDif = 50, }, }; List <HangingPointParas> normalList = new List <HangingPointParas>() { new HangingPointParas() { Index = 1, WireType = "左地", StringType = "常规", Points = new string[] { "11", "13" } }, new HangingPointParas() { Index = 2, WireType = "右地", StringType = "常规", Points = new string[] { "40", "42" } }, new HangingPointParas() { Index = 3, WireType = "左导", StringType = "常规", Points = new string[] { "1511", "1513", "1601", "1603" } }, new HangingPointParas() { Index = 4, WireType = "中导", StringType = "常规", Points = new string[] { "1060", "1062" } }, new HangingPointParas() { Index = 5, WireType = "右导", StringType = "常规", Points = new string[] { "1600", "1602", "1510", "1512" } }, }; List <HangingPointParas> normalTList = new List <HangingPointParas>() { new HangingPointParas() { Index = 1, WireType = "左地", StringType = "无跳线" }, new HangingPointParas() { Index = 2, WireType = "右地", StringType = "无跳线", }, new HangingPointParas() { Index = 3, WireType = "左导", StringType = "I串", Points = new string[] { "1481", "1483" } }, new HangingPointParas() { Index = 4, WireType = "中导", StringType = "I串", Points = new string[] { "490", "492" } }, new HangingPointParas() { Index = 5, WireType = "右导", StringType = "I串", Points = new string[] { "1480", "1482" } }, }; List <HangingPointParas> intallTList = new List <HangingPointParas>() { new HangingPointParas() { Index = 1, WireType = "左导", StringType = "I串", Array = "第a组", Points = new string[] { "1481", "1483" } }, new HangingPointParas() { Index = 2, WireType = "中导", StringType = "I串", Array = "第a组", Points = new string[] { "490", "492" } }, new HangingPointParas() { Index = 3, WireType = "右导", StringType = "I串", Array = "第a组", Points = new string[] { "1480", "1482" } }, }; List <HangingPointParas> turingList = new List <HangingPointParas>() { new HangingPointParas() { Index = 1, WireType = "左导", StringType = "I串", Points = new string[] { "1511", "1513", "1601", "1603" } }, new HangingPointParas() { Index = 2, WireType = "中导", StringType = "I串", Points = new string[] { "1040", "1042", "1050", "1052" } }, new HangingPointParas() { Index = 3, WireType = "右导", StringType = "I串", Points = new string[] { "1600", "1602", "1510", "1512" } }, }; HangingPointSettingParas ratioParas = new HangingPointSettingParas { BLTQ = 0.5f, BLTH = 0.5f, BLTZ = 0, BLDZTQ = 0.5f, BLDZTH = 0.5f, BLDZTZ = 0, IsTuringPointSeleced = true, NormalXYPoints = normalList, NormalZPoints = normalTList, InstallXYPoints = intallTList, InstallZPoints = intallTList, TurningPoints = turingList, }; LoadComposeTensionTower loadCornerTower = new LoadComposeTensionTower(formulaParas, lineParas, ratioParas, template, openTemplateDialog.FileName); string filePath = saveFileDialog.FileName.Substring(0, saveFileDialog.FileName.Length - 3) + "calc"; loadCornerTower.CalculateLoadDistribute(filePath); string filePath2 = saveFileDialog.FileName.Substring(0, saveFileDialog.FileName.Length - 3) + "div"; List <StruCalsPointLoad> loadList = loadCornerTower.CalsPointsLoad(filePath2); string filePath3 = saveFileDialog.FileName.Substring(0, saveFileDialog.FileName.Length - 3) + "load"; loadCornerTower.GenerateLoadFile(filePath3, loadList); }
public void TestMethod7() { var openFileDialog = new Microsoft.Win32.OpenFileDialog() { Filter = "DLL Files (*.dll)|*.dll" }; if (openFileDialog.ShowDialog() != true) { return; } var openTemplateDialog = new Microsoft.Win32.OpenFileDialog() { Filter = "Excel Files (*.xlsx)|*.xlsx" }; if (openTemplateDialog.ShowDialog() != true) { return; } var saveFileDialog = new Microsoft.Win32.SaveFileDialog() { Filter = "Dat Files (*.dat)|*.dat", }; if (saveFileDialog.ShowDialog() != true) { return; } DES.DesDecrypt(openFileDialog.FileName, saveFileDialog.FileName, "12345678"); TowerTemplateReader TemplateReader = new TowerTemplateReader(TowerTypeEnum.LineTower); Mode.TowerTemplate template = TemplateReader.Read(saveFileDialog.FileName); StruCalseBaseParas formulaParas = new StruCalseBaseParas(); formulaParas.Type = TowerTypeEnum.LineTower; formulaParas.LoadRatio = 1; //结构重要性系数 formulaParas.R1Install = 1f; formulaParas.R0Normal = 1.1f; //荷载分项系数 formulaParas.RGBad = 1.2f; formulaParas.RGGood = 1f; formulaParas.RQ = 1.4f; //可变荷载组合系数 formulaParas.VcFNormal = 1f; formulaParas.VcFInstall = 0.9f; formulaParas.VcFBroken = 0.9f; formulaParas.VcFUnevenIce = 0.9f; formulaParas.VcFCheck = 0.75f; //其他参数 formulaParas.WindAdjustFactor = 1f; formulaParas.OtherWindAdjustFactor = 1f; formulaParas.DynamicCoef = 1.1f; formulaParas.AnchorWindCoef = 0.7f; formulaParas.AnchorGravityCoef = 0.7f; formulaParas.AnchorAngle = 20f; formulaParas.IsMethod1Selected = true; StruLineParas[] lineParas = new StruLineParas[] { new StruLineParas { HoistingCoef = 2f, WireExtraLoad = 4, AnchorTension = 43.32f, PulleyTensionDif = 0, DrawingCoef = 1.2f }, new StruLineParas { HoistingCoef = 2f, WireExtraLoad = 4, AnchorTension = 43.32f, PulleyTensionDif = 0, DrawingCoef = 1.2f }, new StruLineParas { HoistingCoef = 1.5f, WireExtraLoad = 8, AnchorTension = 829.39f, PulleyTensionDif = 50, DrawingCoef = 1.2f }, new StruLineParas { HoistingCoef = 1.5f, WireExtraLoad = 8, AnchorTension = 829.39f, PulleyTensionDif = 50, DrawingCoef = 1.2f } }; List <HangingPointParas> normalList = new List <HangingPointParas>() { new HangingPointParas() { Index = 1, WireType = "左地", StringType = "常规", Points = new string[] { "11", "13" } }, new HangingPointParas() { Index = 2, WireType = "右地", StringType = "常规", Points = new string[] { "10", "12" } }, new HangingPointParas() { Index = 3, WireType = "左导", StringType = "V1", Points = new string[] { "421", "1241" } }, new HangingPointParas() { Index = 4, WireType = "右导", StringType = "V1", Points = new string[] { "1240", "420" } } }; List <HangingPointParas> installList = new List <HangingPointParas>() { new HangingPointParas() { Index = 1, WireType = "左导", Array = "第a组", Points = new string[] { "671", "673", "781", "783" } }, new HangingPointParas() { Index = 2, WireType = "右导", Array = "第a组", Points = new string[] { "670", "672", "780", "782" } }, new HangingPointParas() { Index = 3, WireType = "左导", Array = "第b组", Points = new string[] { "611", "613", "671", "673", "781", "783", "791", "793" } }, new HangingPointParas() { Index = 4, WireType = "右导", Array = "第b组", Points = new string[] { "610", "612", "670", "672", "780", "782", "790", "792" } }, new HangingPointParas() { Index = 5, WireType = "左导", Array = "第c组", Points = new string[] { "671", "673", "781", "783" } }, new HangingPointParas() { Index = 6, WireType = "右导", Array = "第c组", Points = new string[] { "670", "672", "780", "782" } }, }; List <HangingPointParas> turningPoingts = new List <HangingPointParas> { new HangingPointParas { Index = 1, WireType = "左导", Angle = 90, Points = new string[] { "1001", "1003" } }, new HangingPointParas { Index = 2, WireType = "右导", Angle = -90, Points = new string[] { "1000", "1002" } }, }; List <VStringParas> vStringList = new List <VStringParas>() { new VStringParas() { Index = "V1", L1 = 8350, H1 = 9940, L2 = 8350, H2 = 9940, StressLimit = 0, Angle = 0 }, }; HangingPointSettingParas ratioParas = new HangingPointSettingParas() { GCQ = 0.5f, GCH = 0.5f, GXN = -1, GXW = 2, DQWQ = 0.7f, DQWH = 0.3f, DQCQ = 0.7f, DQCH = 0.3f, DDWQ = 0.7f, DDWH = 0.3f, DDCQ = 0.7f, DDCH = 0.3f, DMWQ = 0.7f, DMWH = 0.3f, DMCQ = 0.7f, DMCH = 0.3f, IsTuringPointSeleced = true, NormalXYPoints = normalList, NormalZPoints = normalList, InstallXYPoints = installList, InstallZPoints = installList, TurningPoints = turningPoingts, VStrings = vStringList, }; LoadComposeLineTower loadLineTower = new LoadComposeLineTower(formulaParas, lineParas, ratioParas, template, openTemplateDialog.FileName); string filePath = saveFileDialog.FileName.Substring(0, saveFileDialog.FileName.Length - 3) + "cals"; loadLineTower.CalculateLoadDistribute(filePath); string filePath2 = saveFileDialog.FileName.Substring(0, saveFileDialog.FileName.Length - 3) + "div"; List <StruCalsPointLoad> loadList = loadLineTower.CalsPointsLoad(filePath2); string filePath3 = saveFileDialog.FileName.Substring(0, saveFileDialog.FileName.Length - 3) + "load"; loadLineTower.GenerateLoadFile(filePath3, loadList); }