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
4 changes: 2 additions & 2 deletions src/AutoColumnizer/AutoColumnizer.csproj
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net8.0-windows</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<OutputType>Library</OutputType>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
<AssemblyTitle>AutoColumnizer</AssemblyTitle>
<SignAssembly>true</SignAssembly>
<AssemblyOriginatorKeyFile>..\Solution Items\Key.snk</AssemblyOriginatorKeyFile>
<IsTestProject>false</IsTestProject>
<IsTestProject>false</IsTestProject>
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
<OutputPath>$(SolutionDir)..\bin\$(Configuration)\plugins</OutputPath>
</PropertyGroup>
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-windows</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<OutputType>Library</OutputType>
<IsTestProject>true</IsTestProject>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
Expand Down
10 changes: 5 additions & 5 deletions src/DefaultPlugins/DefaultPlugins.csproj
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net8.0-windows</TargetFramework>
<EnableWindowsTargeting>true</EnableWindowsTargeting>
<TargetFramework>net8.0</TargetFramework>
<EnableWindowsTargeting>False</EnableWindowsTargeting>
<OutputType>Library</OutputType>
<IsTestProject>false</IsTestProject>
<IsTestProject>false</IsTestProject>
<RootNamespace>LogExpert</RootNamespace>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
<UseWindowsForms>true</UseWindowsForms>
<ImportWindowsDesktopTargets>true</ImportWindowsDesktopTargets>
<UseWindowsForms>False</UseWindowsForms>
<ImportWindowsDesktopTargets>False</ImportWindowsDesktopTargets>
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
<OutputPath>$(SolutionDir)..\bin\$(Configuration)\plugins</OutputPath>
</PropertyGroup>
Expand Down
3 changes: 2 additions & 1 deletion src/DefaultPlugins/ProcessLauncher.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@

