Пример #1
0
 public T FindModule <T>() where T : class
 {
     if (ModuleMap.TryGetValue(typeof(T).Name, out IModule module))
     {
         return(module as T);
     }
     return(default(T));
 }
Пример #2
0
 private ProtoCore.VHDL.AST.ModuleNode CreateModule(string componentName, bool isBuiltIn = false)
 {
     ModuleName = componentName;
     if (!ModuleMap.ContainsKey(ModuleName))
     {
         ModuleMap[ModuleName] = new AST.ModuleNode(ModuleName, isBuiltIn);
         return(ModuleMap[ModuleName]);
     }
     return(null);
 }
Пример #3
0
        public T AddModule <T>(/*params object[] list*/) where T : class, IModule, new()
        {
            T module = FindModule <T>();

            if (module == null)
            {
                module = new T();
                module.Init();
                ModuleMap.Add(typeof(T).Name, module);
            }
            return(module);
        }
Пример #4
0
        //自动匹配符号,递归调用
        private void AutoMatchRender(DevComponents.AdvTree.Node pNode, XmlDocument pXmldoc)
        {
            Exception eError = null;

            if (pNode == null)
            {
                return;
            }
            //获取xml节点名称
            string strtag      = pNode.Tag.ToString();
            string strNodeName = strtag;

            //如果是数据集节点,需处理一下,tag赋值后会有变动
            if (strtag.Contains("DataDIR"))
            {
                strNodeName = "DataDIR";
            }
            switch (strNodeName)
            {
            case "Root":
            case "DIR":
            case "DataDIR":
            {
                if (pNode.Nodes.Count > 0)
                {
                    for (int i = 0; i < pNode.Nodes.Count; i++)
                    {
                        DevComponents.AdvTree.Node pTmpnode = pNode.Nodes[i];
                        AutoMatchRender(pTmpnode, pXmldoc);
                    }
                    //string strNodeKey = pNode.Name;
                    //XmlNode pNewXmlNode = pXmldoc.SelectSingleNode("//" + strNodeName + "[@NodeKey='" + strNodeKey + "']");
                    //if (pNewXmlNode != null)
                    //{
                    //    pNode.DataKey = pNewXmlNode as object;
                    //}
                }
            }
            break;

            case "Layer":
            {
                //获取xml中对应节点
                ModuleMap.AutoMatchLayerConfig(_tmpWorkspace, pNode, pXmldoc, this.chkAutoMatchScale.Checked, this.chkAutoMatchRender.Checked, this.chkAutoMatchLabel.Checked, this.chkAutoMatchFilter.Checked);
            }
            break;
            }
        }
Пример #5
0
        /**
         * Reads all macros from all modules of the opened office file.
         * @return All the macros and their contents
         *
         * @since 3.15-beta2
         */
        public Dictionary <String, String> ReadMacros()
        {
            ModuleMap modules = new ModuleMap();

            FindMacros(fs.Root, modules);

            Dictionary <String, String> moduleSources = new Dictionary <String, String>();

            foreach (KeyValuePair <String, Module> entry in modules)
            {
                Module module = entry.Value;
                if (module.buf != null && module.buf.Length > 0)
                { // Skip empty modules
                    moduleSources.Add(entry.Key, ModuleMap.charset.GetString(module.buf));
                }
            }
            return(moduleSources);
        }
Пример #6
0
 /**
  * Recursively traverses directory structure rooted at <tt>dir</tt>.
  * For each macro module that is found, the module's name and code are
  * Added to <tt>modules</tt>.
  *
  * @param dir
  * @param modules
  * @throws IOException
  * @since 3.15-beta2
  */
 protected void FindMacros(DirectoryNode dir, ModuleMap modules)
 {
     if (VBA_PROJECT_POIFS.Equals(dir.Name, StringComparison.OrdinalIgnoreCase))
     {
         // VBA project directory, process
         ReadMacros(dir, modules);
     }
     else
     {
         // Check children
         foreach (Entry child in dir)
         {
             if (child is DirectoryNode)
             {
                 FindMacros((DirectoryNode)child, modules);
             }
         }
     }
 }
