コード例 #1
0
        private static void ConvertToOneTable(string[] args)
        {
            ConvertToOneTableParam param;
            string outDir;

            param  = ConvertToOneTableParam.ParseArgs(args);
            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);
                }
            }
        }
コード例 #2
0
        private static ConvertToOneTableParam ParseDic(Dictionary <string, List <string> > dic)
        {
            ConvertToOneTableParam ConvertToOneTableParam = new ConvertToOneTableParam();

            foreach (var item in dic)
            {
                var type    = Gdp.Utils.EnumUtil.TryParse <ConvertToOneTableParamType>(item.Key);
                var listVal = item.Value;
                switch (type)
                {
                case ConvertToOneTableParamType._:
                    break;

                case ConvertToOneTableParamType.C:
                    break;

                case ConvertToOneTableParamType.OutputDirectory:
                    ConvertToOneTableParam.OutputDirectory = (listVal[0]);
                    break;

                case ConvertToOneTableParamType.InputPath:
                    ConvertToOneTableParam.InputPath = (listVal);
                    break;

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

            return(ConvertToOneTableParam);
        }
コード例 #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等

                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();
        }