public override PatternConverter SetNext(PatternConverter pc) { LiteralPatternConverter converter = pc as LiteralPatternConverter; if (converter == null) { return(base.SetNext(pc)); } this.Option = this.Option + converter.Option; return(this); }
/// <summary> /// Set the next converter in the chain /// </summary> /// <param name="pc">The next pattern converter in the chain</param> /// <returns>The next pattern converter</returns> /// <remarks> /// <para> /// Special case the building of the pattern converter chain /// for <see cref="T:log4net.Util.PatternStringConverters.LiteralPatternConverter" /> instances. Two adjacent /// literals in the pattern can be represented by a single combined /// pattern converter. This implementation detects when a /// <see cref="T:log4net.Util.PatternStringConverters.LiteralPatternConverter" /> is added to the chain /// after this converter and combines its value with this converter's /// literal value. /// </para> /// </remarks> public override PatternConverter SetNext(PatternConverter pc) { LiteralPatternConverter literalPatternConverter = pc as LiteralPatternConverter; if (literalPatternConverter != null) { Option += literalPatternConverter.Option; return(this); } return(base.SetNext(pc)); }
/// <summary> /// Set the next converter in the chain /// </summary> /// <param name="pc">The next pattern converter in the chain</param> /// <returns>The next pattern converter</returns> /// <remarks> /// <para> /// Special case the building of the pattern converter chain /// for <see cref="LiteralPatternConverter"/> instances. Two adjacent /// literals in the pattern can be represented by a single combined /// pattern converter. This implementation detects when a /// <see cref="LiteralPatternConverter"/> is added to the chain /// after this converter and combines its value with this converter's /// literal value. /// </para> /// </remarks> public override PatternConverter SetNext(PatternConverter pc) { LiteralPatternConverter literalPc = pc as LiteralPatternConverter; if (literalPc != null) { // Combine the two adjacent literals together Option = Option + literalPc.Option; // We are the next converter now return(this); } return(base.SetNext(pc)); }