Пример #7
0
        /// <summary>
        /// A default module contains only the following:
        ///     1. Default library list (IEEE)
        ///     2. Default use module list (IEEE numeric)
        ///     3. Reset signal
        /// </summary>
        /// <param name="name"></param>
        /// <returns></returns>
        public ProtoCore.VHDL.AST.ModuleNode CreateAndAppendDefaultModule(string name, bool isBuiltIn = false)
        {
            ModuleName = name;
            Validity.Assert(!ModuleMap.ContainsKey(ModuleName));

            ProtoCore.VHDL.AST.ModuleNode module = new AST.ModuleNode(ModuleName, isBuiltIn);
            ModuleMap[ModuleName] = module;


            // Library list
            List <string> libaryNameList = new List <string>();

            libaryNameList.Add("IEEE");
            module.LibraryList = ProtoCore.VHDL.Utils.GenerateLibraryNodeList(libaryNameList);

            // Module list
            List <string> moduleNameList = new List <string>();

            moduleNameList.Add("IEEE.STD_LOGIC_1164.ALL");
            moduleNameList.Add("IEEE.NUMERIC_STD.ALL");
            module.UseNodeList = ProtoCore.VHDL.Utils.GenerateUseNodeList(moduleNameList);

            return(module);
        }
Пример #8
0
        /**
         * Reads VBA Project modules from a VBA Project directory located at
         * <tt>macroDir</tt> into <tt>modules</tt>.
         *
         * @since 3.15-beta2
         */
        protected void ReadMacros(DirectoryNode macroDir, ModuleMap modules)
        {
            foreach (Entry entry in macroDir)
            {
                if (!(entry is DocumentNode))
                {
                    continue;
                }

                String              name     = entry.Name;
                DocumentNode        document = (DocumentNode)entry;
                DocumentInputStream dis      = new DocumentInputStream(document);
                try
                {
                    if ("dir".Equals(name, StringComparison.OrdinalIgnoreCase))
                    {
                        // process DIR
                        RLEDecompressingInputStream in1 = new RLEDecompressingInputStream(dis);
                        String streamName = null;
                        int    recordId   = 0;
                        try
                        {
                            while (true)
                            {
                                recordId = in1.ReadShort();
                                if (EOF == recordId ||
                                    VERSION_INDEPENDENT_TERMINATOR == recordId)
                                {
                                    break;
                                }
                                int recordLength = in1.ReadInt();
                                switch (recordId)
                                {
                                case PROJECTVERSION:
                                    TrySkip(in1, 6);
                                    break;

                                case PROJECTCODEPAGE:
                                    int codepage = in1.ReadShort();
                                    ModuleMap.charset = Encoding.GetEncoding(codepage);     //Charset.ForName("Cp" + codepage);
                                    break;

                                case STREAMNAME:
                                    streamName = ReadString(in1, recordLength, ModuleMap.charset);
                                    break;

                                case MODULEOFFSET:
                                    ReadModule(in1, streamName, modules);
                                    break;

                                default:
                                    TrySkip(in1, recordLength);
                                    break;
                                }
                            }
                        }
                        catch (IOException e)
                        {
                            throw new IOException(
                                      "Error occurred while Reading macros at section id "
                                      + recordId + " (" + HexDump.ShortToHex(recordId) + ")", e);
                        }
                        finally
                        {
                            in1.Close();
                        }
                    }
                    else if (!name.StartsWith("__SRP", StringComparison.OrdinalIgnoreCase) &&
                             !name.StartsWith("_VBA_PROJECT", StringComparison.OrdinalIgnoreCase))
                    {
                        // process module, skip __SRP and _VBA_PROJECT since these do not contain macros
                        ReadModule(dis, name, modules);
                    }
                }
                finally
                {
                    dis.Close();
                }
            }
        }
