public object ESRI_Image_Update(ResultBuffer rb)
        {
            object result;

            try
            {
                if (null == Application.DocumentManager.MdiActiveDocument)
                {
                    result = null;
                }
                else
                {
                    string          argument = LspUtil.GetArgument(rb, 0, null);
                    MSCImageService mSCImageService;
                    if (!string.IsNullOrEmpty(argument))
                    {
                        mSCImageService = this.GetImageService(argument);
                    }
                    else
                    {
                        mSCImageService = AfaDocData.ActiveDocData.CurrentImageService;
                    }
                    if (mSCImageService == null)
                    {
                        result = null;
                    }
                    else
                    {
                        short   num         = short.Parse(mSCImageService.GetTransparency().ToString());
                        Point2d minPoint    = mSCImageService.ExportOptions.BoundingBox.MinPoint;
                        Point2d maxPoint    = mSCImageService.ExportOptions.BoundingBox.MaxPoint;
                        bool    assocParam  = LspUtil.GetAssocParam(rb, "DYNAMIC", mSCImageService.Dynamic);
                        bool    assocParam2 = LspUtil.GetAssocParam(rb, "VISIBLE", mSCImageService.GetVisibility());
                        short   assocParam3 = LspUtil.GetAssocParam(rb, "TRANSPARENCY", num);
                        Point2d assocParam4 = LspUtil.GetAssocParam(rb, "EXTMIN", minPoint);
                        Point2d assocParam5 = LspUtil.GetAssocParam(rb, "EXTMAX", maxPoint);
                        string  assocParam6 = LspUtil.GetAssocParam(rb, "FORMAT", mSCImageService.ExportOptions.Format);
                        string  text        = MSCPrj.ReadWKT(Application.DocumentManager.MdiActiveDocument);
                        if (mSCImageService != null)
                        {
                            mSCImageService.SetVisbility(assocParam2);
                            if (assocParam3 != num)
                            {
                                mSCImageService.SetTransparency((int)assocParam3);
                            }
                            if (assocParam != mSCImageService.Dynamic)
                            {
                                mSCImageService.Dynamic = assocParam;
                            }
                            mSCImageService.ExportOptions.Format    = assocParam6;
                            mSCImageService.ExportOptions.OutputWKT = text;
                            Extent extent = new Extent(assocParam4, assocParam5);
                            if (extent.IsValid())
                            {
                                extent.SetWKTFrom(text);
                                mSCImageService.UpdateExtentLimit(extent);
                            }
                            mSCImageService.Write();
                            mSCImageService.RefreshService();
                            Mouse.OverrideCursor = null;
                            result = true;
                        }
                        else
                        {
                            result = null;
                        }
                    }
                }
            }
            catch
            {
                result = null;
            }
            return(result);
        }
        public object ESRI_AddFeatureService(ResultBuffer rb)
        {
            if (null == Application.DocumentManager.MdiActiveDocument)
            {
                return(null);
            }
            string  assocParam  = LspUtil.GetAssocParam(rb, "URL", null);
            string  assocParam2 = LspUtil.GetAssocParam(rb, "EDITMODE", "EDIT");
            Point2d assocParam3 = LspUtil.GetAssocParam(rb, "EXTMIN", Point2d.Origin);
            Point2d assocParam4 = LspUtil.GetAssocParam(rb, "EXTMAX", Point2d.Origin);
            string  assocParam5 = LspUtil.GetAssocParam(rb, "LAYERIDS", "");
            bool    assocParam6 = LspUtil.GetAssocParam(rb, "EXTRACT", false);

            if (string.IsNullOrEmpty(assocParam))
            {
                return(null);
            }
            object result;

            try
            {
                Mouse.OverrideCursor = Cursors.Wait;
                string            text = MSCPrj.ReadWKT(Application.DocumentManager.MdiActiveDocument);
                AGSFeatureService aGSFeatureService = AGSFeatureService.BuildFeatureServiceFromURL(null, assocParam);
                if (aGSFeatureService != null)
                {
                    if (string.IsNullOrEmpty(text))
                    {
                        text = MSCPrj.AssignWKT(AfaDocData.ActiveDocData.Document, aGSFeatureService.GetWKT());
                    }
                    if (assocParam2 != "EDIT")
                    {
                        aGSFeatureService.ExportOptions.Dynamic = false;
                    }
                    Extent extent = new Extent(assocParam3, assocParam4);
                    aGSFeatureService.ExportOptions.OutputWKT = text;
                    if (extent.IsValid())
                    {
                        extent.SetWKTFrom(text);
                        aGSFeatureService.ExportOptions.BoundingBox = extent;
                    }
                    List <int> layerList = null;
                    bool       flag;
                    if (!string.IsNullOrEmpty(assocParam5))
                    {
                        string[] array = assocParam5.Split(new char[]
                        {
                            ','
                        });
                        int[] collection = Array.ConvertAll <string, int>(array, new Converter <string, int>(int.Parse));
                        layerList = new List <int>(collection);
                        if (assocParam6)
                        {
                            flag = aGSFeatureService.ExtractService(layerList);
                        }
                        else
                        {
                            flag = aGSFeatureService.AddService(layerList);
                        }
                    }
                    else if (assocParam6)
                    {
                        flag = aGSFeatureService.ExtractService(layerList);
                    }
                    else
                    {
                        flag = aGSFeatureService.AddService(layerList);
                    }
                    Mouse.OverrideCursor = null;
                    if (flag)
                    {
                        result = true;
                    }
                    else
                    {
                        result = false;
                    }
                }
                else
                {
                    Mouse.OverrideCursor = null;
                    result = null;
                }
            }
            catch
            {
                Mouse.OverrideCursor = null;
                result = null;
            }
            return(result);
        }
        public object ESRI_Image_Add(ResultBuffer rb)
        {
            object result;

            try
            {
                if (null == Application.DocumentManager.MdiActiveDocument)
                {
                    result = null;
                }
                else
                {
                    string  assocParam  = LspUtil.GetAssocParam(rb, "URL", null);
                    bool    assocParam2 = LspUtil.GetAssocParam(rb, "DYNAMIC", true);
                    bool    assocParam3 = LspUtil.GetAssocParam(rb, "VISIBLE", true);
                    short   num         = LspUtil.GetAssocParam(rb, "TRANSPARENCY", 0);
                    Point2d assocParam4 = LspUtil.GetAssocParam(rb, "EXTMIN", Point2d.Origin);
                    Point2d assocParam5 = LspUtil.GetAssocParam(rb, "EXTMAX", Point2d.Origin);
                    string  assocParam6 = LspUtil.GetAssocParam(rb, "FORMAT", "PNG24");
                    if (string.IsNullOrEmpty(assocParam))
                    {
                        result = null;
                    }
                    else
                    {
                        Mouse.OverrideCursor = Cursors.Wait;
                        AGSImageService aGSImageService = AGSImageService.BuildImageServiceFromURL(null, assocParam);
                        if (aGSImageService != null)
                        {
                            string text = MSCPrj.ReadWKT(Application.DocumentManager.MdiActiveDocument);
                            if (string.IsNullOrEmpty(text))
                            {
                                text = MSCPrj.AssignWKT(AfaDocData.ActiveDocData.Document, aGSImageService.GetWKT());
                            }
                            aGSImageService.ExportOptions.Dynamic = assocParam2;
                            aGSImageService.ExportOptions.Format  = assocParam6;
                            if (num == 100)
                            {
                                num = 99;
                            }
                            aGSImageService.ExportOptions.Transparency = byte.Parse(num.ToString());
                            Extent extent = new Extent(assocParam4, assocParam5);
                            if (extent.IsValid())
                            {
                                extent.SetWKTFrom(text);
                                aGSImageService.ExportOptions.BoundingBox = extent;
                            }
                            aGSImageService.ExportOptions.OutputWKT = text;
                            if (!aGSImageService.AddService(aGSImageService.ExportOptions))
                            {
                                Mouse.OverrideCursor = null;
                                result = null;
                            }
                            else
                            {
                                Mouse.OverrideCursor = null;
                                MSCImageService currentImageService = AfaDocData.ActiveDocData.CurrentImageService;
                                if (!assocParam3)
                                {
                                    currentImageService.Visible = false;
                                }
                                result = currentImageService.Name;
                            }
                        }
                        else
                        {
                            result = null;
                        }
                    }
                }
            }
            catch
            {
                result = null;
            }
            return(result);
        }
        public object ESRI_FeatureService_set(ResultBuffer rb)
        {
            object result;

            try
            {
                if (null == Application.DocumentManager.MdiActiveDocument)
                {
                    result = null;
                }
                else
                {
                    string            argument = LspUtil.GetArgument(rb, 0, null);
                    MSCFeatureService mSCFeatureService;
                    if (!string.IsNullOrEmpty(argument))
                    {
                        mSCFeatureService = this.GetFeatureService(argument);
                    }
                    else
                    {
                        mSCFeatureService = this.GetCurrentFeatureService();
                    }
                    if (mSCFeatureService == null)
                    {
                        result = null;
                    }
                    else
                    {
                        AGSExportOptions exportOptions = mSCFeatureService.ExportOptions;
                        bool             assocParam    = LspUtil.GetAssocParam(rb, "EDITMODE", exportOptions.Dynamic);
                        Point2d          assocParam2   = LspUtil.GetAssocParam(rb, "EXTMIN", exportOptions.BoundingBox.MinPoint);
                        Point2d          assocParam3   = LspUtil.GetAssocParam(rb, "EXTMAX", exportOptions.BoundingBox.MaxPoint);
                        string           text          = MSCPrj.ReadWKT(Application.DocumentManager.MdiActiveDocument);
                        if (mSCFeatureService != null)
                        {
                            if (assocParam)
                            {
                                mSCFeatureService.QueryOnly = false;
                                mSCFeatureService.SetLayerLock(false);
                            }
                            else
                            {
                                mSCFeatureService.QueryOnly = true;
                                mSCFeatureService.SetLayerLock(true);
                            }
                            mSCFeatureService.ExportOptions.Dynamic   = assocParam;
                            mSCFeatureService.ExportOptions.OutputWKT = text;
                            Extent extent = new Extent(assocParam2, assocParam3);
                            if (extent.IsValid())
                            {
                                extent.SetWKTFrom(text);
                                mSCFeatureService.UpdateExtentLimit(extent);
                            }
                            mSCFeatureService.Write();
                            Mouse.OverrideCursor = null;
                            result = true;
                        }
                        else
                        {
                            result = null;
                        }
                    }
                }
            }
            catch
            {
                result = null;
            }
            return(result);
        }