private static void Select(string[] args) { var param = SelectObsParam.ParseArgs(args); var opt = param.Option; 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) { Select(opt, dir, file); } } else { Select(opt, outDir, inputPath); } } }
private static SelectObsParam ParseDic(Dictionary <string, List <string> > dic) { SelectObsParam SelectObsParam = new SelectObsParam(); var Option = SelectObsParam.Option; foreach (var item in dic) { var type = Gdp.Utils.EnumUtil.TryParse <SelectObsParamType>(item.Key); var listVal = item.Value; switch (type) { case SelectObsParamType._: break; case SelectObsParamType.F: break; case SelectObsParamType.OutputDirectory: SelectObsParam.OutputDirectory = (listVal[0]); break; case SelectObsParamType.InputPath: SelectObsParam.InputPath = (listVal); break; case SelectObsParamType.SatelliteType: var sats = new List <SatelliteType>(); foreach (var val in listVal) { var satType = Utils.EnumUtil.TryParse <SatelliteType>(val); sats.Add(satType); } Option.IsEnableSatelliteTypes = true; Option.SatelliteTypes = sats; break; case SelectObsParamType.StartTime: Option.IsEnableTimePeriod = true; Option.TimePeriod.Start = Time.Parse(listVal.ToArray()); break; case SelectObsParamType.EndTime: Option.IsEnableTimePeriod = true; Option.TimePeriod.End = Time.Parse(listVal.ToArray()); break; case SelectObsParamType.IncludeSiteNames: Option.IsEnableIncludeSiteNames = true; Option.IncludeSiteNames = (listVal); break; case SelectObsParamType.ExcludeSiteNames: Option.ExcludeSiteNames = (listVal); break; case SelectObsParamType.ObsCodes: Option.IsEnableObsCodes = true; Option.ObsCodes = (listVal); break; case SelectObsParamType.MinEpochCount: Option.IsEnableMinEpochCount = true; Option.MinEpochCount = Utils.IntUtil.ParseInt(listVal[0]); break; case SelectObsParamType.MinFrequencyCount: Option.IsEnableMinFrequencyCount = true; Option.MinFrequencyCount = Utils.IntUtil.ParseInt(listVal[0]); break; case SelectObsParamType.MinFileSizeMB: Option.IsEnableMinFileSizeMB = true; Option.MinFileSizeMB = Utils.DoubleUtil.TryParse(listVal[0]); break; default: log.Warn(type + " Not implemented "); break; } } return(SelectObsParam); }