public string ToString(int identationLevel)
        {
            var tab  = new string('\t', identationLevel);
            var text = new StringBuilder();

            text.Append(getSummary(identationLevel));
            if (Errors.Count > 0)
            {
                text.AppendLine();
                text.AppendLine(tab + "Errors:");
                text.Append(string.Join(Environment.NewLine, Errors.Select(e => tab + "- " + e.ToString(identationLevel)).ToArray()));
            }
            if (Warnings.Count > 0)
            {
                text.AppendLine();
                text.AppendLine(tab + "Warnings:");
                text.Append(string.Join(Environment.NewLine, Warnings.Select(w => tab + "- " + w.ToString(identationLevel)).ToArray()));
            }
            if (PassedChecks.Count > 0)
            {
                text.AppendLine();
                text.AppendLine(tab + "Passed checks:");
                text.Append(string.Join(Environment.NewLine, PassedChecks.Select(e => tab + "- " + e.ToString(identationLevel)).ToArray()));
            }
            return(text.ToString());
        }
Esempio n. 2
0
        public string ToUser()
        {
            if (Errors.Count > 0)
            {
                _type = MessageType.Error;
                return(string.Join("<br/>", Errors.Select(m => _core.Translator._(m))));
            }

            if (Success.Count > 0)
            {
                _type = MessageType.Success;
                return(string.Join("<br/>", Success.Select(m => _core.Translator._(m))));
            }

            if (Warnings.Count > 0)
            {
                _type = MessageType.Warning;
                return(string.Join("<br/>", Warnings.Select(m => _core.Translator._(m))));
            }

            _type = MessageType.Info;
            return(string.Join("<br/>", Info.Select(m => _core.Translator._(m))));
        }
 public bool IsDefined(int pragmaWarning)
 {
     return(Warnings.Select(w => (int)w.Value).Any(n => n == pragmaWarning));
 }
Esempio n. 4
0
 /// <summary>
 /// 返回表示当前对象的字符串。
 /// </summary>
 /// <returns>
 /// 表示当前对象的字符串。
 /// </returns>
 public override string ToString()
 {
     return($"{ResultCode}; {string.Join(",", Warnings.Select(p => p.Key + "=" + p.Value))}");
 }