當前位置: 首頁>>代碼示例>>C#>>正文


C# XmlElement.GetNotEmptyChild方法代碼示例

本文整理匯總了C#中System.Xml.XmlElement.GetNotEmptyChild方法的典型用法代碼示例。如果您正苦於以下問題:C# XmlElement.GetNotEmptyChild方法的具體用法?C# XmlElement.GetNotEmptyChild怎麽用?C# XmlElement.GetNotEmptyChild使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在System.Xml.XmlElement的用法示例。


在下文中一共展示了XmlElement.GetNotEmptyChild方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: LoadAttachments

        private void LoadAttachments(XmlElement xml)
        {
            var root = xml.GetNotEmptyChild(SpawnItemAttachmentRootName);

            foreach (XmlElement elemType in root.GetChildElements())
            {
                string type = elemType.Name;
                if (AttachmentTypes.ContainsKey(type))
                    throw new LevelXmlException("\"{0}\" contains multiple \"{1}\" elements", SpawnItemAttachmentRootName, type);

                var attachmentNames = new Dictionary<string, string>();
                AttachmentTypes[type] = attachmentNames;
                foreach (var elemName in elemType.GetChildElements())
                {
                    string name = elemName.Name;
                    string imageFileName = null;

            #if LEVEL_EDITOR
                    if (attachmentNames.ContainsKey(name))
                        throw new LevelXmlException("Multiple \"{0}\" of type \"{1}\" have the same name \"{2}\"", SpawnItemAttachmentRootName, type, name);

                    imageFileName = elemName.GetStringAttribute("Image");
            #endif
                    attachmentNames.Add(name, imageFileName);
                }
            }
        }
開發者ID:DieselPuppet,項目名稱:DatingDash,代碼行數:27,代碼來源:SpawnItemConfig.cs

示例2: LoadTypes

        private void LoadTypes(XmlElement xml)
        {
            var root = xml.GetNotEmptyChild(SpawnItemRootName);
            foreach (XmlElement elemType in root.GetChildElements())
            {
                string type = elemType.Name;
                string imageFileName = null;

            #if LEVEL_EDITOR
                if (Types.ContainsKey(type))
                    throw new LevelXmlException("Multiple \"{0}\" have the same type \"{1}\"", SpawnItemRootName, type);

                imageFileName = elemType.GetStringAttribute("Image");
            #endif

                Types.Add(type, imageFileName);
            }
        }
開發者ID:DieselPuppet,項目名稱:DatingDash,代碼行數:18,代碼來源:SpawnItemConfig.cs

示例3: GetList

        private static string[] GetList(XmlElement xml, string rootName)
        {
            var listRoot = xml.GetNotEmptyChild(rootName);
            var childElements = listRoot.GetChildElements();
            var result = new string[childElements.Length];

            for (int i = 0; i < childElements.Length; i++)
            {
                string name = childElements[i].Name;

                if (result.Contains(name))
                    throw new LevelXmlException("\"{0}\" contained multiple times in {1} list.", name, rootName);

                result[i] = childElements[i].Name;
            }

            return result;
        }
開發者ID:DieselPuppet,項目名稱:DatingDash,代碼行數:18,代碼來源:TaskConfig.cs


注:本文中的System.Xml.XmlElement.GetNotEmptyChild方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。