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


C# XmlElement.GetBoolAttribute方法代碼示例

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


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

示例1: ImportMarkPrevNext

        static XshdRule ImportMarkPrevNext(XmlElement el, bool markFollowing)
        {
            bool markMarker = el.GetBoolAttribute("markmarker") ?? false;
            string what = Regex.Escape(el.InnerText);
            const string identifier = @"[\d\w_]+";
            const string whitespace = @"\s*";

            string regex;
            if (markFollowing) {
                if (markMarker) {
                    regex = what + whitespace + identifier;
                } else {
                    regex = "(?<=(" + what + whitespace + "))" + identifier;
                }
            } else {
                if (markMarker) {
                    regex = identifier + whitespace + what;
                } else {
                    regex = identifier + "(?=(" + whitespace + what + "))";
                }
            }
            return new XshdRule {
                ColorReference = GetColorReference(el),
                Regex = regex,
                RegexType = XshdRegexType.IgnorePatternWhitespace
            };
        }
開發者ID:chartly,項目名稱:flood,代碼行數:27,代碼來源:V1Loader.cs

示例2: ReadXml

        public void ReadXml(XmlElement element)
        {
            var bounds = element.ReadChildRectangleXml("bounds");
            if (bounds != null)
                this.Bounds = bounds.Value;
            else
            {
                var clientSize = element.ReadChildSizeXml("clientSize");
                if (clientSize != null)
                    this.ClientSize = clientSize.Value;
            }
            bool maximized = element.GetBoolAttribute("maximized") ?? false;
            if (maximized)
            {
                this.Maximize();
            }

            element.ReadChildXml("top", top);
        }
開發者ID:nerdfury,項目名稱:JabbR.Desktop,代碼行數:19,代碼來源:MainForm.cs

示例3: ImportSpan

        XshdSpan ImportSpan(XmlElement element)
        {
            XshdSpan span = new XshdSpan();
            if (element.HasAttribute("rule")) {
                span.RuleSetReference = new XshdReference<XshdRuleSet>(null, element.GetAttribute("rule"));
            }
            char escapeCharacter = ruleSetEscapeCharacter;
            if (element.HasAttribute("escapecharacter")) {
                escapeCharacter = element.GetAttribute("escapecharacter")[0];
            }
            span.Multiline = !(element.GetBoolAttribute("stopateol") ?? false);

            span.SpanColorReference = GetColorReference(element);

            span.BeginRegexType = XshdRegexType.IgnorePatternWhitespace;
            span.BeginRegex = ImportRegex(element["Begin"].InnerText,
                                          element["Begin"].GetBoolAttribute("singleword") ?? false,
                                          element["Begin"].GetBoolAttribute("startofline"));
            span.BeginColorReference = GetColorReference(element["Begin"]);

            string endElementText = string.Empty;
            if (element["End"] != null) {
                span.EndRegexType = XshdRegexType.IgnorePatternWhitespace;
                endElementText = element["End"].InnerText;
                span.EndRegex = ImportRegex(endElementText,
                                            element["End"].GetBoolAttribute("singleword") ?? false,
                                            null);
                span.EndColorReference = GetColorReference(element["End"]);
            }

            if (escapeCharacter != '\0') {
                XshdRuleSet ruleSet = new XshdRuleSet();
                if (endElementText.Length == 1 && endElementText[0] == escapeCharacter) {
                    // ""-style escape
                    ruleSet.Elements.Add(new XshdSpan {
                                         	BeginRegex = Regex.Escape(endElementText + endElementText),
                                         	EndRegex = ""
                                         });
                } else {
                    // \"-style escape
                    ruleSet.Elements.Add(new XshdSpan {
                                         	BeginRegex = Regex.Escape(escapeCharacter.ToString()),
                                         	EndRegex = "."
                                         });
                }
                if (span.RuleSetReference.ReferencedElement != null) {
                    ruleSet.Elements.Add(new XshdImport { RuleSetReference = span.RuleSetReference });
                }
                span.RuleSetReference = new XshdReference<XshdRuleSet>(ruleSet);
            }
            return span;
        }
開發者ID:Amichai,項目名稱:PhysicsPad,代碼行數:52,代碼來源:V1Loader.cs

示例4: ImportRuleSet

        XshdRuleSet ImportRuleSet(XmlElement element)
        {
            XshdRuleSet ruleSet = new XshdRuleSet();
            ruleSet.Name = element.GetAttributeOrNull("name");

            if (element.HasAttribute("escapecharacter")) {
                ruleSetEscapeCharacter = element.GetAttribute("escapecharacter")[0];
            } else {
                ruleSetEscapeCharacter = '\0';
            }

            if (element.HasAttribute("reference")) {
                ruleSet.Elements.Add(
                    new XshdImport { RuleSetReference = new XshdReference<XshdRuleSet>(
                        element.GetAttribute("reference"), string.Empty
                    ) });
            }
            ruleSet.IgnoreCase = element.GetBoolAttribute("ignorecase");

            foreach (XmlElement el in element.GetElementsByTagName("KeyWords")) {
                XshdKeywords keywords = new XshdKeywords();
                keywords.ColorReference = GetColorReference(el);
                // we have to handle old syntax highlighting definitions that contain
                // empty keywords or empty keyword groups
                foreach (XmlElement node in el.GetElementsByTagName("Key")) {
                    string word = node.GetAttribute("word");
                    if (!string.IsNullOrEmpty(word))
                        keywords.Words.Add(word);
                }
                if (keywords.Words.Count > 0) {
                    ruleSet.Elements.Add(keywords);
                }
            }

            foreach (XmlElement el in element.GetElementsByTagName("Span")) {
                ruleSet.Elements.Add(ImportSpan(el));
            }

            foreach (XmlElement el in element.GetElementsByTagName("MarkPrevious")) {
                ruleSet.Elements.Add(ImportMarkPrevNext(el, false));
            }
            foreach (XmlElement el in element.GetElementsByTagName("MarkFollowing")) {
                ruleSet.Elements.Add(ImportMarkPrevNext(el, true));
            }

            return ruleSet;
        }
開發者ID:Amichai,項目名稱:PhysicsPad,代碼行數:47,代碼來源:V1Loader.cs

示例5: ReadXml

		public virtual void ReadXml (XmlElement element)
		{
			this.Id = element.GetStringAttribute ("id") ?? Guid.NewGuid ().ToString ();
			this.Name = element.GetAttribute ("name");
			this.ConnectOnStartup = element.GetBoolAttribute ("connectOnStartup") ?? true;
		}
開發者ID:neiz,項目名稱:JabbR.Eto,代碼行數:6,代碼來源:Server.cs


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