private MultipolygonShape BufferShape(BaseShape shape)
        {
            MultipolygonShape bufferedShape = null;

            if (capstyle == BufferCapType.Round)
            {
                bufferedShape = SqlTypesGeometryHelper.Buffer(shape, Distance, Smoothness, Capstyle, MapUnit, DistanceUnit);
            }
            else
            {
                bufferedShape = shape.Buffer(distance, smoothness, capstyle, mapUnit, distanceUnit);
            }
            return(bufferedShape);
        }
        protected override void RunCore(Dictionary <string, string> parameters)
        {
            bool parametersValid = parameterNames.All(name => parameters.ContainsKey(name));

            if (parametersValid)
            {
                double        distance     = 0;
                int           smoothness   = 0;
                BufferCapType capType      = BufferCapType.Butt;
                GeographyUnit mapUnit      = GeographyUnit.Unknown;
                DistanceUnit  distanceUnit = DistanceUnit.Feet;

                var featuresToBuffer = GetFeaturesToBuffer(parameters[parameterNames[0]]);
                double.TryParse(parameters[parameterNames[1]], out distance);
                int.TryParse(parameters[parameterNames[2]], out smoothness);
                Enum.TryParse <BufferCapType>(parameters[parameterNames[3]], out capType);
                Enum.TryParse <GeographyUnit>(parameters[parameterNames[4]], out mapUnit);
                Enum.TryParse <DistanceUnit>(parameters[parameterNames[5]], out distanceUnit);

                int bufferdFeaturesCount = 0;
                Collection <Feature> bufferedFeatures = new Collection <Feature>();
                foreach (Feature feature in featuresToBuffer)
                {
                    try
                    {
                        BaseShape         shape           = feature.GetShape();
                        MultipolygonShape bufferedShape   = shape.Buffer(distance, smoothness, capType, mapUnit, distanceUnit);
                        Feature           bufferedFeature = new Feature(bufferedShape.GetWellKnownBinary(), feature.Id, feature.ColumnValues);
                        bufferedFeature.Tag = feature.Tag;
                        bufferedFeatures.Add(bufferedFeature);
                    }
                    catch (Exception ex)
                    {
                        UpdatingProgressLongRunningTaskPluginEventArgs errorEventArgs = new UpdatingProgressLongRunningTaskPluginEventArgs(LongRunningTaskState.Error);
                        errorEventArgs.ExceptionInfo = new LongRunningTaskExceptionInfo(ex.Message, ex.StackTrace);
                        errorEventArgs.Message       = feature.Id;
                        OnUpdatingProgress(errorEventArgs);

                        continue;
                    }

                    Interlocked.Increment(ref bufferdFeaturesCount);
                    OnUpdatingProgress(new UpdatingProgressLongRunningTaskPluginEventArgs(LongRunningTaskState.Updating)
                    {
                        Current = bufferdFeaturesCount * 100 / featuresToBuffer.Count
                    });
                }

                OnUpdatingProgress(new UpdatingProgressLongRunningTaskPluginEventArgs(LongRunningTaskState.Updating)
                {
                    Message = "Creating File"
                });

                string outputPath = parameters[parameterNames[6]];
                string projection = parameters[parameterNames[7]];
                Output(bufferedFeatures, outputPath, projection);

                OnUpdatingProgress(new UpdatingProgressLongRunningTaskPluginEventArgs(LongRunningTaskState.Updating)
                {
                    Message = "Finished"
                });
            }
        }