private void button3_Click(object sender, EventArgs e) { try { //check string[] files = this.textBox1.Lines; if (files.Length == 0) { throw new ArgumentNullException("输入文件不可为空。"); } string[] ff = this.textBox2.Lines; if (ff.Length == 0) { throw new ArgumentNullException("输入文件不可为空。"); } string fileName; TeqcFunctionCaller call = new TeqcFunctionCaller(TeqcSet.TeqcPath, TeqcFunction.Translation); switch (comboBox1.Text) { //下面的代码有问题,因为原文件为.dat,而用到的n文件和o文件前面的年份暂无法确定 case "Trimble": fileName = this.textBox2.Text + files[0].Substring(files[0].LastIndexOf("\\")); //获取新路径及其文件名 files[0] = "-tr do -week " + this.textBox4.Text + " +nav " + fileName.Substring(0, fileName.LastIndexOf(".") + 1) + this.textBox4.Text.Substring(2, 2) + "n " + this.textBox1.Text + " > " + fileName.Substring(0, fileName.LastIndexOf(".") + 1) + this.textBox4.Text.Substring(2, 2) + "o"; this.textBox3.Text = call.Run(files)[0]; break; case "Leica": //param = QualityChecking; break; case "Topcon": fileName = this.textBox2.Text + files[0].Substring(files[0].LastIndexOf("\\")); files[0] = "-top tps -week " + this.textBox4.Text + " +nav " + fileName.Substring(0, fileName.LastIndexOf(".") + 1) + this.textBox4.Text.Substring(2, 2) + "n " + this.textBox1.Text + " > " + fileName.Substring(0, fileName.LastIndexOf(".") + 1) + this.textBox4.Text.Substring(2, 2) + "o"; this.textBox3.Text = call.Run(files)[0]; break; default: //param = ""; break; } } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void button_run_Click(object sender, EventArgs e) { try { //check string[] files = this.textBox_infiles.Lines; if (files.Length == 0) { throw new ArgumentNullException("输入文件不可为空。"); } TeqcFunctionCaller call = new TeqcFunctionCaller(Setting.GnsserConfig.TeqcPath, TeqcFunction.QualityChecking); this.textBox_result.Text = call.Run(files)[0]; } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void button3_Click(object sender, EventArgs e) { try { //check string[] files = this.textBox1.Lines; if (files.Length == 0) { throw new ArgumentNullException("输入文件不可为空。"); } string[] ff = this.textBox3.Lines; if (ff.Length == 0) { ff[0] = files[0].Substring(0, files[0].LastIndexOf("\\")); } string[] fs = this.textBox2.Lines; string sp; if (fs.Length == 0) { sp = ""; } else { sp = fs[0]; } string newrinex_path = "0";//此处若不赋值,则下文读写文件时会提示使用为赋值的路径? TeqcFunctionCaller call = new TeqcFunctionCaller(TeqcSet.TeqcPath, TeqcFunction.Translation); switch (comboBox1.Text) { case "GPS": string fileName = this.textBox3.Text + files[0].Substring(files[0].LastIndexOf("\\")); //获取新路径及其文件名 files[0] = "-G " + sp + " " + files[0] + " > " + fileName; this.textBox4.Text = call.Run(files)[0]; newrinex_path = fileName; break; case "GLONASS": string fileName2 = this.textBox3.Text + files[0].Substring(files[0].LastIndexOf("\\")); //获取新路径及其文件名 files[0] = "-R " + sp + " " + files[0] + " > " + fileName2; this.textBox4.Text = call.Run(files)[0]; newrinex_path = fileName2; break; default: //param = ""; break; } //下面部分对卫星系统选择后的o文件的文件头信息 进行修改,使其在后续质量检核中生成的结果文件可以被绘图文件顺利读取 string[] readText = File.ReadAllLines(newrinex_path); File.WriteAllText(newrinex_path, "");//创建一个空文件,覆盖原来的newrinex_path StreamWriter sr = new StreamWriter(newrinex_path); for (int i = 0; i < readText.Length; i++) { if (readText[i].Contains("M (MIXED)")) { readText[i] = readText[i].Replace("M (MIXED)", "G (GPS) "); } if (readText[i].Contains("Mixed(MIXED)")) { readText[i] = readText[i].Replace("Mixed(MIXED)", "G (GPS) "); } sr.WriteLine(readText[i]); //if (readText[time].Contains("END OF HEADER")) //{ // for (int j = time+1; j < readText.Length; j++) // { // readText[j] = readText[j].Replace("G", " "); // sr.WriteLine(readText[j]); // } // break; //} } sr.Flush(); sr.Close(); } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void button_BAT_Click(object sender, EventArgs e) { this.Items.Clear(); this.Failure.Clear(); stopwatch.Stop(); stopwatch.Start(); Geo.Utils.FormUtil.InitProgressBar(this.progressBar1, pathes.Count); foreach (KeyValuePair <string, string> kv in pathes) { string paths = kv.Value; destDir = paths.Substring(0, paths.LastIndexOf("\\")); TeqcFunctionCaller call = new TeqcFunctionCaller(TeqcSet.TeqcPath, TeqcFunction.QualityChecking); string result = call.Run(paths)[0]; QCresult item = new QCresult(); QCresult fail = new QCresult(); //当后台cmd输出流不正常时,说明该测站O文件QC失败! if (!result.Contains("SUM ") || ((result.Contains("SUM ")) && result.Substring(result.IndexOf("SUM ") + 63, 4).Replace(" ", "") == "n/a")) { fail.Sites = paths.Substring(paths.LastIndexOf("\\") + 1, 4); fail.First_epoch = @"失败"; fail.Last_epoch = @"失败"; fail.Hrs = @"失败"; fail.Dt = @"失败"; fail.Expt = @"失败"; fail.Have = @"失败"; fail.Percent = @"失败"; fail.Mp1 = @"失败"; fail.Mp2 = @"失败"; fail.O_slps = @"失败"; this.Failure.Add(fail); } else { item.Sites = paths.Substring(paths.LastIndexOf("\\") + 1, 4); item.First_epoch = result.Substring(result.IndexOf("SUM ") + 4, 2) + @"-" + result.Substring(result.IndexOf("SUM ") + 7, 2).Replace(" ", "") + @"-" + result.Substring(result.IndexOf("SUM ") + 10, 2).Replace(" ", "") + result.Substring(result.IndexOf("SUM ") + 12, 6); item.Last_epoch = result.Substring(result.IndexOf("SUM ") + 19, 2) + @"-" + result.Substring(result.IndexOf("SUM ") + 22, 2).Replace(" ", "") + @"-" + result.Substring(result.IndexOf("SUM ") + 25, 2).Replace(" ", "") + result.Substring(result.IndexOf("SUM ") + 27, 6); item.Hrs = result.Substring(result.IndexOf("SUM ") + 34, 5).Replace(" ", ""); item.Dt = result.Substring(result.IndexOf("SUM ") + 41, 2).Replace(" ", ""); item.Expt = result.Substring(result.IndexOf("SUM ") + 45, 5).Replace(" ", ""); item.Have = result.Substring(result.IndexOf("SUM ") + 52, 5).Replace(" ", ""); item.Percent = result.Substring(result.IndexOf("SUM ") + 58, 3).Replace(" ", ""); item.Mp1 = result.Substring(result.IndexOf("SUM ") + 63, 4).Replace(" ", ""); item.Mp2 = result.Substring(result.IndexOf("SUM ") + 69, 4).Replace(" ", ""); item.O_slps = result.Substring(result.IndexOf("SUM ") + 74, 6).Replace(" ", ""); this.Items.Add(item); } this.progressBar1.PerformStep(); this.progressBar1.Update(); this.Update(); } string msg = "转换完毕,耗时 " + stopwatch.Elapsed.ToString(); stopwatch.Reset(); msg += "\r\n是否打开?"; Geo.Utils.FormUtil.ShowIfOpenDirMessageBox(destDir, msg); }