namespace LogExpert
{
public class ProcessLauncher : IKeywordAction
//TODO: Not in use
internal class ProcessLauncher : IKeywordAction
{
#region Properties

Expand Down
4 changes: 2 additions & 2 deletions src/GlassfishColumnizer/GlassfishColumnizer.csproj
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net8.0-windows</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<OutputType>Library</OutputType>
<IsTestProject>false</IsTestProject>
<IsTestProject>false</IsTestProject>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
<OutputPath>$(SolutionDir)..\bin\$(Configuration)\plugins</OutputPath>
Expand Down
10 changes: 5 additions & 5 deletions src/JsonColumnizer/JsonColumnizer.csproj
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net8.0-windows</TargetFramework>
<EnableWindowsTargeting>true</EnableWindowsTargeting>
<TargetFramework>net8.0</TargetFramework>
<EnableWindowsTargeting>false</EnableWindowsTargeting>
<OutputType>Library</OutputType>
<IsTestProject>false</IsTestProject>
<IsTestProject>false</IsTestProject>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
<UseWindowsForms>true</UseWindowsForms>
<ImportWindowsDesktopTargets>true</ImportWindowsDesktopTargets>
<UseWindowsForms>false</UseWindowsForms>
<ImportWindowsDesktopTargets>false</ImportWindowsDesktopTargets>
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
<OutputPath>$(SolutionDir)..\bin\$(Configuration)\plugins</OutputPath>
</PropertyGroup>
Expand Down
10 changes: 5 additions & 5 deletions src/JsonCompactColumnizer/JsonCompactColumnizer.csproj
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net8.0-windows</TargetFramework>
<EnableWindowsTargeting>true</EnableWindowsTargeting>
<TargetFramework>net8.0</TargetFramework>
<EnableWindowsTargeting>false</EnableWindowsTargeting>
<OutputType>Library</OutputType>
<IsTestProject>false</IsTestProject>
<IsTestProject>false</IsTestProject>
<RootNamespace>JsonColumnizer</RootNamespace>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
<UseWindowsForms>true</UseWindowsForms>
<ImportWindowsDesktopTargets>true</ImportWindowsDesktopTargets>
<UseWindowsForms>false</UseWindowsForms>
<ImportWindowsDesktopTargets>false</ImportWindowsDesktopTargets>
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
<OutputPath>$(SolutionDir)..\bin\$(Configuration)\plugins</OutputPath>
</PropertyGroup>
Expand Down
2 changes: 1 addition & 1 deletion src/Log4jXmlColumnizer/Log4jXmlColumnizer.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<TargetFramework>net8.0-windows</TargetFramework>
<EnableWindowsTargeting>true</EnableWindowsTargeting>
<OutputType>Library</OutputType>
<IsTestProject>false</IsTestProject>
<IsTestProject>false</IsTestProject>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
<UseWindowsForms>true</UseWindowsForms>
<ImportWindowsDesktopTargets>true</ImportWindowsDesktopTargets>
Expand Down
5 changes: 0 additions & 5 deletions src/LogExpert.Core/Classes/Filter/Filter.cs
Original file line number Diff line number Diff line change
@@ -1,13 +1,8 @@
using LogExpert.Classes.ILogLineColumnizerCallback;
using LogExpert.Core.Classes;
using LogExpert.Core.Classes.Filter;

using NLog;

using System;
using System.Collections.Generic;
using System.Windows.Forms;

namespace LogExpert.Classes.Filter
{
internal delegate void FilterFx(FilterParams filterParams, List<int> filterResultLines, List<int> lastFilterResultLines, List<int> filterHitList);
Expand Down
54 changes: 0 additions & 54 deletions src/LogExpert.Core/Classes/Util.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using LogExpert.Core.Classes.Filter;

using System.Diagnostics;
using System.Drawing;
using System.Runtime.Versioning;
Expand Down Expand Up @@ -402,59 +401,6 @@ public static void AssertTrue(bool condition, string msg)
}
}

[SupportedOSPlatform("windows")]
public string GetWordFromPos(int xPos, string text, Graphics g, Font font)
{
string[] words = text.Split([' ', '.', ':', ';']);

int index = 0;

List<CharacterRange> crList = [];

for (int i = 0; i < words.Length; ++i)
{
crList.Add(new CharacterRange(index, words[i].Length));
index += words[i].Length;
}

CharacterRange[] crArray = [.. crList];

StringFormat stringFormat = new(StringFormat.GenericTypographic)
{
Trimming = StringTrimming.None,
FormatFlags = StringFormatFlags.NoClip
};

stringFormat.SetMeasurableCharacterRanges(crArray);

RectangleF rect = new(0, 0, 3000, 20);
Region[] stringRegions = g.MeasureCharacterRanges(text, font, rect, stringFormat);

bool found = false;

int y = 0;

foreach (Region regio in stringRegions)
{
if (regio.IsVisible(xPos, 3, g))
{
found = true;
break;
}

y++;
}

if (found)
{
return words[y];
}
else
{
return null;
}
}

#endregion

#region Private Methods
Expand Down
29 changes: 0 additions & 29 deletions src/LogExpert.Core/Config/ColorMode.cs
Original file line number Diff line number Diff line change
Expand Up @@ -74,34 +74,5 @@ private static void SetBrightMode()
InactiveTabColor = LessBrightBackgroundColor;
DarkModeEnabled = false;
}

#region TitleBarDarkMode
[DllImport("dwmapi.dll")]
private static extern int DwmSetWindowAttribute(nint hwnd, int attr, ref int attrValue, int attrSize);

private const int DWMWA_USE_IMMERSIVE_DARK_MODE_BEFORE_20H1 = 19;
private const int DWMWA_USE_IMMERSIVE_DARK_MODE = 20;

public static bool UseImmersiveDarkMode(nint handle, bool enabled)
{

var attribute = DWMWA_USE_IMMERSIVE_DARK_MODE_BEFORE_20H1;
if (IsWindows10OrGreater(18985))
{
attribute = DWMWA_USE_IMMERSIVE_DARK_MODE;
}

int useImmersiveDarkMode = enabled ? 1 : 0;
return DwmSetWindowAttribute(handle, attribute, ref useImmersiveDarkMode, sizeof(int)) == 0;

}

