예제 #1
0
        private void SaveArgs2Xml()
        {
            //根据界面显示将MODIS路径添加为dictionary
            DataBaseArg arg = new DataBaseArg();

            if (cbxMODISYear.Items.Count > 0)
            {
                Dictionary <int, string> modisdir = new Dictionary <int, string>();
                int year;
                for (int i = 0; i < cbxMODISYear.Items.Count; i++)
                {
                    if (int.TryParse(cbxMODISYear.Items[i].ToString(), out year))
                    {
                        modisdir.Add(year, cbxMODISdir.Items[i].ToString());
                    }
                }
                if (modisdir.Count > 0)
                {
                    arg.MODISRootPath = modisdir;
                }
            }
            if (!string.IsNullOrEmpty(ISCCPRootPath.Text) || !string.IsNullOrWhiteSpace(ISCCPRootPath.Text))
            {
                arg.ISCCPRootPath = ISCCPRootPath.Text;
            }
            if (!string.IsNullOrEmpty(AIRSRootPath.Text) || !string.IsNullOrWhiteSpace(AIRSRootPath.Text))
            {
                arg.AIRSRootPath = AIRSRootPath.Text;
            }
            if (!string.IsNullOrEmpty(ClouSATRootPath.Text) || !string.IsNullOrWhiteSpace(ClouSATRootPath.Text))
            {
                arg.CloudSATRootPath = ClouSATRootPath.Text;
            }
            arg.RootPathToXml(_RootPathsArgsXml);
        }
예제 #2
0
        public static string GetRootPathFromName(string localfname)
        {
            DataBaseArg dbargs = DataBaseArg.ParseXml(_dataBaseXml);
            //string dir = dbargs.OutputDir;
            string dir = null;

            if (Path.GetDirectoryName(localfname).ToUpper().Contains("MODIS"))
            {
                dir = dbargs.OutputDir;
            }
            else if (Path.GetDirectoryName(localfname).ToUpper().Contains("AIRS"))
            {
                dir = dbargs.AIRSRootPath;
            }
            else if (Path.GetDirectoryName(localfname).ToUpper().Contains("ISCCP"))
            {
                dir = dbargs.ISCCPRootPath;
            }
            else if (Path.GetDirectoryName(localfname).ToUpper().Contains("CLOUDSAT"))
            {
                dir = dbargs.CloudSATRootPath;
            }
            else
            {
                dir = dbargs.OutputDir;
            }
            return(dir);
        }
예제 #3
0
 public void TryParseXmlArgs()
 {
     if (File.Exists(_RootPathsArgsXml))
     {
         DataBaseArg arg = new DataBaseArg();
         arg.ParseRootPathXml(_RootPathsArgsXml);
         if (arg.MODISRootPath != null && arg.MODISRootPath.Count > 0)
         {
             Dictionary <int, string> modisdir = arg.MODISRootPath;
             foreach (int year in modisdir.Keys)
             {
                 cbxMODISYear.Items.Add(year);
                 cbxMODISdir.Items.Add(modisdir[year]);
             }
         }
         if (arg.ISCCPRootPath != null)
         {
             ISCCPRootPath.Text = arg.ISCCPRootPath;
         }
         if (arg.AIRSRootPath != null)
         {
             AIRSRootPath.Text = arg.AIRSRootPath;
         }
         if (arg.CloudSATRootPath != null)
         {
             ClouSATRootPath.Text = arg.CloudSATRootPath;
         }
         isInit = false;
     }
 }
예제 #4
0
        private void SaveArgs2Xml()
        {
            DataBaseArg arg = new DataBaseArg();

            arg.ServerName       = txtserver.Text;
            arg.DatabaseName     = txtDatabase.Text;
            arg.UID              = txtAccount.Text;
            arg.Passwords        = txtpassword.Text;
            arg.OutputDir        = MODISRootPath.Text;
            arg.AIRSRootPath     = AIRSRootPath.Text;
            arg.ISCCPRootPath    = ISCCPRootPath.Text;
            arg.CloudSATRootPath = CloudSATRootPath.Text;
            arg.ToXml(_dataBaseXml);
        }
예제 #5
0
 private void InitSetting()
 {
     cbxPrdsLevl.Items.Add("原始产品数据");
     //cbxPrdsLevl.Items.Add("历史日拼接数据");
     //cbxPrdsLevl.Items.Add("周期合成产品数据");
     //checkbxMODIS.Checked = true;
     cbxPrdsLevl.SelectedIndex = 0;
     if (!File.Exists(_dataBaseXml))
     {
         MessageBox.Show("数据库配置文件不存在,请先配置数据库!");
         return;
     }
     arg = DataBaseArg.ParseXml(_dataBaseXml);
     //txtDocDir.Text = arg.OutputDir;
 }
