protected override void RunCore() { var existingShapePathFileNames = ShapePathFileNames.Where(s => CheckShapeFileExists(s.Key)); var upperBounds = GetUpperBounds(existingShapePathFileNames); CreateOutputPath(OutputPathFileName); var currentIndex = 0; foreach (var currentShapePathFileName in existingShapePathFileNames) { try { string currentShapeFileName = Path.GetFileName(currentShapePathFileName.Key); string outputShapePathFileName = Path.Combine(OutputPathFileName, currentShapeFileName); string outputTempIdxPathFileName = Path.Combine(OutputPathFileName, "TMP" + currentShapeFileName); outputTempIdxPathFileName = Path.ChangeExtension(outputTempIdxPathFileName, ".idx"); DeleteRelatedFiles(outputShapePathFileName); Proj4Projection projection = new Proj4Projection(); projection.InternalProjectionParametersString = currentShapePathFileName.Value; projection.ExternalProjectionParametersString = TargetProjectionParameter; projection.Open(); //CreateShapeFileWithIndex(currentShapePathFileName.Key, outputShapePathFileName, outputTempIdxPathFileName, projection, upperBounds, ref current); var currentFeatureSource = new ShapeFileFeatureSource(currentShapePathFileName.Key); currentFeatureSource.Open(); string projectionWkt = Proj4Projection.ConvertProj4ToPrj(TargetProjectionParameter); ShapeFileHelper helper = new ShapeFileHelper(currentFeatureSource.GetShapeFileType(), outputShapePathFileName, currentFeatureSource.GetColumns(), projectionWkt); helper.ForEachFeatures(currentFeatureSource, f => { if (f.GetWellKnownBinary() != null) { var newFeature = projection.ConvertToExternalProjection(f); if (newFeature.CanMakeValid) { newFeature = newFeature.MakeValid(); } if (newFeature.GetWellKnownType() != WellKnownType.GeometryCollection) { helper.Add(newFeature); } } currentIndex++; UpdatingTaskProgressEventArgs args = new UpdatingTaskProgressEventArgs(TaskState.Updating, currentIndex * 100 / upperBounds); args.Current = currentIndex; args.UpperBound = upperBounds; OnUpdatingProgress(args); return(args.TaskState == TaskState.Canceled); }); helper.Commit(); CreateDbfFile(currentShapePathFileName.Key, outputShapePathFileName); //CreatePrjFile(outputShapePathFileName, TargetProjectionParameter); } catch (Exception ex) { UpdatingTaskProgressEventArgs errorArgs = new UpdatingTaskProgressEventArgs(TaskState.Error); errorArgs.Error = new ExceptionInfo(ex.Message, ex.StackTrace, ex.Source); GisEditor.LoggerManager.Log(LoggerLevel.Debug, ex.Message, new ExceptionInfo(ex)); OnUpdatingProgress(errorArgs); continue; } } }