コード例 #1
0
        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;
            }
        }
コード例 #2
0
        /// <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.");
            }
        }
コード例 #3
0
 public abstract void Format(TagValueFormatterArgs args);
コード例 #4
0
 //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;
 }
コード例 #5
0
 public override void Format(TagValueFormatterArgs args)
 {
     args.ReturnValue = args.Value + mBreakChars;
     args.Handled = true;
     args.PostFormatReturnValue = false;
 }
コード例 #6
0
        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;
        }
コード例 #7
0
 public override void Format(TagValueFormatterArgs args)
 {
     throw new Exception("The method or operation is not implemented.");
 }
コード例 #8
0
 public abstract void Format(TagValueFormatterArgs args);
コード例 #9
0
 public override void Format(TagValueFormatterArgs args)
 {
     args.ReturnValue           = args.Value + mBreakChars;
     args.Handled               = true;
     args.PostFormatReturnValue = false;
 }
コード例 #10
0
        //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;
        }
コード例 #11
0
        /// <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.");
        }