Esempio n. 1
0
        /// <summary>
        /// 构造函数;
        /// </summary>
        /// <param name="stringBuilder">指定 StringBuilder,当超出最大容量后删除顶部文本</param>
        /// <param name="format">写入 StringBuilder 的格式定义</param>
        public ConsoleStringBuilder(StringBuilder stringBuilder, ConsoleStringFormat format)
        {
            if (stringBuilder.MaxCapacity < MessageTooLongErrorString.Length)
            {
                throw new ArgumentException("StringBuilder 最大容量过小;");
            }

            this.stringBuilder = stringBuilder;
            Format             = format;
            eventLengthList    = new LinkedList <string>();

            string value = stringBuilder.ToString();

            if (!string.IsNullOrEmpty(value))
            {
                eventLengthList.AddLast(stringBuilder.ToString());
            }
            TryAppendLine();
        }
Esempio n. 2
0
 public ConsoleStringBuilder(ConsoleStringFormat format) : this(new StringBuilder(), format)
 {
 }