Created
August 12, 2022 13:06
-
-
Save NikiforovAll/05b64a1259bf1d21aa660de0f61a76e1 to your computer and use it in GitHub Desktop.
Search in XML <flowable:eventInParameter>
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using Spectre.Console; | |
using System.Text.RegularExpressions; | |
foreach (var file in new DirectoryInfo(@"./bpmn-models").GetFiles("*.bpmn")) | |
{ | |
ProcessFile(file); | |
} | |
void ProcessFile(FileInfo file) | |
{ | |
using var stream = file.OpenRead(); | |
using var reader = new StreamReader(stream); | |
var text = reader.ReadToEnd(); | |
var matches = Regex.Matches(text, | |
@"<flowable:eventInParameter.*("(?<label>(\w+\s+.\w*)+)")(?=\:\s"\${(?<varname>.*)\}").*flowable:eventInParameter>"); | |
var table = new Table(); | |
table.AddColumn(file.Name); | |
table.AddColumn("Label"); | |
table.AddColumn("Variable Name"); | |
foreach (Match match in matches) | |
{ | |
table.AddRow( | |
match.ToString(), | |
match.Groups["label"].ToString(), | |
match.Groups["varname"].ToString()); | |
} | |
if (matches.Any()) | |
{ | |
AnsiConsole.Write(table); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment