diff --git a/Sources/EventViewerX/EventObject.cs b/Sources/EventViewerX/EventObject.cs index 9dc983f..1d442ca 100644 --- a/Sources/EventViewerX/EventObject.cs +++ b/Sources/EventViewerX/EventObject.cs @@ -200,6 +200,37 @@ private Dictionary ParseMessage(string message) { return data; } + /// + /// Parses lines containing colon separated key/value pairs. + /// + /// Text to parse + /// Dictionary with parsed key value pairs + private static Dictionary ParseColonSeparatedLines(string text) { + Dictionary data = new Dictionary(); + if (string.IsNullOrEmpty(text)) { + return data; + } + + string[] lines = Regex.Split(text, "\r?\n"); + foreach (string rawLine in lines) { + string line = rawLine.Trim(); + if (string.IsNullOrEmpty(line)) { + continue; + } + + int index = line.IndexOf(':'); + if (index > -1) { + string key = line.Substring(0, index).Trim(); + string value = line.Substring(index + 1).Trim(); + if (!string.IsNullOrEmpty(key)) { + data[key] = value; + } + } + } + + return data; + } + /// /// Parses the XML data of the event record into a dictionary converting it into a key value pair /// @@ -243,6 +274,11 @@ private Dictionary ParseXML(string xmlData) { } } data[name] = value; + foreach (var kv in ParseColonSeparatedLines(value)) { + if (!data.ContainsKey(kv.Key)) { + data[kv.Key] = kv.Value; + } + } } } return data;