Пример #9
0
        /**
         * Reads module from DIR node in input stream and Adds it to the modules map for decompression later
         * on the second pass through this function, the module will be decompressed
         *
         * Side-effects: Adds a new module to the module map or Sets the buf field on the module
         * to the decompressed stream contents (the VBA code for one module)
         *
         * @param in the Run-length encoded input stream to read from
         * @param streamName the stream name of the module
         * @param modules a map to store the modules
         * @throws IOException
         */
        private static void ReadModule(RLEDecompressingInputStream in1, String streamName, ModuleMap modules)
        {
            int    moduleOffset = in1.ReadInt();
            Module module       = modules.Get(streamName);

            if (module == null)
            {
                // First time we've seen the module. Add it to the ModuleMap and decompress it later
                module        = new Module();
                module.offset = moduleOffset;
                modules.Put(streamName, module);
                // Would Adding module.Read(in1) here be correct?
            }
            else
            {
                // Decompress a previously found module and store the decompressed result into module.buf
                InputStream stream = new RLEDecompressingInputStream(
                    new MemoryStream(module.buf, moduleOffset, module.buf.Length - moduleOffset)
                    );
                module.Read(stream);
                stream.Close();
            }
        }
Пример #10
0
        private static void ValidateCsProjFiles(string rmPath)
        {
            var projectFolders     = GetProjectFolderPaths(rmPath, true);
            var desktopFilePaths   = GetDesktopFilePaths(projectFolders);
            var desktopDefinitions = GetDesktopDefinitions(desktopFilePaths);

            foreach (var desktopDefinition in desktopDefinitions)
            {
                var netCorePath     = ConvertDesktopToNetCorePath(desktopDefinition.FilePath);
                var desktopFileName = Path.GetFileNameWithoutExtension(desktopDefinition.FilePath);
                var moduleName      = desktopFileName.Replace("Commands.", String.Empty);
                var netCoreFileName = Path.GetFileNameWithoutExtension(netCorePath);
                if (!File.Exists(netCorePath) || ModuleSkipList.Contains(moduleName))
                {
                    var priorColor = Console.ForegroundColor;
                    Console.ForegroundColor = ConsoleColor.Yellow;
                    Console.WriteLine($"Skipping {netCoreFileName}");
                    Console.ForegroundColor = priorColor;
                    continue;
                }

                Console.WriteLine($"Validating {netCoreFileName}");
                var oldReferences          = desktopDefinition.ItemGroups.Where(ig => ig.References?.Any() ?? false).SelectMany(ig => ig.References).ToArray();
                var managementPackageNames = ModuleMap.ContainsKey(moduleName) ? ModuleMap[moduleName] : new List <string> {
                    $"Management.{moduleName}"
                };
                foreach (var managementPackageName in managementPackageNames)
                {
                    var oldManagementReference = oldReferences.FirstOrDefault(r => (r?.Include?.Contains(managementPackageName) ?? false) || (r?.HintPath?.Contains(managementPackageName) ?? false));
                    if (oldManagementReference == null)
                    {
                        var priorColor = Console.ForegroundColor;
                        Console.ForegroundColor = ConsoleColor.Red;
                        Console.WriteLine($"{desktopFileName}: Could not locate management library containing {managementPackageName}");
                        Console.ForegroundColor = priorColor;
                        Environment.ExitCode    = 1;
                        continue;
                    }

                    var serializer = new XmlSerializer(typeof(NewProjectDefinition));
                    NewProjectDefinition netCoreDefinition;
                    using (var fileStream = new FileStream(netCorePath, FileMode.Open))
                    {
                        netCoreDefinition = (NewProjectDefinition)serializer.Deserialize(fileStream);
                    }

                    var newPackageReferences   = netCoreDefinition.ItemGroups.Where(ig => ig.PackageReferences?.Any() ?? false).SelectMany(ig => ig.PackageReferences);
                    var newManagementReference = newPackageReferences.FirstOrDefault(r => r?.Include?.Contains(managementPackageName) ?? false);
                    if (newManagementReference == null)
                    {
                        var priorColor = Console.ForegroundColor;
                        Console.ForegroundColor = ConsoleColor.Red;
                        Console.WriteLine($"{netCoreFileName}: Could not locate management library containing {managementPackageName}");
                        Console.ForegroundColor = priorColor;
                        Environment.ExitCode    = 1;
                        continue;
                    }

                    var oldVersionString = GetVersionString(oldManagementReference);
                    var oldVersion       = StringToVersion(oldVersionString);
                    var newVersionString = newManagementReference.Version;
                    var newVersion       = StringToVersion(newVersionString);
                    // ReSharper disable once InvertIf
                    if (oldVersion > newVersion)
                    {
                        var priorColor = Console.ForegroundColor;
                        Console.ForegroundColor = ConsoleColor.Red;
                        Console.WriteLine($"Version mismatch: {oldVersionString} > {newVersionString} : {managementPackageName}");
                        Console.ForegroundColor = priorColor;
                        Environment.ExitCode    = 1;
                    }
                }
            }
        }
