public override void Format(TagValueFormatterArgs args) { args.PostFormatReturnValue = mbFormatReturnValue; if (args.Tags.TryGetValue(args.Value, out args.ReturnValue)) { args.Handled = true; } else { args.Handled = false; } }
/// <summary> /// Handles the replacement of tags with the actual values from the mTagList dictionary. /// </summary> /// <param name="m"></param> /// <returns></returns> protected virtual string defaultReplaceHandler(Match m) { FormatterCollection.RegExGrpItem customFormatter = null; Group grpTagValue = m.Groups[mTagValueFormatters.IdxTagValue]; if (!grpTagValue.Success) { throw new Exception("defaultReplaceHandler:\r\nTagValue expression does not exist in match."); } foreach (FormatterCollection.RegExGrpItem tagFormatter in mTagValueFormatters.RegExGroup) { if (m.Groups[tagFormatter.GroupNumber].Success) { customFormatter = tagFormatter; break; } } if (customFormatter != null) { string sValue = m.Groups[mTagValueFormatters.IdxTagValue].Value; TagValueFormatterArgs args = new TagValueFormatterArgs(m, mTagList, ref sValue); customFormatter.Formatter.Format(args); if (args.Handled) { if (args.PostFormatReturnValue) { return(TagString(ref args.ReturnValue)); } else { return(args.ReturnValue); } } else { return(m.Value); } } else { throw new Exception("defaultReplaceHandler:\r\nUnhandled tagged expression."); } }
public abstract void Format(TagValueFormatterArgs args);
//public TagDelimChangeFormatter() : base(DEF_TAGSTART, DEF_TAGEND, true) { } //public TagDelimChangeFormatter(Boolean formatReturnValue) : base(DEF_TAGSTART, DEF_TAGEND, formatReturnValue) { } //public TagDelimChangeFormatter(string tagStart, string tagEnd, Boolean formatReturnValue):base(mTagStart, //{ // mTagStart = tagStart; // mTagEnd = tagEnd; // mbFormatReturnValue = formatReturnValue; //} public override void Format(TagValueFormatterArgs args) { args.ReturnValue = mNewDelimStart + args.Value + mNewDelimEnd; args.PostFormatReturnValue = false; args.Handled = true; }
public override void Format(TagValueFormatterArgs args) { args.ReturnValue = args.Value + mBreakChars; args.Handled = true; args.PostFormatReturnValue = false; }
public override void Format(TagValueFormatterArgs args) { args.PostFormatReturnValue = mbFormatReturnValue; if (args.Tags.TryGetValue(args.Value, out args.ReturnValue)) args.Handled = true; else args.Handled = false; }
public override void Format(TagValueFormatterArgs args) { throw new Exception("The method or operation is not implemented."); }
/// <summary> /// Handles the replacement of tags with the actual values from the mTagList dictionary. /// </summary> /// <param name="m"></param> /// <returns></returns> protected virtual string defaultReplaceHandler(Match m) { FormatterCollection.RegExGrpItem customFormatter = null; Group grpTagValue = m.Groups[mTagValueFormatters.IdxTagValue]; if (!grpTagValue.Success) throw new Exception("defaultReplaceHandler:\r\nTagValue expression does not exist in match."); foreach (FormatterCollection.RegExGrpItem tagFormatter in mTagValueFormatters.RegExGroup) { if (m.Groups[tagFormatter.GroupNumber].Success) { customFormatter = tagFormatter; break; } } if (customFormatter != null) { string sValue = m.Groups[mTagValueFormatters.IdxTagValue].Value; TagValueFormatterArgs args = new TagValueFormatterArgs(m, mTagList, ref sValue); customFormatter.Formatter.Format(args); if (args.Handled) { if (args.PostFormatReturnValue) return TagString(ref args.ReturnValue); else return args.ReturnValue; } else return m.Value; } else throw new Exception("defaultReplaceHandler:\r\nUnhandled tagged expression."); }