예제 #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];
        }
예제 #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;
        }
예제 #3
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ParameterContent" /> class.
        /// </summary>
        /// <param name="content">raw content</param>
        /// <param name="start">start location</param>
        /// <param name="end">end location</param>
        public ParameterContent(string content, int start, int end)
        {
            var data = 0;

            start = ContentUtility.SkipBlank(content, start, end);
            for (var i = start; i < end; i++)
            {
                var c = content[i];
                if (!char.IsDigit(c))
                {
                    break;
                }

                data = (data * 10) + ((int)c - (int)'0');
            }

            this.ParameterId = data;
        }