예제 #6
0
 public void TryParseXmlArgs()
 {
     if (File.Exists(_dataBaseXml))
     {
         DataBaseArg arg = DataBaseArg.ParseXml(_dataBaseXml);
         txtserver.Text        = arg.ServerName;
         txtDatabase.Text      = arg.DatabaseName;
         txtAccount.Text       = arg.UID;
         txtpassword.Text      = arg.Passwords;
         MODISRootPath.Text    = arg.OutputDir;
         AIRSRootPath.Text     = arg.AIRSRootPath;
         ISCCPRootPath.Text    = arg.ISCCPRootPath;
         CloudSATRootPath.Text = arg.CloudSATRootPath;
     }
 }
예제 #7
0
 private void InitSetting()
 {
     _data2DBTable.Add("ISCCP", "cp_isccpd2_tb");
     _data2DBTable.Add("MODIS", "cp_modismod06_tb");
     _data2DBTable.Add("AIRS", "cp_airs_tb");
     _data2DBTable.Add("CLOUDSAT", "cp_cloudsat_tb");
     _data2DBTable.Add("日拼接产品", "cp_daymergeproducts_tb");
     _data2DBTable.Add("周期合成产品", "cp_periodicsynthesis_tb");
     if (!File.Exists(_dataBaseXml))
     {
         MessageBox.Show("数据库配置文件不存在,请先配置数据库!");
         return;
     }
     _DBcon      = new ConnectMySqlCloud(_dataBaseXml);
     arg         = DataBaseArg.ParseXml(_dataBaseXml);
     _dataDocDir = arg.OutputDir;
 }
예제 #8
0
 private void InitTask()
 {
     CheckFrmMode();
     Load += new EventHandler(frmMod06DataPro_Load);
     lstRegions.SelectedIndexChanged += new EventHandler(lstRegionsSelectedIndexChanged);
     if (File.Exists(_dataBaseXml))
     {
         _dbcon = new ConnectMySqlCloud();
         DataBaseArg arg = DataBaseArg.ParseXml(_dataBaseXml);
         if (_frmMode.ToUpper() == "MOD06" || _frmMode.ToUpper() == "MYD06")
         {
             _outputDir = arg.OutputDir;
         }
         else
         {
             _outputDir = arg.AIRSRootPath;
         }
         txtOutDir.Text     = _outputDir;
         txtHistoryPrj.Text = _outputDir;
     }
     Control.CheckForIllegalCrossThreadCalls = false;//关闭该异常检测的方式来避免异常的出现
     _state = new Action <int, string>(InvokeProgress);
 }
예제 #9
0
 public bool ParseArgsXml()
 {
     if (File.Exists(_dataBaseXml))
     {
         DataBaseArg arg      = DataBaseArg.ParseXml(_dataBaseXml);
         string      rootpath = null;
         if (_sensor.ToUpper() == "MODIS")
         {
             rootpath = arg.OutputDir;
         }
         else if (_sensor.ToUpper() == "AIRS")
         {
             rootpath = arg.AIRSRootPath;
         }
         else if (_sensor.ToUpper() == "ISCCP")
         {
             rootpath = arg.ISCCPRootPath;
         }
         else if (_sensor.ToUpper() == "CLOUDSAT")
         {
             rootpath = arg.CloudSATRootPath;
         }
         else
         {
             return(false);
         }
         if (!Directory.Exists(rootpath))
         {
             return(false);
         }
         txtInputDir.Text  = rootpath;
         txtOutputDir.Text = rootpath;
     }
     else
     {
         MessageBox.Show("数据库配置文件不存在!");
     }
     if (File.Exists(_periodPrdsArgsXml))
     {
         _args           = InputArg.ParsePeriodArgsXml(_periodPrdsArgsXml);
         _args.InputDir  = txtInputDir.Text;
         _args.OutputDir = txtOutputDir.Text;
         string temp = "";
         foreach (string type in _args.StatisticsTypes)
         {
             temp += type + ",";
         }
         txtStaticsTypes.Text = temp.Remove(temp.Length - 1);
         temp = "";
         foreach (string type in _args.PeriodTypes)
         {
             temp += type + ",";
         }
         txtPeriodTypes.Text = temp.Remove(temp.Length - 1);
         if (_args.OverWriteHistoryFiles)
         {
             cbxOverlap.Checked = true;
         }
         return(true);
     }
     else
     {
         return(false);
     }
 }
