/// <summary>Clone constructor. Generates a new <see cref="MaskingNodeSettings"/> instance initialized from the state of the specified instance.</summary>
 /// <exception cref="ArgumentNullException">The specified argument is <c>null</c>.</exception>
 public MaskingNodeSettings(MaskingNodeSettings other)
 {
     if (other == null)
     {
         throw Error.ArgumentNull(nameof(other));
     }
     other.CopyTo(this);
 }
        /// <summary>Copy all configuration settings to another instance.</summary>
        /// <param name="other">Another <see cref="MaskingNodeSettings"/> instance.</param>
        /// <exception cref="ArgumentNullException">The specified argument is <c>null</c>.</exception>
        public void CopyTo(MaskingNodeSettings other)
        {
            if (other == null)
            {
                throw Error.ArgumentNull(nameof(other));
            }

            other.PreserveBundle   = this.PreserveBundle;
            other.IncludeMandatory = this.IncludeMandatory;
            other.IncludeInSummary = this.IncludeInSummary;
            // other.IncludeIsModifier = this.IncludeIsModifier;
            other.ExcludeNarrative = this.ExcludeNarrative;
            other.ExcludeMarkdown  = this.ExcludeMarkdown;
            other.IncludeAll       = this.IncludeAll;
            other.IncludeElements  = this.IncludeElements?.ToArray();
            other.ExcludeElements  = this.ExcludeElements?.ToArray();
        }
Beispiel #3
0
        public MaskingNode(ITypedElement source, MaskingNodeSettings settings = null)
        {
            if (source == null)
            {
                throw Error.ArgumentNull(nameof(source));
            }
            if (source.Annotation <ScopedNode>() == null)
            {
                throw Error.Argument("MaskingNavigator can only be used on a navigator chain that contains a ScopedNavigator", nameof(source));
            }

            Source    = source;
            _settings = settings?.Clone() ?? new MaskingNodeSettings();

            if (Source is IExceptionSource ies && ies.ExceptionHandler == null)
            {
                ies.ExceptionHandler = (o, a) => ExceptionHandler.NotifyOrThrow(o, a);
            }
        }