Exemple #1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ColorContent" /> class.
        /// </summary>
        /// <param name="text">raw text</param>
        /// <param name="start">start position</param>
        /// <param name="end">end position</param>
        /// <param name="colorIndex">color index</param>
        public ColorContent(string text, int start, int end, ColorManager colorIndex)
        {
            start = ContentUtility.SkipBlank(text, start, end);
            var name = ContentUtility.GetToken(text, start, end);

            this.ForegroundColorId = colorIndex[name];

            start += name.Length;
            start  = ContentUtility.SkipBlank(text, start, end);
            name   = ContentUtility.GetToken(text, start, end);
            this.BackgroundColorId = colorIndex[name];
        }
Exemple #2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="BlankContent" /> class.
        /// </summary>
        /// <param name="text">whole content</param>
        /// <param name="start">blank text start position</param>
        /// <param name="end">blank text end position</param>
        public BlankContent(string text, int start, int end)
        {
            start = ContentUtility.SkipBlank(text, start, end);
            var data = ContentUtility.GetToken(text, start, end);

            this.Text = string.IsNullOrEmpty(data) ? string.Empty : data;

            start += data.Length;
            start  = ContentUtility.SkipBlank(text, start, end);
            var countText = ContentUtility.GetToken(text, start, end);

            int count;

            this.Count = int.TryParse(countText, out count) ? count : 1;
        }