예제 #10
0
 public bool ParseArgsXml()
 {
     if (File.Exists(_dataBaseXml))
     {
         _dbargs = DataBaseArg.ParseXml(_dataBaseXml);
         string rootpath = null;
         if (_sensor.ToUpper() == "MOD06" || _sensor.ToUpper() == "MYD06")
         {
             rootpath = _dbargs.OutputDir;
         }
         else if (_sensor.ToUpper() == "AIRS")
         {
             rootpath = _dbargs.AIRSRootPath;
         }
         else if (_sensor.ToUpper() == "ISCCP")
         {
             rootpath = _dbargs.ISCCPRootPath;
         }
         else
         {
             return(false);
         }
         if (!Directory.Exists(rootpath))
         {
             throw new ArgumentException("配置文件路径" + rootpath + "未找到,请重试!");
         }
         txtInputDir.Text  = rootpath;
         txtOutputDir.Text = rootpath;
         if (_sensor.ToUpper() == "MOD06")
         {
             radibtnMOD06.Checked = true;
         }
         else if (_sensor.ToUpper() == "AIRS")
         {
             radibtnAIRS.Checked = true;
         }
         else if (_sensor.ToUpper() == "MYD06")
         {
             radibtnMYD06.Checked = true;
         }
     }
     else
     {
         MessageBox.Show("数据库配置文件不存在!");
     }
     if (File.Exists(_periodPrdsArgsXml))
     {
         _args           = InputArg.ParsePeriodArgsXml(_periodPrdsArgsXml);
         _args.InputDir  = txtInputDir.Text;
         _args.OutputDir = txtOutputDir.Text;
         if (_args.StatisticsTypes.Contains("AVG"))
         {
             cbxAVG.Checked = true;
         }
         if (_args.StatisticsTypes.Contains("MIN"))
         {
             cbxMin.Checked = true;
         }
         if (_args.StatisticsTypes.Contains("MAX"))
         {
             cbxMax.Checked = true;
         }
         if (_args.PeriodTypes.Contains("TEN"))
         {
             cbxTen.Checked = true;
         }
         if (_args.PeriodTypes.Contains("MONTH"))
         {
             cbxTen.Checked   = true;
             cbxMonth.Checked = true;
         }
         if (_args.PeriodTypes.Contains("YEAR"))
         {
             cbxTen.Checked   = true;
             cbxMonth.Checked = true;
             cbxYear.Checked  = true;
         }
         if (_args.OverWriteHistoryFiles)
         {
             cbxOverlap.Checked = true;
         }
         return(true);
     }
     else
     {
         return(false);
     }
 }
예제 #11
0
 public static DataBaseArg ParseXml(string argXml)
 {
     if (string.IsNullOrWhiteSpace(argXml))
     {
         throw new ArgumentNullException("argXml", "参数文件为空");
     }
     if (!File.Exists(argXml))
     {
         throw new FileNotFoundException("参数文件不存在" + argXml, argXml);
     }
     try
     {
         string   server = "", database = "", uid = "", passwords = "";//,outputdir="";
         string   modisdir = "", airsdir = "", isccpdir = "", cloudsatdir = "";
         XElement xml = XElement.Load(argXml);
         XElement svr = xml.Element("Server");
         if (svr != null)
         {
             server = svr.Value;
         }
         XElement dbase = xml.Element("Database");
         if (dbase != null)
         {
             database = dbase.Value;
         }
         XElement id = xml.Element("Uid");
         if (id != null)
         {
             uid = id.Value;
         }
         XElement passwds = xml.Element("Passwords");
         if (passwds != null)
         {
             passwords = passwds.Value;
         }
         //XElement xoutputdir = xml.Element("OutputDir");
         //if (xoutputdir != null)
         //{
         //    outputdir = xoutputdir.Value;
         //}
         XElement modisXdir = xml.Element("MODIS");
         if (modisXdir != null)
         {
             modisdir = modisXdir.Attribute("RootPath").Value;
         }
         XElement airsxdir = xml.Element("AIRS");
         if (airsxdir != null)
         {
             airsdir = airsxdir.Attribute("RootPath").Value;
         }
         XElement isccpxdir = xml.Element("ISCCP");
         if (isccpxdir != null)
         {
             isccpdir = isccpxdir.Attribute("RootPath").Value;
         }
         XElement cloudxdir = xml.Element("CloudSAT");
         if (cloudxdir != null)
         {
             cloudsatdir = cloudxdir.Attribute("RootPath").Value;
         }
         DataBaseArg arg = new DataBaseArg();
         arg._serverName      = server;
         arg._databaseName    = database;
         arg._uid             = uid;
         arg._passwords       = passwords;
         arg._OutputDir       = modisdir;
         arg.CloudSATRootPath = cloudsatdir;
         arg.AIRSRootPath     = airsdir;
         arg.ISCCPRootPath    = isccpdir;
         return(arg);
     }
     catch (Exception ex)
     {
         throw new Exception("解析投影输入参数文件失败" + ex.Message, ex);
     }
 }