当前位置: 首页>>代码示例>>C#>>正文


C# ESRI.Replace方法代码示例

本文整理汇总了C#中ESRI.Replace方法的典型用法代码示例。如果您正苦于以下问题:C# ESRI.Replace方法的具体用法?C# ESRI.Replace怎么用?C# ESRI.Replace使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ESRI的用法示例。


在下文中一共展示了ESRI.Replace方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: UpdateMessages

        public void UpdateMessages(ESRI.ArcGIS.esriSystem.IArray paramvalues, ESRI.ArcGIS.Geoprocessing.IGPEnvironmentManager pEnvMgr, ESRI.ArcGIS.Geodatabase.IGPMessages Messages)
        {
            IGPUtilities3 gpUtilities3 = new GPUtilitiesClass();

            // check for a valid download url
            IGPParameter uploadURLParameter = paramvalues.get_Element(in_uploadURLNumber) as IGPParameter;
            IGPString uploadURLGPString = uploadURLParameter.Value as IGPString;

            if (uploadURLGPString == null)
            {
                Messages.ReplaceError(in_uploadURLNumber, -198, String.Format(resourceManager.GetString("GPTools_NullPointerParameterType"), uploadURLParameter.Value.GetAsText()));
            }
            else
            {
                try
                {
                    if (uploadURLParameter.HasBeenValidated == false)
                    {
                        Uri downloadURI = new Uri(uploadURLGPString.Value);

                        // check base url
                        api osmAPICapabilities = OSMGPDownload.CheckValidServerURL(uploadURLGPString.Value);

                        // if we can construct a valid URI  class then we are accepting the value and store it in the user settings as well
                        if (m_editorConfigurationSettings != null)
                        {
                            if (m_editorConfigurationSettings.ContainsKey("osmbaseurl"))
                            {
                                m_editorConfigurationSettings["osmbaseurl"] = uploadURLGPString.Value;
                            }
                            else
                            {
                                m_editorConfigurationSettings.Add("osmbaseurl", uploadURLGPString.Value);
                            }

                            OSMGPFactory.StoreOSMEditorSettings(m_editorConfigurationSettings);
                        }
                    }
                }
                catch (Exception ex)
                {
                    StringBuilder errorMessage = new StringBuilder();
                    errorMessage.AppendLine(resourceManager.GetString("GPTools_OSMGPUpload_invaliduploadurl"));
                    errorMessage.AppendLine(ex.Message);
                    Messages.ReplaceError(in_uploadURLNumber, -3, errorMessage.ToString());
                }
            }

            IGPParameter revisionTableParameter = paramvalues.get_Element(in_changesTablesNumber) as IGPParameter;
            IGPValue revisionTableGPValue = gpUtilities3.UnpackGPValue(revisionTableParameter);

            if (revisionTableGPValue.IsEmpty())
                return;

            ITable revisionTable = null;
            IQueryFilter revisionTableQueryFilter = null;

            try
            {
                using (ComReleaser comReleaser = new ComReleaser())
                {
                    gpUtilities3.DecodeTableView(revisionTableGPValue, out revisionTable, out revisionTableQueryFilter);
                    comReleaser.ManageLifetime(revisionTable);

                    if (revisionTable is IFeatureClass)
                    {
                        Messages.ReplaceError(in_changesTablesNumber, -4, resourceManager.GetString("GPTools_OSMGPUpload_notarevisiontable"));
                        return;
                    }

                    IDatasetEdit datasetEdit = revisionTable as IDatasetEdit;
                    comReleaser.ManageLifetime(datasetEdit);

                    if (datasetEdit == null)
                    {
                        return;
                    }

                    if (datasetEdit.IsBeingEdited())
                    {
                        Messages.ReplaceError(in_changesTablesNumber, -4, resourceManager.GetString("GPTools_OSMGPUpload_inputnotvalidduringedit"));
                    }
                }

                gpUtilities3.ReleaseInternals();
            }
            catch
            {
                // check if we are dealing with a variable -- if we do then leave this string alone
                string tableName = revisionTableGPValue.GetAsText();
                string tableNameModified = tableName.Replace("%", String.Empty);

                if (((tableName.Length - tableNameModified.Length) % 2) == 0)
                {
                    Messages.Replace(in_changesTablesNumber, new GPMessageClass());
                }
            }
        }
开发者ID:weepingdog,项目名称:arcgis-osm-editor,代码行数:98,代码来源:OSMGPUpload.cs

示例2: UpdateMessages

        public void UpdateMessages(ESRI.ArcGIS.esriSystem.IArray paramvalues, ESRI.ArcGIS.Geoprocessing.IGPEnvironmentManager pEnvMgr, ESRI.ArcGIS.Geodatabase.IGPMessages Messages)
        {
            IGPUtilities3 gpUtilities3 = new GPUtilitiesClass();

            for (int i = 0; i < Messages.Count; i++)
            {
                IGPMessage blah = Messages.GetMessage(i);
                if (blah.IsError())
                {
                    IGPMessage something = new GPMessageClass();
                    something.Description = String.Empty;
                    something.Type = esriGPMessageType.esriGPMessageTypeInformative;
                    something.ErrorCode = 0;
                    Messages.Replace(i, something);
                }
            }

            IGPParameter inputOSMParameter = paramvalues.get_Element(in_osmFeatureClassNumber) as IGPParameter;
            IGPValue inputOSMGPValue = gpUtilities3.UnpackGPValue(inputOSMParameter);

            if (inputOSMGPValue.IsEmpty() == false)
            {
                IFeatureClass osmFeatureClass = null;
                ITable osmInputTable = null;
                IQueryFilter osmQueryFilter = null;

                try
                {
                    gpUtilities3.DecodeFeatureLayer(inputOSMGPValue, out osmFeatureClass, out osmQueryFilter);
                    osmInputTable = osmFeatureClass as ITable;
                }
                catch { }

                try
                {
                    if (osmInputTable == null)
                    {
                        gpUtilities3.DecodeTableView(inputOSMGPValue, out osmInputTable, out osmQueryFilter);
                    }
                }
                catch { }

                if (osmInputTable == null)
                {
                    return;
                }

                // find the field that holds tag binary/xml field
                int osmTagCollectionFieldIndex = osmInputTable.FindField("osmTags");

                if (osmTagCollectionFieldIndex == -1)
                {
                    Messages.ReplaceAbort(in_osmFeatureClassNumber, resourceManager.GetString("GPTools_OSMGPCombineAttributes_inputlayer_missingtagfield"));
                    return;
                }
            }
        }
开发者ID:weepingdog,项目名称:arcgis-osm-editor,代码行数:57,代码来源:OSMGPCombineAttributes.cs


注:本文中的ESRI.Replace方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。