Skip to content

Commit

Permalink
Moved PivotSize to local variable as it's only needed while parsing t…
Browse files Browse the repository at this point in the history
…he log
  • Loading branch information
MarkusPalcer committed May 22, 2019
1 parent ad9b66c commit ff541a6
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
2 changes: 0 additions & 2 deletions AndroidLogViewer/LogEntry.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ namespace AndroidLogViewer
{
public class LogEntry : INotifyPropertyChanged
{
public int PivotSize { get;set; }

public string Time { get; set; }

public int Process { get; set; }
Expand Down
5 changes: 3 additions & 2 deletions AndroidLogViewer/LogcatParser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ public static ObservableCollection<LogEntry> ReadLogEntries(TextReader reader)
{
var result = new ObservableCollection<LogEntry>();
LogEntry pivotEntry = null;
var pivotSize = 0;

var line = reader.ReadLine();

Expand All @@ -51,15 +52,15 @@ public static ObservableCollection<LogEntry> ReadLogEntries(TextReader reader)
Tag = match.Groups["tag"].Value.Trim(),
Time = match.Groups["datetime"].Value.Trim(),
};
if (match.Groups["premessage"].Success) newEntry.PivotSize = match.Groups["premessage"].Length;
if (match.Groups["premessage"].Success) pivotSize = match.Groups["premessage"].Length;

pivotEntry = newEntry;
}
else if (match.Groups["trailingline"].Success && pivotEntry != null)
{
var trimmedMessage = match.Groups["message"].Value.Trim();
var originalSpaceCount = match.Groups["message"].Length - trimmedMessage.Length + 1;
var messageSpaceCount = originalSpaceCount - pivotEntry.PivotSize;
var messageSpaceCount = originalSpaceCount - pivotSize;

newEntry = new LogEntry
{
Expand Down

0 comments on commit ff541a6

Please sign in to comment.