public ComparisonMessage(MessageTemplate template, FileObjectPath path, Category severity, params object[] formatArguments) { Severity = severity; Message = $"{string.Format(CultureInfo.CurrentCulture, template.Message, formatArguments)}"; Path = path; Id = template.Id; Code = template.Code; }
private SourceLocation[] GetSourceLocations(FileObjectPath path) { if (path == null) { return(new SourceLocation[0]); } return(new[] { new SourceLocation { document = path.FilePath?.ToString(), Position = new SmartPosition { path = path.ObjectPath?.Path.Select(part => part.RawPath).ToArray() ?? new object[0] } } }); }
public ValidationMessage(FileObjectPath path, Rule rule, params object[] formatArguments) { Rule = rule; Severity = rule.Severity; Message = $"{string.Format(CultureInfo.CurrentCulture, rule.MessageTemplate, formatArguments)}"; Path = path; if (Verbose) { var stackTrace = Environment.StackTrace; // cut away logging part var lastMention = stackTrace.LastIndexOf(typeof(ValidationMessage).Namespace); stackTrace = stackTrace.Substring(lastMention); // skip to next stack frame stackTrace = stackTrace.Substring(stackTrace.IndexOf('\n') + 1); VerboseData = stackTrace; } }
public ValidationMessage(FileObjectPath path, Rule rule, params object[] formatArguments) : base(rule.Severity, $"{string.Format(CultureInfo.CurrentCulture, rule.MessageTemplate, formatArguments)}", path) { Rule = rule; }
public ComparisonMessage(MessageTemplate template, FileObjectPath path, Category severity, params object[] formatArguments) : base(severity, $"Comparison: {template.Id} - {string.Format(CultureInfo.CurrentCulture, template.Message, formatArguments)}", path) { Id = template.Id; }
public ComparisonMessage(MessageTemplate template, FileObjectPath path, Category severity) : this(template, path, severity, new string[0]) { }