/// <summary> /// 主要API,获取文件。如果是网络数据,则下载到本地后返回本地路径。 /// 如果是本地目录,则返回匹配的所有文件路径,注意:目录只搜索本层。 /// </summary> /// <param name="inputPath"></param> /// <param name="sourceFileExtension">如[.*z],输入匹配文件类型,仅对于目录(本地目录或ftp目录)有效。,可以以分号分隔多个匹配类型</param> /// <param name="destFileExtension">如[.*o],输出匹配文件类型,仅对于目录(本地目录或ftp目录)有效。,可以以分号分隔多个匹配类型</param> /// <returns></returns> public List <string> GetLocalFilePathes(string inputPath, string destFileExtension = "*.*o", string sourceFileExtension = "*.*") { //首先下载原始数据 List <string> list = GetLocalFilePathes(inputPath, sourceFileExtension); //如果匹配目标类型,则直接返回。 if (destFileExtension.EndsWith("*", StringComparison.CurrentCultureIgnoreCase)) { return(list); } List <string> pathes = new List <string>(); //判断并执行数据解压 foreach (var fileName in list) { if (!File.Exists(fileName)) { continue; } // if (IsCancel) { break; } var ps = FileDecompressManager.Decompress(fileName, destFileExtension); pathes.AddRange(ps); } return(pathes); }
/// <summary> /// 构造函数 /// </summary> /// <param name="LocalTempDirectory"></param> public InputFileManager(string LocalTempDirectory = null) { this.IsOverwrite = false; if (LocalTempDirectory == null) { LocalTempDirectory = Path.Combine(Setting.TempDirectory, "InputFiles"); } this.LocalTempDirectory = LocalTempDirectory; var dDecompressExeDir = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, @"Data\Exe\"); this.FileDecompressManager = FileDecompressManager.GetDefault(this.LocalTempDirectory, dDecompressExeDir); }
/// <summary> /// 提供一个more的管理器。 /// </summary> public static FileDecompressManager GetDefault(string tempFolder = @"C:\GnsserTemp\", string exeDir = @"Data\Exe\") { FileDecompressManager FileDecompressManager = new FileDecompressManager(tempFolder); FileDecompressManager.Regist(new GZipFileDecompresser()); FileDecompressManager.Regist(new ZFileDecompresser()); FileDecompressManager.Regist(new ZipFileDecompresser()); FileDecompressManager.Regist(new RinexCrxFileDecompresser(exeDir)); FileDecompressManager.Regist(new RinexDFileDecompresser(exeDir)); return(FileDecompressManager); }
/// <summary> /// 构造函数 /// </summary> /// <param name="LocalTempDirectory"></param> /// <param name="FileDecompressManager"></param> public InputFileManager(FileDecompressManager FileDecompressManager, string LocalTempDirectory = @"Data\Temp\InputFiles\") { this.IsOverwrite = false; this.LocalTempDirectory = LocalTempDirectory; this.FileDecompressManager = FileDecompressManager; }