public bool Init() { if (!System.IO.Directory.Exists(Folder)) { Error += string.Format("指定的目录{0}不存在或者不正确", Folder); return(false); } Files = FileManager.GetSpecialFiles(Folder, "*.shp"); if (Files == null || Files.Count == 0) { Error += string.Format("指定目录中未找到可以分析的文件或者为空"); return(false); } MaxValue = Files.Count; SpatialReference = CoordinateFile.CreateSpatialReference(); if (SpatialReference == null) { Error += string.Format("指定的坐标系文件{0}无法打开", System.IO.Path.GetFileNameWithoutExtension(CoordinateFile)); return(false); } return(true); }
public void Work() { SpatialReference = CoordinateFile.CreateSpatialReference(); var files = FileManager.GetSpecialFiles(Folder, "*.shp"); ParallelLoopResult result = Parallel.ForEach <string>(files, s => { Work(s); }); }