internal static bool ValidateChild(TextElement parent, Type childType, bool throwIfIllegalChild, bool throwIfIllegalHyperlinkDescendent) { // Disallow nested hyperlink elements. if (TextSchema.HasHyperlinkAncestor(parent)) { if (typeof(Hyperlink).IsAssignableFrom(childType) || typeof(AnchoredBlock).IsAssignableFrom(childType)) { if (throwIfIllegalHyperlinkDescendent) { throw new InvalidOperationException(SR.Get(SRID.TextSchema_IllegalHyperlinkChild, childType)); } return(false); } } bool isValidChild = IsValidChild(parent.GetType(), childType); if (!isValidChild && throwIfIllegalChild) { throw new InvalidOperationException(SR.Get(SRID.TextSchema_ChildTypeIsInvalid, parent.GetType().Name, childType.Name)); } return(isValidChild); }
// Token: 0x06003BE5 RID: 15333 RVA: 0x00114150 File Offset: 0x00112350 internal static bool ValidateChild(TextElement parent, Type childType, bool throwIfIllegalChild, bool throwIfIllegalHyperlinkDescendent) { if (TextSchema.HasHyperlinkAncestor(parent) && (typeof(Hyperlink).IsAssignableFrom(childType) || typeof(AnchoredBlock).IsAssignableFrom(childType))) { if (throwIfIllegalHyperlinkDescendent) { throw new InvalidOperationException(SR.Get("TextSchema_IllegalHyperlinkChild", new object[] { childType })); } return(false); } else { bool flag = TextSchema.IsValidChild(parent.GetType(), childType); if (!flag && throwIfIllegalChild) { throw new InvalidOperationException(SR.Get("TextSchema_ChildTypeIsInvalid", new object[] { parent.GetType().Name, childType.Name })); } return(flag); } }
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); }