예제 #1
0
        public static List <string> QueryFeatureClassName(IWorkspace pWorkspace, bool pUpperCase, bool pEscapeMetaTable)
        {
            IDatasetName  i;
            string        upper;
            string        classShortName;
            List <string> strs;

            try
            {
                string str = "";
                if (pWorkspace.Type == esriWorkspaceType.esriRemoteDatabaseWorkspace)
                {
                    str = pWorkspace.ConnectionProperties.GetProperty("user").ToString();
                    str = str.ToUpper();
                }
                List <string>    strs1        = new List <string>();
                IEnumDatasetName datasetNames = pWorkspace.DatasetNames[esriDatasetType.esriDTFeatureDataset];
                for (i = datasetNames.Next(); i != null; i = datasetNames.Next())
                {
                    upper = i.Name.ToUpper();
                    if (str.Equals(LayerHelper.GetClassOwnerName(upper)))
                    {
                        IEnumDatasetName subsetNames = i.SubsetNames;
                        for (i = subsetNames.Next(); i != null; i = subsetNames.Next())
                        {
                            upper = i.Name.ToUpper();
                            if (!(i is ITopologyName))
                            {
                                classShortName = LayerHelper.GetClassShortName(upper);
                                if (pUpperCase)
                                {
                                    classShortName = classShortName.ToUpper();
                                }
                                if (!pEscapeMetaTable)
                                {
                                    strs1.Add(classShortName);
                                }
                            }
                        }
                    }
                }
                datasetNames = pWorkspace.DatasetNames[esriDatasetType.esriDTFeatureClass];
                for (i = datasetNames.Next(); i != null; i = datasetNames.Next())
                {
                    upper = i.Name.ToUpper();
                    if (str.Equals(LayerHelper.GetClassOwnerName(upper)))
                    {
                        classShortName = LayerHelper.GetClassShortName(upper);
                        if (pUpperCase)
                        {
                            classShortName = classShortName.ToUpper();
                        }
                        if (!pEscapeMetaTable)
                        {
                            strs1.Add(classShortName);
                        }
                    }
                }
                strs = strs1;
            }
            catch (Exception exception)
            {
                strs = null;
            }
            return(strs);
        }