Пример #11
0
	private void RebuildEditorMap(){
		if (editorMap == null) {
			editorMap = new List<ModuleMap> ();
		}
		editorMap.RemoveAll(x=>x.editor== null);
		Type[] types = GetSubTypes (typeof(ModuleEditor));
		for (int i=0; i<types.Length; i++) {
			Type type=types[i];
			object[] attributes=type.GetCustomAttributes(true);
			for (int j = 0; j < attributes.Length; j++)
			{
				CustomModuleAttribute moduleAttribute = attributes[j] as CustomModuleAttribute;

				if (moduleAttribute != null && editorMap.Find(x=>x.editor.GetType() == type)== null )
				{
					ModuleMap map = new ModuleMap();
					map.menu=moduleAttribute.MenuItem;
					map.editor=(ModuleEditor)ScriptableObject.CreateInstance(type);
					map.editor.hideFlags=HideFlags.HideAndDontSave;
					editorMap.Add(map);
				}
			}
		}
	}
Пример #12
0
        //为xml节点赋数据源,递归调用
        private bool SetAttriOfXmlnode(DevComponents.AdvTree.Node pNode, XmlDocument pXmldoc)
        {
            //判断参数是否有效
            if (pNode == null)
            {
                return(false);
            }
            string strTag      = pNode.Tag.ToString();
            string strNodeName = strTag;

            if (strNodeName.Contains("DataDIR"))
            {
                strNodeName = "DataDIR";
            }
            switch (strNodeName)
            {
            case "Root":
            case "DIR":
            case "DataDIR":

                if (pNode.Nodes.Count > 0)
                {
                    for (int i = 0; i < pNode.Nodes.Count; i++)
                    {
                        DevComponents.AdvTree.Node pTmpNode = pNode.Nodes[i];
                        SetAttriOfXmlnode(pTmpNode, pXmldoc);
                    }
                    //string strNodeKey = pNode.Name;
                    //XmlNode pNewXmlNode = pXmldoc.SelectSingleNode("//" + strNodeName + "[@NodeKey='" + strNodeKey + "']");
                    //if (pNewXmlNode != null)
                    //{
                    //    pNode.DataKey = pNewXmlNode as object;
                    //}
                }

                break;

            case "Layer":
                try
                {
                    string  strSearch = "//" + strNodeName + "[@NodeKey='" + pNode.Name + "']";
                    XmlNode pXmlnode  = pXmldoc.SelectSingleNode(strSearch);
                    if (pXmlnode == null)
                    {
                        return(false);
                    }
                    if (!(pXmlnode is XmlElement))
                    {
                        return(false);
                    }
                    XmlElement pNodeEle = pXmlnode as XmlElement;
                    if (chkLoad.Checked)
                    {
                        pNodeEle.SetAttribute("Load", "1");
                    }
                    else
                    {
                        pNodeEle.SetAttribute("Load", "0");
                    }
                    if (chkView.Checked)
                    {
                        pNodeEle.SetAttribute("View", "1");
                    }
                    else
                    {
                        pNodeEle.SetAttribute("View", "0");
                    }
                    string  strDataType = pNodeEle.GetAttribute("DataType");
                    XmlNode nodeShow    = pXmlnode["AboutShow"];
                    //为AboutShow节点写属性
                    XmlElement eleShow = nodeShow as XmlElement;
                    if (nodeShow == null)
                    {
                        eleShow  = pXmldoc.CreateElement("AboutShow");
                        nodeShow = pXmlnode.AppendChild(eleShow as XmlNode);
                    }
                    if (eleShow != null)
                    {
                        if (strDataType.ToUpper().Equals("FC"))
                        {
                            eleShow.SetAttribute("IsEdit", chkEdit.Checked.ToString());
                            eleShow.SetAttribute("IsQuery", chkQuery.Checked.ToString());
                            eleShow.SetAttribute("IsSelect", chkSelected.Checked.ToString());
                        }
                        if (checkBoxMaxScale.Checked)
                        {
                            eleShow.SetAttribute("MaxScale", this.txtMaxScale.Text);
                        }
                        if (checkBoxMinScale.Checked)
                        {
                            eleShow.SetAttribute("MinScale", this.txtMinScale.Text);
                        }
                    }
                    //added by chulili 20110630 非常重要,只有这样关联上,图层节点才能在视图浏览中正确显示
                    //pNode.DataKey = pXmlnode as object;
                    ModuleMap.SetDataKey(pNode, pXmlnode);
                }
                catch (Exception e)
                {
                    string strinfo = e.Message;
                }
                break;
            }
            return(true);
        }
