Skip to content

Commit fe25a88

Browse files
authored
Merge pull request #372 from LogExperts/decouple_ui_businesslogic
Decouple UI businesslogic
2 parents 8fba5b8 + 19a5d77 commit fe25a88

180 files changed

Lines changed: 8076 additions & 7884 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

src/AutoColumnizer/AutoColumnizer.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
1-
using System;
1+
using LogExpert;
2+
3+
using System;
24
using System.Collections.Generic;
35
using System.Linq;
46
using System.Text;
57

6-
namespace LogExpert
8+
namespace AutoColumnizer
79
{
810
public class AutoColumnizer : ILogLineColumnizer
911
{

src/ColumnizerLib.UnitTests/Extensions/LogLineExtensionsTests.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
using LogExpert;
2+
using LogExpert.Extensions;
3+
24
using NUnit.Framework;
35

46
namespace ColumnizerLib.UnitTests.Extensions

src/ColumnizerLib/Extensions/LogLineExtensions.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
namespace LogExpert
1+
namespace LogExpert.Extensions
22
{
33
public static class LogLineExtensions
44
{

src/ColumnizerLib/IFileSystemPlugin.cs

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,10 @@
1-
using System;
2-
using System.Collections.Generic;
3-
using System.Text;
4-
5-
namespace LogExpert
1+
namespace LogExpert
62
{
73
/// <summary>
84
/// Interface for file system plugins. A file system plugin is responsible for feeding file data to LogExpert.
95
/// </summary>
106
/// <remarks>
11-
/// LogExperts file handling is done via file system plugins. The selection if the appropriate plugin for a file is based
7+
/// LogExperts file handling is done via file system plugins. The selection if the appropriate plugin for a file is based
128
/// on URI schemes. If a file system plugin returns <code>true</code> to the <see cref="CanHandleUri"/> method, it will be selected
139
/// to handle a file.
1410
/// </remarks>
@@ -31,7 +27,7 @@ public interface IFileSystemPlugin
3127
#region Public methods
3228

3329
/// <summary>
34-
/// Called from LogExpert to determine a file system plugin for a given URI.
30+
/// Called from LogExpert to determine a file system plugin for a given URI.
3531
/// </summary>
3632
/// <param name="uriString">The URI of the file to be loaded.</param>
3733
/// <returns>Return <code>true</code> if the file system plugin can handle the URI.</returns>

src/ColumnizerLib/IXmlLogConfiguration.cs

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,4 @@
1-
using System;
2-
using System.Collections.Generic;
3-
using System.Text;
4-
5-
namespace LogExpert
1+
namespace LogExpert
62
{
73
/// <summary>
84
/// This interface declares the configuration data which is needed for XML log file parsing.
@@ -32,7 +28,7 @@ public interface IXmlLogConfiguration
3228
/// <summary>
3329
/// A namespace declaration. The returned array must contain 2 strings: The namespace and its declaration.<br></br>
3430
/// Example: {"log4j", "http://jakarta.apache.org/log4j"}
35-
///
31+
///
3632
/// </summary>
3733
string[] Namespace { get; }
3834

src/CsvColumnizer/CsvColumnizer.cs

Lines changed: 21 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
using CsvHelper;
2+
23
using LogExpert;
4+
35
using Newtonsoft.Json;
6+
47
using System;
58
using System.Collections.Generic;
69
using System.IO;
@@ -157,28 +160,26 @@ public void Selected(ILogLineColumnizerCallback callback)
157160

158161
if (line != null)
159162
{
160-
using (CsvReader csv = new CsvReader(new StringReader(line.FullLine), _config.ReaderConfiguration))
161-
{
162-
csv.Read();
163-
csv.ReadHeader();
164-
165-
int fieldCount = csv.Parser.Count;
163+
using CsvReader csv = new(new StringReader(line.FullLine), _config.ReaderConfiguration);
164+
csv.Read();
165+
csv.ReadHeader();
166+
167+
int fieldCount = csv.Parser.Count;
166168

167-
string[] headerRecord = csv.HeaderRecord;
169+
string[] headerRecord = csv.HeaderRecord;
168170

169-
if (_config.HasFieldNames && headerRecord != null)
171+
if (_config.HasFieldNames && headerRecord != null)
172+
{
173+
foreach (string headerColumn in headerRecord)
170174
{
171-
foreach (string headerColumn in headerRecord)
172-
{
173-
_columnList.Add(new CsvColumn(headerColumn));
174-
}
175+
_columnList.Add(new CsvColumn(headerColumn));
175176
}
176-
else
177+
}
178+
else
179+
{
180+
for (int i = 0; i < fieldCount; ++i)
177181
{
178-
for (int i = 0; i < fieldCount; ++i)
179-
{
180-
_columnList.Add(new CsvColumn("Column " + i + 1));
181-
}
182+
_columnList.Add(new CsvColumn("Column " + i + 1));
182183
}
183184
}
184185
}
@@ -187,7 +188,7 @@ public void Selected(ILogLineColumnizerCallback callback)
187188

188189
public void DeSelected(ILogLineColumnizerCallback callback)
189190
{
190-
// nothing to do
191+
// nothing to do
191192
}
192193

193194
public void Configure(ILogLineColumnizerCallback callback, string configDir)
@@ -257,14 +258,14 @@ private IColumnizedLogLine SplitCsvLine(ILogLine line)
257258
{
258259
ColumnizedLogLine cLogLine = new ColumnizedLogLine();
259260
cLogLine.LogLine = line;
260-
261+
261262
using (CsvReader csv = new CsvReader(new StringReader(line.FullLine), _config.ReaderConfiguration))
262263
{
263264
csv.Read();
264265
csv.ReadHeader();
265266

266267
//we only read line by line and not the whole file so it is always the header
267-
string[] records = csv.HeaderRecord;
268+
string[] records = csv.HeaderRecord;
268269

269270
if (records != null)
270271
{

src/Directory.Packages.props

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
<PackageVersion Include="DockPanelSuite.ThemeVS2015" Version="3.1.1" />
1212
<PackageVersion Include="GitVersion.CommandLine" Version="5.12.0" />
1313
<PackageVersion Include="GitVersion.Core" Version="6.1.0" />
14-
<PackageVersion Include="Google.Protobuf" Version="3.30.1" />
14+
<PackageVersion Include="Google.Protobuf" Version="3.30.2" />
1515
<PackageVersion Include="Grpc.AspNetCore" Version="2.70.0" />
1616
<PackageVersion Include="Grpc.Core" Version="2.46.6" />
1717
<PackageVersion Include="Grpc.Tools" Version="2.71.0" />

src/Log4jXmlColumnizer/Log4jXmlColumnizer.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
using Newtonsoft.Json;
1+
using LogExpert;
2+
3+
using Newtonsoft.Json;
24

35
using System;
46
using System.Collections.Generic;
@@ -10,7 +12,7 @@
1012
using System.Windows.Forms;
1113

1214
[assembly: SupportedOSPlatform("windows")]
13-
namespace LogExpert
15+
namespace Log4jXmlColumnizer
1416
{
1517
/// <summary>
1618
/// XMl configuration for parsing log4j XML files. The XSL will transform every block of log entries

src/Log4jXmlColumnizer/Log4jXmlColumnizerConfigDlg.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
using System;
1+
using Log4jXmlColumnizer;
2+
3+
using System;
24
using System.Drawing;
35
using System.Windows.Forms;
46

src/LogExpert.Tests/BufferShiftTest.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
using LogExpert.Classes.Log;
2-
using LogExpert.Entities;
2+
using LogExpert.Core.Classes.Log;
3+
using LogExpert.Core.Entities;
4+
using LogExpert.PluginRegistry.FileSystem;
35

46
using NUnit.Framework;
57

@@ -39,6 +41,8 @@ public void TestShiftBuffers1()
3941
{
4042
Encoding = Encoding.Default
4143
};
44+
45+
PluginRegistry.PluginRegistry.Instance.Create(testDirectory.FullName, 500);
4246
LogfileReader reader = new(files.Last.Value, encodingOptions, true, 40, 50, options);
4347
reader.ReadFiles();
4448

0 commit comments

Comments
 (0)