Skip to content

Commit e4e0970

Browse files
authored
Merge pull request #400 from LogExperts/editorconfig_optimizations
editor config optimizations
2 parents 1fd4864 + 7e7e6e9 commit e4e0970

32 files changed

Lines changed: 3426 additions & 3311 deletions
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
namespace LogExpert
1+
namespace LogExpert
22
{
33
public interface IAutoLogLineColumnizerCallback
44
{
@@ -7,6 +7,6 @@ public interface IAutoLogLineColumnizerCallback
77
/// </summary>
88
/// <param name="lineNum">Number of the line to be retrieved</param>
99
/// <returns>A string with line content or null if line number is out of range</returns>
10-
ILogLine GetLogLine(int lineNum);
10+
ILogLine GetLogLine (int lineNum);
1111
}
1212
}
Lines changed: 45 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,47 +1,52 @@
1-
namespace LogExpert
1+
namespace LogExpert;
2+
3+
///<summary>
4+
///This is a callback interface. Some of the ILogLineColumnizer functions
5+
///are called with this interface as an argument. You don't have to implement this interface. It's implemented
6+
///by LogExpert. You can use it in your own columnizers, if you need it.
7+
///</summary>
8+
///<remarks>
9+
///Implementors of ILogLineColumnizer can use the provided functions to get some more informations
10+
///about the log file. In the most cases you don't need this interface. It's provided here for special cases.<br></br>
11+
///<br></br>
12+
///An example would be when the log lines contains only the time of day but the date is coded in the file name. In this situation
13+
///you can use the GetFileName() function to retrieve the name of the current file to build a complete timestamp.
14+
///</remarks>
15+
public interface ILogLineColumnizerCallback
216
{
3-
///<summary>
4-
///This is a callback interface. Some of the ILogLineColumnizer functions
5-
///are called with this interface as an argument. You don't have to implement this interface. It's implemented
6-
///by LogExpert. You can use it in your own columnizers, if you need it.
7-
///</summary>
8-
///<remarks>
9-
///Implementors of ILogLineColumnizer can use the provided functions to get some more informations
10-
///about the log file. In the most cases you don't need this interface. It's provided here for special cases.<br></br>
11-
///<br></br>
12-
///An example would be when the log lines contains only the time of day but the date is coded in the file name. In this situation
13-
///you can use the GetFileName() function to retrieve the name of the current file to build a complete timestamp.
14-
///</remarks>
15-
public interface ILogLineColumnizerCallback
16-
{
17-
#region Public methods
17+
#region Public methods
1818

19-
/// <summary>
20-
/// This function returns the current line number. That is the line number of the log line
21-
/// a ILogLineColumnizer function is called for (e.g. the line that has to be painted).
22-
/// </summary>
23-
/// <returns>The current line number starting at 0</returns>
24-
int GetLineNum();
19+
/// <summary>
20+
/// This function returns the current line number. That is the line number of the log line
21+
/// a ILogLineColumnizer function is called for (e.g. the line that has to be painted).
22+
/// </summary>
23+
/// <returns>The current line number starting at 0</returns>
24+
int GetLineNum ();
2525

26-
/// <summary>
27-
/// Returns the full file name (path + name) of the current log file.
28-
/// </summary>
29-
/// <returns>File name of current log file</returns>
30-
string GetFileName();
26+
/// <summary>
27+
/// This function sets the current line number. That is the line number of the log line
28+
/// a ILogLineColumnizer function is called for (e.g. the line that has to be painted).
29+
/// </summary>
30+
/// <param name="lineNum">line number to be set</param>
31+
void SetLineNum (int lineNum);
32+
/// <summary>
33+
/// Returns the full file name (path + name) of the current log file.
34+
/// </summary>
35+
/// <returns>File name of current log file</returns>
36+
string GetFileName ();
3137

32-
/// <summary>
33-
/// Returns the log line with the given index (zero-based).
34-
/// </summary>
35-
/// <param name="lineNum">Number of the line to be retrieved</param>
36-
/// <returns>A string with line content or null if line number is out of range</returns>
37-
ILogLine GetLogLine(int lineNum);
38+
/// <summary>
39+
/// Returns the log line with the given index (zero-based).
40+
/// </summary>
41+
/// <param name="lineNum">Number of the line to be retrieved</param>
42+
/// <returns>A string with line content or null if line number is out of range</returns>
43+
ILogLine GetLogLine (int lineNum);
3844

39-
/// <summary>
40-
/// Returns the number of lines of the logfile.
41-
/// </summary>
42-
/// <returns>Number of lines.</returns>
43-
int GetLineCount();
45+
/// <summary>
46+
/// Returns the number of lines of the logfile.
47+
/// </summary>
48+
/// <returns>Number of lines.</returns>
49+
int GetLineCount ();
4450

45-
#endregion
46-
}
51+
#endregion
4752
}