Пример #13
0
 /// <summary>
 /// Initializes a new instance of the <see cref="WebModuleBase"/> class.
 /// </summary>
 protected WebModuleBase()
 {
     Handlers = new ModuleMap();
 }
Пример #14
0
 /// <summary>
 /// Initializes a new instance of the <see cref="WebModuleBase"/> class.
 /// </summary>
 protected WebModuleBase()
 {
     Handlers = new ModuleMap();
 }
Пример #15
0
        private void comboBoxDataSource_SelectedIndexChanged(object sender, EventArgs e)
        {
            //cyf 20110613 add
            //this.comboBoxFeaClass.Items.Clear();
            //end
            SysGisTable sysTable = new SysGisTable(_tmpWorkspace);
            Exception   eError;
            //根据用户选择的数据源,得到数据源的工作空间
            string DataSourceName = this.comboBoxDataSource.Text;
            string conninfostr    = sysTable.GetFieldValue("DATABASEMD", "CONNECTIONINFO", "DATABASENAME='" + DataSourceName + "'", out eError).ToString();
            int    type           = int.Parse(sysTable.GetFieldValue("DATABASEMD", "DATAFORMATID", "DATABASENAME='" + DataSourceName + "'", out eError).ToString());
            string strDBPara      = sysTable.GetFieldValue("DATABASEMD", "DBPARA", "DATABASENAME='" + DataSourceName + "'", out eError).ToString();
            int    index6         = conninfostr.LastIndexOf("|");
            //string strdataset = conninfostr.Substring(index6 + 1);

            IWorkspace pWorkspace = ModuleMap.GetWorkSpacefromConninfo(conninfostr, type);

            if (pWorkspace == null)
            {
                return;
            }
            _ListDataset.Clear();
            _ListTypeOfDataset.Clear();
            string strDatasets = conninfostr.Substring(index6 + 1);

            string[]          strTemp       = strDatasets.Split(new char[] { ',' });
            IFeatureWorkspace pFeaWorkSpace = pWorkspace as IFeatureWorkspace;

            if (pFeaWorkSpace != null)
            {
                for (int k = 0; k < strTemp.Length; k++)
                {
                    IDataset pTmpdataset = null;
                    if (strDBPara.Contains("栅格数据集"))
                    {
                        IRasterWorkspaceEx rasterWorkspace = (IRasterWorkspaceEx)pFeaWorkSpace;
                        IRasterDataset     pRDataset       = rasterWorkspace.OpenRasterDataset(strTemp[k]);
                        pTmpdataset = pRDataset as IDataset;
                        if (pTmpdataset != null)
                        {
                            _ListTypeOfDataset.Add("RD");
                        }
                    }
                    else if (strDBPara.Contains("栅格编目"))
                    {
                        IRasterWorkspaceEx rasterWorkspace = (IRasterWorkspaceEx)pFeaWorkSpace;
                        IRasterCatalog     pRCatalog       = rasterWorkspace.OpenRasterCatalog(strTemp[k]);
                        pTmpdataset = pRCatalog as IDataset;
                        if (pTmpdataset != null)
                        {
                            _ListTypeOfDataset.Add("RC");
                        }
                    }
                    else
                    {
                        pTmpdataset = pFeaWorkSpace.OpenFeatureDataset(strTemp[k]) as IDataset;
                        if (pTmpdataset != null)
                        {
                            _ListTypeOfDataset.Add("FC");
                        }
                    }
                    if (pTmpdataset != null)
                    {
                        _ListDataset.Add(pTmpdataset);
                    }
                }
            }
            _dataWorkspace = pWorkspace;

            if (pWorkspace == null)
            {
                return;
            }
        }