private static bool IsWindows10OrGreater(int build = -1)
{
return Environment.OSVersion.Version.Major >= 10 && Environment.OSVersion.Version.Build >= build;
}

#endregion TitleBarDarkMode

}
}
2 changes: 1 addition & 1 deletion src/LogExpert.Core/Entities/FileViewContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace LogExpert.Core.Entities
{
public class FileViewContext(ILogPaintContext logPaintContext, ILogView logView)
public class FileViewContext(ILogPaintContext logPaintContext, ILogView logView) : IFileViewContext, ILogPaintContext
{
#region Properties

Expand Down
10 changes: 10 additions & 0 deletions src/LogExpert.Core/Interface/IFileViewContext.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
using LogExpert.Core.Entities;

namespace LogExpert.Core.Interface
{
public interface IFileViewContext
{
ILogView LogView { get; }
ILogPaintContext LogPaintContext { get; }
}
}
32 changes: 1 addition & 31 deletions src/LogExpert.Core/Interface/ILogPaintContext.cs
Original file line number Diff line number Diff line change
@@ -1,36 +1,6 @@
using LogExpert.Core.Classes.Highlight;
using LogExpert.Core.Entities;

using System.Drawing;

namespace LogExpert.Core.Interface
namespace LogExpert.Core.Interface
{
/// <summary>
/// Declares methods that are needed for drawing log lines. Used by PaintHelper.
/// </summary>
public interface ILogPaintContext
{
#region Properties

Font MonospacedFont { get; } // Font font = new Font("Courier New", this.Preferences.fontSize, FontStyle.Bold);
Font NormalFont { get; }
Font BoldFont { get; }
Color BookmarkColor { get; }

#endregion

#region Public methods

ILogLine GetLogLine(int lineNum);

IColumn GetCellValue(int rowIndex, int columnIndex);

Bookmark GetBookmarkForLine(int lineNum);

HighlightEntry FindHighlightEntry(ITextValue line, bool noWordMatches);

IList<HilightMatchEntry> FindHighlightMatches(ITextValue line);

#endregion
}
}
3 changes: 1 addition & 2 deletions src/LogExpert.Core/Interface/ISharedToolWindow.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using LogExpert.Core.Config;
using LogExpert.Core.Entities;

namespace LogExpert.Core.Interface
{
Expand All @@ -16,7 +15,7 @@ public interface ISharedToolWindow
/// Called when a file becomes the active file (e.g. when user selects a tab).
/// </summary>
/// <param name="ctx"></param>
void SetCurrentFile(FileViewContext ctx);
void SetCurrentFile(IFileViewContext ctx);

/// <summary>
/// Called whenever the current file has been changed.
Expand Down
3 changes: 2 additions & 1 deletion src/LogExpert.Core/LogExpert.Core.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<SignAssembly>True</SignAssembly>
<AssemblyOriginatorKeyFile>..\Solution Items\Key.snk</AssemblyOriginatorKeyFile>
<PublishAot>false</PublishAot>
<NoWarn>CS8625;CS8603;CS8618;CS8600;CS8603;CS8602;CS8604;CS8622;CS8601;</NoWarn>
</PropertyGroup>

<ItemGroup>
Expand All @@ -21,7 +23,6 @@
<ItemGroup>
<PackageReference Include="Newtonsoft.Json" />
<PackageReference Include="NLog" />
<PackageReference Include="System.Drawing.Common" />
</ItemGroup>

<ItemGroup>
Expand Down
3 changes: 2 additions & 1 deletion src/LogExpert.UI/Controls/LogWindow/LogWindow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,15 @@
using LogExpert.UI.Controls.LogTabWindow;
using LogExpert.UI.Dialogs;
using LogExpert.UI.Extensions.Forms;
using LogExpert.UI.Interface;
using NLog;
using WeifenLuo.WinFormsUI.Docking;
//using static LogExpert.PluginRegistry.PluginRegistry; //TODO: Adjust the instance name so using static can be used.

namespace LogExpert.UI.Controls.LogWindow
{
//TODO: Implemented 4 interfaces explicitly. Find them by searcginh: ILogWindow.<method name>
internal partial class LogWindow : DockContent, ILogPaintContext, ILogView, ILogWindow
internal partial class LogWindow : DockContent, ILogPaintContextUI, ILogView, ILogWindow
{
#region Fields

Expand Down
10 changes: 2 additions & 8 deletions src/LogExpert.UI/Controls/LogWindow/TimeSpreadigControl.cs
Original file line number Diff line number Diff line change
@@ -1,14 +1,8 @@
using LogExpert.Classes;
using LogExpert.Core.Classes;
using LogExpert.Core.Classes;
using LogExpert.Core.EventArguments;
using LogExpert.UI.Controls.LogWindow;
using LogExpert.UI.Extensions;
using NLog;

using System;
using System.Collections.Generic;
using System.Drawing;
using System.Windows.Forms;

namespace LogExpert.UI.Controls.LogWindow
{
internal partial class TimeSpreadingControl : UserControl
Expand All @@ -17,9 +11,9 @@

#region Fields

private Bitmap _bitmap = new(1, 1);

Check warning on line 14 in src/LogExpert.UI/Controls/LogWindow/TimeSpreadigControl.cs

View workflow job for this annotation

GitHub Actions / build

This call site is reachable on all platforms. 'Bitmap' is only supported on: 'windows' 6.1 and later. (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1416)
private int _displayHeight = 1;
private readonly int _edgeOffset = (int)Win32.GetSystemMetricsForDpi(Win32.SM_CYVSCROLL);

Check warning on line 16 in src/LogExpert.UI/Controls/LogWindow/TimeSpreadigControl.cs

View workflow job for this annotation

GitHub Actions / build

This call site is reachable on all platforms. 'Win32.GetSystemMetricsForDpi(long)' is only supported on: 'windows'. (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1416)
private int _lastMouseY = 0;
private readonly object _monitor = new();
private int _rectHeight = 1;
Expand Down
14 changes: 4 additions & 10 deletions src/LogExpert.UI/Dialogs/BookmarkWindow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,8 @@
using LogExpert.Core.Interface;
using LogExpert.UI.Entities;
using LogExpert.UI.Extensions.Forms;

using LogExpert.UI.Interface;
using NLog;

using System;
using System.Collections.Generic;
using System.Drawing;
using System.Windows.Forms;

using WeifenLuo.WinFormsUI.Docking;

namespace LogExpert.Dialogs;
Expand All @@ -25,7 +19,7 @@ public partial class BookmarkWindow : DockContent, ISharedToolWindow, IBookmarkV
private readonly object paintLock = new();

private IBookmarkData bookmarkData;
private ILogPaintContext logPaintContext;
private ILogPaintContextUI logPaintContext;
private ILogView logView;

#endregion
Expand Down Expand Up @@ -218,15 +212,15 @@ public void PreferencesChanged(Preferences newPreferences, bool isLoadTime, Sett
PreferencesChanged(newPreferences, isLoadTime, flags, null);
}

public void SetCurrentFile(FileViewContext ctx)
public void SetCurrentFile(IFileViewContext ctx)
{
if (ctx != null)
{
_logger.Debug("Current file changed to {0}", ctx.LogView.FileName);
lock (paintLock)
{
logView = ctx.LogView;
logPaintContext = ctx.LogPaintContext;
logPaintContext = (ILogPaintContextUI)ctx.LogPaintContext;
}

SetColumnizer(ctx.LogView.CurrentColumnizer);
Expand Down
3 changes: 1 addition & 2 deletions src/LogExpert.UI/Dialogs/ChooseIconDlg.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using LogExpert.Core.Classes;

using LogExpert.UI.Extensions;
using System.Runtime.Versioning;

namespace LogExpert.UI.Dialogs;
Expand Down
Loading
Loading