Пример #1
0
        private void btn_InPutFile_High_Click(object sender, EventArgs e)
        {
            FolderBrowserDialog folderBrowserDialog1 = new FolderBrowserDialog();

            if (folderBrowserDialog1.ShowDialog() == DialogResult.OK)
            {
                this.TextBox_HighPath.Text = folderBrowserDialog1.SelectedPath;
            }
            //先清空
            this.dataGridView.Rows.Clear();
            //获取低……影像文件
            string[] LowFileList = System.IO.Directory.GetFiles(this.TextBox_LowPath.Text.ToString(), "*.tif");
            int      nLow        = LowFileList.Count();

            for (int i = 0; i < nLow; i++)
            {
                //得到低……文件名
                string LowFilename = Path.GetFileNameWithoutExtension(LowFileList[i]);
                //得到低……获取时间并转为年月日
                string sDate = LowFilename.Substring(LowFilename.IndexOf(".") + 1);
                sDate = sDate.Substring(1, sDate.IndexOf("."));
                string           syeartemp         = sDate.Substring(0, 4);
                string           sjuliaday         = sDate.Substring(4, 3);
                int              iyear             = Convert.ToInt16(syeartemp);
                int              ijuliaday         = Convert.ToInt16(sjuliaday);
                int[]            Date              = new int[3];
                DateJuliaConvert vDateJuliaConvert = new DateJuliaConvert();
                Date = vDateJuliaConvert._JuliaDay(iyear, ijuliaday);
                //判断高……是否存在并显示

                string syear  = Date[0].ToString();
                string sday   = Date[2].ToString();
                string smonth = Date[1].ToString();
                if (Date[1] <= 9)
                {
                    smonth = "0" + smonth;
                }
                if (Date[2] <= 9)
                {
                    sday = "0" + sday;
                }
                string   mark         = "*" + syear + smonth + sday + "*.tif";
                string[] HighFileList = System.IO.Directory.GetFiles(this.TextBox_HighPath.Text.ToString(), mark);
                string[] row          = new string[3];
                if (HighFileList.Count() != 0)
                {
                    row[0] = syear + smonth + sday;
                    row[1] = "√";
                    row[2] = "√";
                }
                else
                {
                    row[0] = syear + smonth + sday;
                    row[1] = "√";
                    row[2] = "";
                }
                this.dataGridView.Rows.Add(row);
            }
        }
Пример #2
0
        private void btn_InPutFile_High_Click(object sender, EventArgs e)
        {
            FolderBrowserDialog folderBrowserDialog1 = new FolderBrowserDialog();
            if (folderBrowserDialog1.ShowDialog() == DialogResult.OK)
            {
                this.TextBox_HighPath.Text = folderBrowserDialog1.SelectedPath;
            }
            //先清空
            this.dataGridView.Rows.Clear();
            //获取低……影像文件
            string[] LowFileList = System.IO.Directory.GetFiles(this.TextBox_LowPath.Text.ToString(), "*.tif");
            int nLow = LowFileList.Count();
            for (int i = 0; i < nLow; i++)
            {
                //得到低……文件名
                string LowFilename = Path.GetFileNameWithoutExtension(LowFileList[i]);
                //得到低……获取时间并转为年月日
                string sDate = LowFilename.Substring(LowFilename.IndexOf(".") + 1);
                sDate = sDate.Substring(1, sDate.IndexOf("."));
                string syeartemp = sDate.Substring(0, 4);
                string sjuliaday = sDate.Substring(4, 3);
                int iyear = Convert.ToInt16(syeartemp);
                int ijuliaday = Convert.ToInt16(sjuliaday);
                int[] Date = new int[3];
                DateJuliaConvert vDateJuliaConvert = new DateJuliaConvert();
                Date = vDateJuliaConvert._JuliaDay(iyear, ijuliaday);
                //判断高……是否存在并显示

                string syear = Date[0].ToString();
                string sday = Date[2].ToString();
                string smonth = Date[1].ToString();
                if (Date[1] <= 9)
                {
                    smonth = "0" + smonth;
                }
                if (Date[2] <= 9)
                {
                    sday = "0" + sday;
                }
                string mark = "*" + syear + smonth + sday + "*.tif";
                string[] HighFileList = System.IO.Directory.GetFiles(this.TextBox_HighPath.Text.ToString(), mark);
                string[] row = new string[3];
                if (HighFileList.Count() != 0)
                {
                    row[0] = syear + smonth + sday;
                    row[1] = "√";
                    row[2] = "√";

                }
                else
                {
                    row[0] = syear + smonth + sday;
                    row[1] = "√";
                    row[2] = "";
                }
                this.dataGridView.Rows.Add(row);
            }
        }