From 00a491d93733d4625ad329b2ba8237f445364b3f Mon Sep 17 00:00:00 2001 From: Mirta Date: Wed, 30 Dec 2020 16:39:52 +0200 Subject: merge --- .../ApplicationLogViewerParser.cs | 55 ---------------------- 1 file changed, 55 deletions(-) delete mode 100644 Software/Visual_Studio/Utilities/Tango.LogViewer.UI/LogViewerFileParser/ApplicationLogViewerParser.cs (limited to 'Software/Visual_Studio/Utilities/Tango.LogViewer.UI/LogViewerFileParser/ApplicationLogViewerParser.cs') diff --git a/Software/Visual_Studio/Utilities/Tango.LogViewer.UI/LogViewerFileParser/ApplicationLogViewerParser.cs b/Software/Visual_Studio/Utilities/Tango.LogViewer.UI/LogViewerFileParser/ApplicationLogViewerParser.cs deleted file mode 100644 index 1a43a7eff..000000000 --- a/Software/Visual_Studio/Utilities/Tango.LogViewer.UI/LogViewerFileParser/ApplicationLogViewerParser.cs +++ /dev/null @@ -1,55 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using Tango.Logging; -using System.Text.RegularExpressions; -using System.IO; -using System.Globalization; - -namespace Tango.LogViewer.UI.LogViewerFileParser -{ - public class ApplicationLogViewerParser : ILogViewerParser - { - public ApplicationLogViewerParser() - { - - } - public void Parse(string file, DateTime datetime, ref List logItems) - { - String text = File.ReadAllText(file); - var logs = Regex.Split(text, @"(\[\d{2}:\d{2}:\d{2}.\d{2}\])"); - - String logText = String.Empty; - - for (int i = 1; i < logs.Length; i += 2) - { - try - { - DateTime date = DateTime.ParseExact(logs[i].Replace("[", "").Replace("]", ""), "HH:mm:ss.ff", CultureInfo.InvariantCulture); - - logText = logs[i + 1]; - var matches = Regex.Matches(logText, @"(?<=\[)(.*?)(?=\])"); - - MessageLogItem item = new MessageLogItem(); - item.TimeStamp = new DateTime(datetime.Year, datetime.Month, datetime.Day, date.Hour, date.Minute, date.Second, date.Millisecond); - item.Category = (LogCategory)Enum.Parse(typeof(LogCategory), matches[0].ToString()); - item.CallerFile = matches[1].ToString(); - item.CallerMethodName = matches[2].ToString(); - item.CallerLineNumber = int.Parse(matches[3].ToString()); - - int messageStartIndex = matches[3].Index + matches[3].Length + 2; - - item.Message = logText.Substring(messageStartIndex, logText.Length - messageStartIndex); - - logItems.Add(item); - } - catch (Exception ex) - { - LogManager.Default.Log(ex, "Could not parse log line: " + logText); - } - } - } - } -} -- cgit v1.3.1