コード例 #1
0
        private void FormatRinex(string sourseDir, string destDir, bool delSourse)
        {
            if (!Directory.Exists(destDir))
            {
                Directory.CreateDirectory(destDir);
            }

            string[] files = Directory.GetFiles(sourseDir);

            if (this.ProgressBar != null)
            {
                this.ProgressBar.InitProcess(files.Length);
            }

            TeqcFormater de = new TeqcFormater();

            foreach (var item in files)
            {
                if (IsCancelProcessing)
                {
                    break;
                }
                ;

                try
                {
                    de.Formate(item, destDir, delSourse);
                    ShowInfo("总进度 " + (allCountProcess) + "/" + allCount + " TEQC格式化 " + item);
                    PerformStep();
                }
                catch (Exception ex)
                {
                    string msg = "格式化Rinex出错了:" + ex.Message;
                    ShowInfo(msg);
                    if (!ignoreError)
                    {
                        if (FormUtil.ShowYesNoMessageBox(msg + "是否继续?")
                            == System.Windows.Forms.DialogResult.No)
                        {
                            break;
                        }
                    }
                }
            }
        }
コード例 #2
0
ファイル: TeqcFormatRinexForm.cs プロジェクト: yxw027/GNSSer
        private void button_ok_Click(object sender, EventArgs e)
        {
            DateTime fromTime = DateTime.Now;

            ShowInfo("正在转换中,请稍后……");
            ShowResult("开始:" + fromTime, false);

            string        inDirPath      = this.textBox_inDirPath.Text;
            List <String> inFileList     = new List <string>();
            List <string> searchPatterns = new List <string>()
            {
                "*.**n", "*.**o", "*.**m"
            };

            SearchOption opt = checkBox_subIncluded.Checked ? SearchOption.AllDirectories : SearchOption.TopDirectoryOnly;


            foreach (string sp in searchPatterns)
            {
                string[] inFiles = Directory.GetFiles(inDirPath, sp, opt);
                if (inFiles.Length != 0)
                {
                    inFileList.AddRange(inFiles);
                }
            }

            if (inFileList.Count == 0)
            {
                FormUtil.ShowErrorMessageBox("该文件夹下没有文件。"); return;
            }

            Geo.Utils.FormUtil.InitProgressBar(this.progressBar1, inFileList.Count);

            string outDirPath = this.textBox_savePath.Text.Trim();

            if (outDirPath == String.Empty)
            {
                FormUtil.ShowErrorMessageBox("请选择输出文件夹。"); return;
            }
            int          num      = 0;
            TeqcFormater formater = new TeqcFormater();

            foreach (string inPath in inFileList)
            {
                string outPath = inPath.Replace(inDirPath, outDirPath);

                string outDir = Path.GetDirectoryName(outPath);
                if (!Directory.Exists(outDir))
                {
                    Directory.CreateDirectory(outDir);
                }


                //notice
                ShowInfo("正在转换 " + inPath + " " + (++num) + "/" + inFileList.Count);


                string info = formater.Formate(inPath, outDir, checkBox_delOrigin.Checked);
                ShowResult(info);

                // Shell.Run(exePath + param);
                progressBar1.PerformStep();
            }

            DateTime toTime = DateTime.Now;
            TimeSpan span   = toTime - fromTime;

            string msg = "转换完毕。共转换" + inFileList.Count + "个文件。耗时:" + span.ToString();

            ShowInfo(msg);
            msg += "\r\n是否打开输出文件夹?";
            ShowResult(msg);

            FormUtil.ShowOkAndOpenDirectory(outDirPath, msg);
        }