Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions build/_build.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,25 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net8.0</TargetFramework>
<TargetFramework>net10.0</TargetFramework>
<RootNamespace></RootNamespace>
<IsPackable>False</IsPackable>
<NoWarn>CS0649;CS0169</NoWarn>
<NukeTelemetryVersion>1</NukeTelemetryVersion>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="chocolatey" Version="2.4.3" />
<PackageReference Include="GitVersion.Core" Version="6.3.0" />
<PackageReference Include="chocolatey" Version="2.5.1" />
<PackageReference Include="GitVersion.Core" Version="6.5.0" />
<PackageReference Include="Microsoft.Build" Version="17.14.28" />
<PackageReference Include="Microsoft.Build.Tasks.Core" Version="17.14.28" />
<PackageReference Include="NuGet.CommandLine" Version="6.14.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
<PackageReference Include="Nuke.Common" Version="9.0.4" />
<PackageReference Include="Nuke.GitHub" Version="7.0.0" />
<PackageReference Include="NUnit.ConsoleRunner" Version="3.20.1" />
<PackageReference Include="NUnit.ConsoleRunner" Version="3.20.2" />
</ItemGroup>

<ItemGroup>
Expand Down
3 changes: 2 additions & 1 deletion global.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"sdk": {
"version": "9.0.301"
"version": "10.0.100",
"rollForward": "latestPatch"
}
}
2 changes: 1 addition & 1 deletion src/AutoColumnizer/AutoColumnizer.csproj
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<TargetFramework>net10.0</TargetFramework>

<AssemblyTitle>AutoColumnizer</AssemblyTitle>
<OutputPath>$(SolutionDir)..\bin\$(Configuration)\plugins</OutputPath>
Expand Down
2 changes: 1 addition & 1 deletion src/ColumnizerLib.UnitTests/ColumnizerLib.UnitTests.csproj
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<TargetFramework>net10.0</TargetFramework>

<IsTestProject>true</IsTestProject>
<AssemblyTitle>ColumnizerLib.UnitTests</AssemblyTitle>
Expand Down
2 changes: 1 addition & 1 deletion src/ColumnizerLib/ColumnizerLib.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<TargetFramework>net10.0</TargetFramework>

<DocumentationFile>$(SolutionDir)..\bin\Docs\ColumnizerLib.xml</DocumentationFile>
</PropertyGroup>
Expand Down
2 changes: 1 addition & 1 deletion src/CsvColumnizer/CsvColumnizer.csproj
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net8.0-windows</TargetFramework>
<TargetFramework>net10.0-windows</TargetFramework>
<EnableWindowsTargeting>true</EnableWindowsTargeting>

<UseWindowsForms>true</UseWindowsForms>
Expand Down
2 changes: 1 addition & 1 deletion src/DefaultPlugins/DefaultPlugins.csproj
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<TargetFramework>net10.0</TargetFramework>

<OutputPath>$(SolutionDir)..\bin\$(Configuration)\plugins</OutputPath>
</PropertyGroup>
Expand Down
16 changes: 8 additions & 8 deletions src/Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,18 @@
<PackageVersion Include="CsvHelper" Version="33.1.0" />
<PackageVersion Include="DockPanelSuite.ThemeVS2015" Version="3.1.1" />
<PackageVersion Include="GitVersion.Core" Version="6.3.0" />
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.14.1" />
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="18.0.1" />
<PackageVersion Include="Moq" Version="4.20.72" />
<PackageVersion Include="Newtonsoft.Json" Version="13.0.3" />
<PackageVersion Include="NLog" Version="6.0.0" />
<PackageVersion Include="Newtonsoft.Json" Version="13.0.4" />
<PackageVersion Include="NLog" Version="6.0.6" />
<PackageVersion Include="NuGet.CommandLine" Version="6.14.0" />
<PackageVersion Include="Nuke.Common" Version="9.0.4" />
<PackageVersion Include="Nuke.GitHub" Version="7.0.0" />
<PackageVersion Include="NUnit" Version="4.3.2" />
<PackageVersion Include="NUnit" Version="4.4.0" />
<PackageVersion Include="NUnit.ConsoleRunner" Version="3.20.1" />
<PackageVersion Include="NUnit3TestAdapter" Version="5.0.0" />
<PackageVersion Include="SSH.NET" Version="2025.0.0" />
<PackageVersion Include="System.Drawing.Common" Version="9.0.6" />
<PackageVersion Include="System.Resources.Extensions" Version="9.0.6" />
<PackageVersion Include="NUnit3TestAdapter" Version="5.2.0" />
<PackageVersion Include="SSH.NET" Version="2025.1.0" />
<PackageVersion Include="System.Drawing.Common" Version="10.0.0" />
<PackageVersion Include="System.Resources.Extensions" Version="10.0.0" />
</ItemGroup>
</Project>
2 changes: 1 addition & 1 deletion src/FlashIconHighlighter/FlashIconHighlighter.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net8.0-windows</TargetFramework>
<TargetFramework>net10.0-windows</TargetFramework>
<EnableWindowsTargeting>true</EnableWindowsTargeting>
<UseWindowsForms>true</UseWindowsForms>
<ImportWindowsDesktopTargets>true</ImportWindowsDesktopTargets>
Expand Down
2 changes: 1 addition & 1 deletion src/GlassfishColumnizer/GlassfishColumnizer.csproj
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<TargetFramework>net10.0</TargetFramework>

<OutputPath>$(SolutionDir)..\bin\$(Configuration)\plugins</OutputPath>
<AssemblyTitle>GlassfishColumnizer</AssemblyTitle>
Expand Down
2 changes: 1 addition & 1 deletion src/JsonColumnizer/JsonColumnizer.csproj
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<TargetFramework>net10.0</TargetFramework>