src/Directory.Packages.props

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
<PackageVersion Include="NUnit3TestAdapter" Version="5.0.0" />
2929
<PackageVersion Include="SSH.NET" Version="2024.2.0" />
3030
<PackageVersion Include="System.Data.DataSetExtensions" Version="4.5.0" />
31-
<PackageVersion Include="System.Drawing.Common" Version="9.0.3" />
31+
<PackageVersion Include="System.Drawing.Common" Version="9.0.5" />
3232
<PackageVersion Include="System.Resources.Extensions" Version="9.0.3" />
3333
<PackageVersion Include="System.Text.Encoding" Version="4.3.0" />
3434
</ItemGroup>
Lines changed: 50 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -1,69 +1,70 @@
1-
using LogExpert.Core.Interface;
1+
using LogExpert.Core.Interface;
22

3-
namespace LogExpert.Classes.ILogLineColumnizerCallback
4-
{
5-
public class ColumnizerCallback : LogExpert.ILogLineColumnizerCallback, IAutoLogLineColumnizerCallback
6-
{
7-
#region Fields
3+
namespace LogExpert.Core.Callback;
84

9-
protected ILogWindow _logWindow;
10-
protected IPluginRegistry _pluginRegistry;
5+
public class ColumnizerCallback : ILogLineColumnizerCallback, IAutoLogLineColumnizerCallback
6+
{
7+
#region cTor
118

12-
#endregion
9+
public ColumnizerCallback (ILogWindow logWindow)
10+
{
11+
LogWindow = logWindow;
12+
}
1313

14-
#region cTor
14+
private ColumnizerCallback (ColumnizerCallback original)
15+
{
16+
LogWindow = original.LogWindow;
17+
LineNum = original.GetLineNum();
18+
}
1519

16-
public ColumnizerCallback(ILogWindow logWindow)
17-
{
18-
_logWindow = logWindow;
19-
}
20+
#endregion
2021

21-
private ColumnizerCallback(ColumnizerCallback original)
22-
{
23-
_logWindow = original._logWindow;
24-
LineNum = original.LineNum;
25-
}
22+
#region Properties
2623

27-
#endregion
24+
public int LineNum { get; set; }
2825

29-
#region Properties
26+
protected ILogWindow LogWindow { get; set; }
3027

31-
public int LineNum { get; set; }
28+
protected IPluginRegistry PluginRegistry { get; set; }
3229

33-
#endregion
30+
#endregion
3431

35-
#region Public methods
32+
#region Public methods
3633

37-
public ColumnizerCallback CreateCopy()
38-
{
39-
return new ColumnizerCallback(this);
40-
}
34+
public ColumnizerCallback CreateCopy ()
35+
{
36+
return new ColumnizerCallback(this);
37+
}
4138

42-
public int GetLineNum()
43-
{
44-
return LineNum;
45-
}
39+
public int GetLineNum ()
40+
{
41+
return LineNum;
42+
}
4643

47-
public string GetFileName()
48-
{
49-
return _logWindow.GetCurrentFileName(LineNum);
50-
}
44+
public string GetFileName ()
45+
{
46+
return LogWindow.GetCurrentFileName(GetLineNum());
47+
}
5148

52-
public ILogLine GetLogLine(int lineNum)
53-
{
54-
return _logWindow.GetLine(lineNum);
55-
}
49+
public ILogLine GetLogLine (int lineNum)
50+
{
51+
return LogWindow.GetLine(lineNum);
52+
}
5653

57-
public IList<ILogLineColumnizer> GetRegisteredColumnizers()
58-
{
59-
return _pluginRegistry.RegisteredColumnizers;
60-
}
54+
public IList<ILogLineColumnizer> GetRegisteredColumnizers ()
55+
{
56+
return PluginRegistry.RegisteredColumnizers;
57+
}
6158

62-
public int GetLineCount()
63-
{
64-
return _logWindow._logFileReader.LineCount;
65-
}
59+
public int GetLineCount ()
60+
{
61+
return LogWindow.LogFileReader.LineCount;
62+
}
6663

67-
#endregion
64+
public void SetLineNum (int lineNum)
65+
{
66+
LineNum = lineNum;
6867
}
68+
69+
#endregion
6970
}

src/LogExpert.Core/Classes/Columnizer/SquareBracketColumnizer.cs

Lines changed: 14 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
using System;
2-
using System.Collections.Generic;
3-
using System.Linq;
41
using System.Text.RegularExpressions;
52

63
using static LogExpert.Core.Classes.Columnizer.TimeFormatDeterminer;
@@ -18,11 +15,11 @@ public class SquareBracketColumnizer : ILogLineColumnizer, IColumnizerPriority
1815
private int _columnCount = 5;
1916
private bool _isTimeExists = false;
2017

21-
public SquareBracketColumnizer()
18+
public SquareBracketColumnizer ()
2219
{
2320
}
2421

25-
public SquareBracketColumnizer(int columnCount, bool isTimeExists) : this()
22+
public SquareBracketColumnizer (int columnCount, bool isTimeExists) : this()
2623
{
2724
// Add message column
2825
_columnCount = columnCount + 1;
@@ -34,22 +31,22 @@ public SquareBracketColumnizer(int columnCount, bool isTimeExists) : this()
3431
}
3532
}
3633

37-
public bool IsTimeshiftImplemented()
34+
public bool IsTimeshiftImplemented ()
3835
{
3936
return true;
4037
}
4138

42-
public void SetTimeOffset(int msecOffset)
39+
public void SetTimeOffset (int msecOffset)
4340
{
4441
timeOffset = msecOffset;
4542
}
4643

47-
public int GetTimeOffset()
44+
public int GetTimeOffset ()
4845
{
4946
return timeOffset;
5047
}
5148

52-
public DateTime GetTimestamp(LogExpert.ILogLineColumnizerCallback callback, ILogLine line)
49+
public DateTime GetTimestamp (LogExpert.ILogLineColumnizerCallback callback, ILogLine line)
5350
{
5451
IColumnizedLogLine cols = SplitLine(callback, line);
5552
if (cols == null || cols.ColumnValues == null || cols.ColumnValues.Length < 2)
@@ -81,7 +78,7 @@ public DateTime GetTimestamp(LogExpert.ILogLineColumnizerCallback callback, ILog
8178
}
8279
}
8380

84-
public void PushValue(LogExpert.ILogLineColumnizerCallback callback, int column, string value, string oldValue)
81+
public void PushValue (LogExpert.ILogLineColumnizerCallback callback, int column, string value, string oldValue)
8582
{
8683
if (column == 1)
8784
{
@@ -105,22 +102,22 @@ public void PushValue(LogExpert.ILogLineColumnizerCallback callback, int column,
105102
}
106103
}
107104

108-
public string GetName()
105+
public string GetName ()
109106
{
110107
return "Square Bracket Columnizer";
111108
}
112109

113-
public string GetDescription()
110+
public string GetDescription ()
114111
{
115112
return "Splits every line into n fields: Date, Time and the rest of the log message";
116113
}
117114

118-
public int GetColumnCount()
115+
public int GetColumnCount ()
119116
{
120117
return _columnCount;
121118
}
122119

123-
public string[] GetColumnNames()
120+
public string[] GetColumnNames ()
124121
{
125122
var columnNames = new List<string>(GetColumnCount());
126123
if (_isTimeExists)
@@ -151,7 +148,7 @@ public string[] GetColumnNames()
151148
return columnNames.ToArray();
152149
}
153150

154-
public IColumnizedLogLine SplitLine(LogExpert.ILogLineColumnizerCallback callback, ILogLine line)
151+
public IColumnizedLogLine SplitLine (LogExpert.ILogLineColumnizerCallback callback, ILogLine line)
155152
{
156153
// 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
157154
// 012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789
@@ -217,7 +214,7 @@ public IColumnizedLogLine SplitLine(LogExpert.ILogLineColumnizerCallback callbac
217214
return clogLine;
218215
}
219216

220-
void SquareSplit(ref Column[] columns, string line, int dateLen, int timeLen, int dateTimeEndPos, ColumnizedLogLine clogLine)
217+
void SquareSplit (ref Column[] columns, string line, int dateLen, int timeLen, int dateTimeEndPos, ColumnizedLogLine clogLine)
221218
{
222219
List<Column> columnList = [];
223220
int restColumn = _columnCount;
@@ -256,7 +253,7 @@ void SquareSplit(ref Column[] columns, string line, int dateLen, int timeLen, in
256253
columns = columnList.ToArray();
257254
}
258255

259-
public Priority GetPriority(string fileName, IEnumerable<ILogLine> samples)
256+
public Priority GetPriority (string fileName, IEnumerable<ILogLine> samples)
260257
{
261258
Priority result = Priority.NotSupport;
262259
TimeFormatDeterminer timeDeterminer = new();

0 commit comments

Comments
 (0)