Exemplo n.º 1
0
        public CustomLogSummaryVm(LogEntry sourceEntry, CustomLogTemplate template, IEnumerable <string> matchValues)
            : base(sourceEntry)
        {
            _sourceModule = SourceEntry.GetModule();
            _matchValues  = matchValues?.ToArray() ?? Array.Empty <string>();
            Template      = template;
            var matchCollec = Regex.Match(Template.Details, @".*(\[(.*)\])");
            var details     = template.Details;

            details = Preformat(details);
            if (matchCollec.Success)
            {
                var collecString = matchCollec.Groups[1].Value;
                _details = TryFormat(details.Replace(collecString, "?"), _matchValues);
            }
            else
            {
                _details = TryFormat(details, _matchValues);
            }
            _typeName = Template.TypeName?.Replace("{m}", _sourceModule);
        }
Exemplo n.º 2
0
 public CustomLogTemplateVm(CustomLogTemplate template)
 {
     Template = template;
 }
Exemplo n.º 3
0
 public static CustomLogSummaryVm BuildFromTemplate(LogEntry entry, CustomLogTemplate template, Match match)
 {
     return(new CustomLogSummaryVm(entry, template, match?.Groups.Cast <Group>().Skip(1).Select(x => x.Value)));
 }