<OutputPath>$(SolutionDir)..\bin\$(Configuration)\plugins</OutputPath>
<AssemblyTitle>JsonColumnizer</AssemblyTitle>
Expand Down
2 changes: 1 addition & 1 deletion src/JsonCompactColumnizer/JsonCompactColumnizer.csproj
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<TargetFramework>net10.0</TargetFramework>

<RootNamespace>JsonColumnizer</RootNamespace>
<OutputPath>$(SolutionDir)..\bin\$(Configuration)\plugins</OutputPath>
Expand Down
2 changes: 1 addition & 1 deletion src/Log4jXmlColumnizer/Log4jXmlColumnizer.csproj
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net8.0-windows</TargetFramework>
<TargetFramework>net10.0-windows</TargetFramework>
<EnableWindowsTargeting>true</EnableWindowsTargeting>

<UseWindowsForms>true</UseWindowsForms>
Expand Down
5 changes: 3 additions & 2 deletions src/LogExpert.Core/Classes/Filter/FilterParams.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
using System.Text.RegularExpressions;

using LogExpert.Core.Classes.JsonConverters;
using LogExpert.Core.Helpers;

using Newtonsoft.Json;

Expand Down Expand Up @@ -130,12 +131,12 @@ public void CreateRegex ()
{
if (SearchText != null)
{
Regex = new Regex(SearchText, IsCaseSensitive ? RegexOptions.None : RegexOptions.IgnoreCase);
Regex = RegexHelper.GetOrCreateCached(SearchText, IsCaseSensitive ? RegexOptions.None : RegexOptions.IgnoreCase);
}

if (RangeSearchText != null && IsRangeSearch)
{
RangeRex = new Regex(RangeSearchText, IsCaseSensitive ? RegexOptions.None : RegexOptions.IgnoreCase);
RangeRex = RegexHelper.GetOrCreateCached(RangeSearchText, IsCaseSensitive ? RegexOptions.None : RegexOptions.IgnoreCase);
}
}

Expand Down
6 changes: 4 additions & 2 deletions src/LogExpert.Core/Classes/Highlight/HighlightEntry.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
using System.Drawing;
using System.Text.RegularExpressions;

using LogExpert.Core.Helpers;

using Newtonsoft.Json;

namespace LogExpert.Core.Classes.Highlight;
Expand Down Expand Up @@ -54,10 +56,10 @@ public Regex Regex
get
{
_regex ??= IsRegex
? new Regex(SearchText, IsCaseSensitive
? RegexHelper.GetOrCreateCached(SearchText, IsCaseSensitive
? RegexOptions.None
: RegexOptions.IgnoreCase)
: new Regex(Regex.Escape(SearchText),
: RegexHelper.GetOrCreateCached(System.Text.RegularExpressions.Regex.Escape(SearchText),
IsCaseSensitive
? RegexOptions.None
: RegexOptions.IgnoreCase);
Expand Down
16 changes: 14 additions & 2 deletions src/LogExpert.Core/Classes/ParamParser.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
using System.Text;
using System.Text.RegularExpressions;

using LogExpert.Core.Helpers;

namespace LogExpert.Core.Classes;

public class ParamParser (string argTemplate)
Expand Down Expand Up @@ -38,8 +40,18 @@ public string ReplaceParams (ILogLine logLine, int lineNum, string fileName)
replace = GetNextGroup(builder, ref sPos);
if (reg != null && replace != null)
{
var result = Regex.Replace(logLine.FullLine, reg, replace);
builder.Insert(sPos, result);
// Use RegexHelper for safe regex operations with timeout protection
try
{
var regex = RegexHelper.GetOrCreateCached(reg);
var result = regex.Replace(logLine.FullLine, replace);
builder.Insert(sPos, result);
}
catch (RegexMatchTimeoutException)
{
// If regex times out, insert the original pattern as fallback
builder.Insert(sPos, $"{{timeout: {reg}}}");
}
}
} while (replace != null);
return builder.ToString();
Expand Down
32 changes: 31 additions & 1 deletion src/LogExpert.Core/Classes/xml/XmlLogReader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -58,17 +58,37 @@ public override int ReadChar()
}

public override string ReadLine()
{
// Call async version synchronously for backward compatibility
// This maintains the interface but uses the improved async implementation internally
return ReadLineAsync(CancellationToken.None).GetAwaiter().GetResult();
}

/// <summary>
/// Reads a complete XML block asynchronously.
/// Replaces Thread.Sleep with Task.Delay for non-blocking waits.
/// </summary>
/// <param name="cancellationToken">Cancellation token for graceful cancellation</param>
/// <returns>Complete XML block or null if not available</returns>
public async Task<string?> ReadLineAsync(CancellationToken cancellationToken = default)
{
short state = 0;
var tagIndex = 0;
var blockComplete = false;
var eof = false;
var tryCounter = 5;
const int delayMs = 100;

StringBuilder builder = new();

while (!eof && !blockComplete)
{
// Check for cancellation
if (cancellationToken.IsCancellationRequested)
{
return null;
}

var readInt = ReadChar();
if (readInt == -1)
{
Expand All @@ -77,11 +97,21 @@ public override string ReadLine()
{
if (--tryCounter > 0)
{
Thread.Sleep(100);
// Use Task.Delay instead of Thread.Sleep for non-blocking wait
try
{
await Task.Delay(delayMs, cancellationToken);
}
catch (OperationCanceledException)
{
// Gracefully handle cancellation
return null;
}
continue;
}
else
{
// Timeout - return partial block if available
break;
}
}
Expand Down
Loading
Loading