Beispiel #1
0
        internal static bool ValidateChild(TextElement parent, TextElement child, bool throwIfIllegalChild, bool throwIfIllegalHyperlinkDescendent)
        {
            // Disallow nested hyperlink elements.
            if (TextSchema.HasHyperlinkAncestor(parent) &&
                TextSchema.HasIllegalHyperlinkDescendant(child, throwIfIllegalHyperlinkDescendent))
            {
                return(false);
            }

            bool isValidChild = IsValidChild(parent.GetType(), child.GetType());

            if (!isValidChild && throwIfIllegalChild)
            {
                throw new InvalidOperationException(SR.Get(SRID.TextSchema_ChildTypeIsInvalid, parent.GetType().Name, child.GetType().Name));
            }

            return(isValidChild);
        }
        // Token: 0x06003BE3 RID: 15331 RVA: 0x001140D8 File Offset: 0x001122D8
        internal static bool ValidateChild(TextElement parent, TextElement child, bool throwIfIllegalChild, bool throwIfIllegalHyperlinkDescendent)
        {
            if (TextSchema.HasHyperlinkAncestor(parent) && TextSchema.HasIllegalHyperlinkDescendant(child, throwIfIllegalHyperlinkDescendent))
            {
                return(false);
            }
            bool flag = TextSchema.IsValidChild(parent.GetType(), child.GetType());

            if (!flag && throwIfIllegalChild)
            {
                throw new InvalidOperationException(SR.Get("TextSchema_ChildTypeIsInvalid", new object[]
                {
                    parent.GetType().Name,
                    child.GetType().Name
                }));
            }
            return(flag);
        }