コード例 #1
0
        static public CmdParam ParseArgs(string[] args)
        {
            var dic = ParseCmdLineToDic(args);

            CmdParam cmdParam = new CmdParam()
            {
                SolveType = dic
            };

            return(cmdParam);
        }
コード例 #2
0
        /// <summary>
        /// 解析参数
        /// </summary>
        /// <param name="args"></param>
        /// <returns></returns>
        public static CmdParam ParseParams(string[] args)
        {
            //参数解析
            CmdParam cmdParam = null;

            if (args != null && args.Length > 0)
            {
                //test
                //foreach (var item in args)
                //{
                //    Console.WriteLine(item);
                //}

                cmdParam = CmdParam.ParseArgs(args);
                //     log.Info("参数解析成功!" + cmdParam.ToString());
            }
            return(cmdParam);
        }
コード例 #3
0
        /// <summary>
        /// 命令行参数是以空格符分开的。
        /// </summary>
        /// <param name="args"></param>
        public static void Execute(string[] args, IProgressViewer ProgressViewer = null)
        {
            //首先欢迎
            //ShowInfo("              GDP ——GNSS数据处理软件   ");
            //ShowInfo("-------------   Version 1.0,  www.gnsser.com   --------------------");


            CmdParam cmdParam = CmdParam.ParseParams(args);

            if (cmdParam == null)
            {
                log.Error("Empty params!");
                //此处应该显示版本helper等
                ShowHelp();
                return;
            }

            try
            {
                //参数初始化
                var startTime = DateTime.Now;
                ProcessCount++;
                ShowInfo("Processing....");
                switch (cmdParam.SolveType)
                {
                case ProcessType.H:
                    ShowHelp();
                    break;

                case ProcessType.V:
                    System.Console.WriteLine("Version: " + Setting.Version.ToString("0.0"));
                    break;

                case ProcessType.B:
                    BuildUrls(args);
                    break;

                case ProcessType.D:
                    Download(args);
                    break;

                case ProcessType.F:
                    FormatConvert(args);
                    break;

                case ProcessType.S:
                    Select(args);
                    break;

                case ProcessType.C:
                    ConvertToOneTable(args);
                    break;

                case ProcessType.E:
                    ExtractSiteInfo(args);
                    break;

                default:
                    log.Warn(cmdParam.SolveType + "Not implemented ");
                    break;
                }

                ShowInfo("Done!");
                var timeSpan = DateTime.Now - startTime;
                ShowInfo("TimeSpan:" + timeSpan);
            }
            catch (Exception ex)
            {
                ShowInfo(ex.Message);
            }

            //暂停屏幕
            //    System.Console.ReadLine();
        }
コード例 #4
0
        /// <summary>
        /// 命令行参数是以空格符分开的。
        /// </summary>
        /// <param name="args"></param>
        public static void Execute(string[] args, IProgressViewer ProgressViewer = null)
        {
            //首先欢迎
            //ShowInfo("              GDP ——GNSS数据处理软件   ");
            //ShowInfo("-------------   Version 1.0,  www.gnsser.com   --------------------");


            CmdParam cmdParam = CmdParam.ParseParams(args);

            if (cmdParam == null)
            {
                log.Error("Empty params!");
                //此处应该显示版本helper等

                return;
            }

            try
            {
                //参数初始化
                var startTime = DateTime.Now;
                ProcessCount++;
                ShowInfo("Processing....");
                switch (cmdParam.SolveType)
                {
                case ProcessType.H:
                    if (File.Exists(Setting.HelpDocument))
                    {
                        var help = File.ReadAllText(Setting.HelpDocument);
                        System.Console.WriteLine(help);
                    }
                    break;

                case ProcessType.V:
                    System.Console.WriteLine("Version: " + Setting.Version.ToString("0.0"));
                    break;

                case ProcessType.B:
                    BuildUrls(args);
                    break;

                case ProcessType.D:
                    Download(args);
                    break;

                case ProcessType.F:
                    FormatConvert(args);
                    break;

                case ProcessType.S:
                    Select(args);
                    break;

                case ProcessType.C:
                    var param  = ConvertToOneTableParam.ParseArgs(args);
                    var outDir = param.OutputDirectory;
                    foreach (var inputPath in param.InputPath)
                    {
                        if (FileUtil.IsDirectory(inputPath))
                        {
                            if (!Directory.Exists(inputPath))
                            {
                                continue;
                            }

                            var list   = new List <string>();
                            var files  = Directory.GetFiles(inputPath, "*.rnx|*.RNX|*.??o|*.??O");
                            var subDir = PathUtil.GetSubDirectory(inputPath);
                            var dir    = Path.Combine(outDir, subDir);
                            FileUtil.CheckOrCreateDirectory(dir);
                            foreach (var file in files)
                            {
                                ConvertToOneTable(dir, file);
                            }
                        }
                        else
                        {
                            ConvertToOneTable(outDir, inputPath);
                        }
                    }
                    break;

                default:
                    log.Warn(cmdParam.SolveType + "Not implemented ");
                    break;
                }



                ShowInfo("Done!");
                var timeSpan = DateTime.Now - startTime;
                ShowInfo("TimeSpan:" + timeSpan);
            }
            catch (Exception ex)
            {
                ShowInfo(ex.Message);
            }

            //暂停屏幕
            //    System.Console.ReadLine();
        }