Пример #16
0
        //为xml节点赋数据源,递归调用
        private bool SetDbsourceOfXmlnode(DevComponents.AdvTree.Node pNode, XmlDocument pXmldoc, string strDbsource, IWorkspace pWorkspace, List <IDataset> pListDataset, List <string> pListTypeOfDataset)
        {
            //判断参数是否有效
            if (pNode == null)
            {
                return(false);
            }
            if (strDbsource.Equals(""))
            {
                return(false);
            }
            if (pWorkspace == null)
            {
                return(false);
            }
            string strTag      = pNode.Tag.ToString();
            string strNodeName = strTag;

            if (strNodeName.Contains("DataDIR"))
            {
                strNodeName = "DataDIR";
            }
            switch (strNodeName)
            {
            case "Root":
            case "DIR":
            case "DataDIR":
                if (pNode.Nodes.Count > 0)
                {
                    for (int i = 0; i < pNode.Nodes.Count; i++)
                    {
                        DevComponents.AdvTree.Node pTmpNode = pNode.Nodes[i];
                        SetDbsourceOfXmlnode(pTmpNode, pXmldoc, strDbsource, pWorkspace, pListDataset, pListTypeOfDataset);
                    }
                    //string strNodeKey = pNode.Name;
                    //XmlNode pNewXmlNode = pXmldoc.SelectSingleNode("//" + strNodeName + "[@NodeKey='" + strNodeKey + "']");
                    //if (pNewXmlNode != null)
                    //{
                    //    pNode.DataKey = pNewXmlNode as object;
                    //}
                }
                break;

            case "Layer":
                try
                {
                    bool    tag       = false;
                    string  strSearch = "//" + strNodeName + "[@NodeKey='" + pNode.Name + "']";
                    XmlNode pXmlnode  = pXmldoc.SelectSingleNode(strSearch);
                    if (pXmlnode == null)
                    {
                        return(false);
                    }
                    if (!(pXmlnode is XmlElement))
                    {
                        return(false);
                    }
                    XmlElement pNodeEle = pXmlnode as XmlElement;
                    //为节点设置数据源,后续还应添加数据集(数据集根据数据源、地物类名称得到)
                    //added by chulili 20110725 从数据源获取地物类,得到地物类所在数据集
                    string            strFeaClsName = pNodeEle.Attributes["Code"].Value.ToString();
                    string            strDataType   = pNodeEle.Attributes["DataType"].Value.ToString();
                    IFeatureWorkspace pFeaWks       = pWorkspace as IFeatureWorkspace;
                    if (pFeaWks != null)
                    {
                        //IFeatureClass pFeaCls = pFeaWks.OpenFeatureClass(strFeaClsName);
                        //if (pFeaCls != null)
                        //{
                        //    IFeatureDataset pDataSet = pFeaCls.FeatureDataset;
                        //    if (pDataSet != null)
                        //    {
                        //        pNodeEle.SetAttribute("FeatureDatasetName", pDataSet.Name);
                        //    }
                        //    else
                        //    {
                        //        pNodeEle.SetAttribute("FeatureDatasetName", "");
                        //    }
                        //}
                        //else//直接根据名称获取不到
                        //{
                        string TrueFeaClsName = strFeaClsName.Substring(strFeaClsName.IndexOf(".") + 1);

                        if (pListDataset != null)
                        {
                            if (strDataType.Equals("FC"))
                            {
                                for (int i = 0; i < pListDataset.Count; i++)        //循环地物类集合
                                {
                                    if (tag)
                                    {
                                        break;          //如果已经匹配上,跳出循环
                                    }
                                    if (pListTypeOfDataset[i].Equals("FC"))
                                    {
                                        IDataset     pDataset     = pListDataset[i];
                                        IEnumDataset pEnumDataset = pDataset.Subsets;
                                        IDataset     ptmpDataset  = pEnumDataset.Next();
                                        while (ptmpDataset != null)         //循环集合中的地物类
                                        {
                                            string pFeaClsName = ptmpDataset.Name;
                                            if (pFeaClsName.Equals(strFeaClsName))          //先对整个地物类名称进行匹配
                                            {
                                                pNodeEle.SetAttribute("FeatureDatasetName", pDataset.Name);
                                                pNodeEle.SetAttribute("Code", ptmpDataset.Name);
                                                tag = true;
                                                break;
                                            }
                                            ptmpDataset = pEnumDataset.Next();
                                        }
                                    }
                                }
                                if (!tag)
                                {
                                    for (int i = 0; i < pListDataset.Count; i++)        //循环地物类集合
                                    {
                                        if (tag)
                                        {
                                            break;          //如果已经匹配上,跳出循环
                                        }
                                        if (pListTypeOfDataset[i].Equals("FC"))
                                        {
                                            IDataset     pDataset     = pListDataset[i];
                                            IEnumDataset pEnumDataset = pDataset.Subsets;
                                            IDataset     ptmpDataset  = pEnumDataset.Next();
                                            while (ptmpDataset != null)         //循环集合中的地物类
                                            {
                                                string pFeaClsName = ptmpDataset.Name;
                                                if (pFeaClsName.Substring(pFeaClsName.IndexOf(".") + 1) == TrueFeaClsName)         //再去掉用户名进行匹配
                                                {
                                                    pNodeEle.SetAttribute("FeatureDatasetName", pDataset.Name);
                                                    pNodeEle.SetAttribute("Code", ptmpDataset.Name);
                                                    tag = true;
                                                    break;
                                                }
                                                ptmpDataset = pEnumDataset.Next();
                                            }
                                        }
                                    }
                                }
                            }
                            else if (strDataType.Equals("RC") || strDataType.Equals("RD"))
                            {
                                for (int i = 0; i < pListDataset.Count; i++)        //循环地物类集合
                                {
                                    if (tag)
                                    {
                                        break;          //如果已经匹配上,跳出循环
                                    }
                                    if (pListTypeOfDataset[i].Equals("RC") || pListTypeOfDataset[i].Equals("RD"))
                                    {
                                        IDataset pDataset = pListDataset[i];
                                        if (pDataset != null)         //循环集合中的地物类
                                        {
                                            string RCname = pDataset.Name;
                                            if (RCname.Equals(strFeaClsName))          //先对整个地物类名称进行匹配
                                            {
                                                pNodeEle.SetAttribute("FeatureDatasetName", pDataset.Name);
                                                pNodeEle.SetAttribute("Code", pDataset.Name);
                                                pNodeEle.SetAttribute("DataType", pListTypeOfDataset[i]);
                                                tag = true;
                                                break;
                                            }
                                        }
                                    }
                                }
                                if (!tag)
                                {
                                    for (int i = 0; i < pListDataset.Count; i++)        //循环地物类集合
                                    {
                                        if (tag)
                                        {
                                            break;          //如果已经匹配上,跳出循环
                                        }
                                        if (pListTypeOfDataset[i].Equals("FC") || pListTypeOfDataset[i].Equals("RD"))
                                        {
                                            IDataset pDataset = pListDataset[i];
                                            if (pDataset != null)         //循环集合中的地物类
                                            {
                                                string pFeaClsName = pDataset.Name;
                                                if (pFeaClsName.Substring(pFeaClsName.IndexOf(".") + 1) == TrueFeaClsName)         //再去掉用户名进行匹配
                                                {
                                                    pNodeEle.SetAttribute("FeatureDatasetName", pDataset.Name);
                                                    pNodeEle.SetAttribute("Code", pDataset.Name);
                                                    pNodeEle.SetAttribute("DataType", pListTypeOfDataset[i]);
                                                    tag = true;
                                                    break;
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                        //}
                    }
                    //end added by chulili
                    if (tag)
                    {
                        pNodeEle.SetAttribute("ConnectKey", strDbsource);
                    }
                    //added by chulili 20110630 非常重要,只有这样关联上,图层节点才能在视图浏览中正确显示
                    //pNode.DataKey = pXmlnode as object;
                    ModuleMap.SetDataKey(pNode, pXmlnode);
                }
                catch (Exception e)
                {
                    string strinfo = e.Message;
                }
                break;
            }
            return(true);
        }