Skip to content
This repository has been archived by the owner on Jun 2, 2024. It is now read-only.

Commit

Permalink
NET8
Browse files Browse the repository at this point in the history
  • Loading branch information
LiorBanai committed Nov 16, 2023
1 parent 1a53a94 commit 0f002a4
Show file tree
Hide file tree
Showing 20 changed files with 132 additions and 94 deletions.
1 change: 1 addition & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,7 @@ dotnet_diagnostic.SA1122.severity = suggestion
dotnet_diagnostic.SA1108.severity = silent
dotnet_diagnostic.SA1012.severity = error
dotnet_diagnostic.SA1500.severity = error
dotnet_diagnostic.SA1316.severity = error

[*.{cs,vb}]
dotnet_style_operator_placement_when_wrapping = beginning_of_line
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/dotnet-core-desktop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,13 @@ jobs:

# Install the .NET Core workload
- name: Install .NET Core
uses: actions/setup-dotnet@v3.0.3
uses: actions/setup-dotnet@v3.2.0
with:
dotnet-version: 7.0.x
dotnet-version: 8.0.x

# Add MSBuild to the PATH: https://github.com/microsoft/setup-msbuild
- name: Setup MSBuild.exe
uses: microsoft/setup-msbuild@v1.1.3
uses: microsoft/setup-msbuild@v1.3.1

# Restore the application to populate the obj folder with RuntimeIdentifiers
- name: Restore the application
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net6.0-windows</TargetFramework>
<TargetFramework>net8.0-windows</TargetFramework>

<IsPackable>false</IsPackable>
</PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

namespace Analogy.LogViewer.PowerToys.UnitTests
{
class MessageHandlerForTesting : ILogMessageCreatedHandler
public class MessageHandlerForTesting : ILogMessageCreatedHandler
{
private List<IAnalogyLogMessage> messages;
public MessageHandlerForTesting()
Expand All @@ -29,4 +29,4 @@ public void ReportFileReadProgress(AnalogyFileReadProgress progress)
public bool ForceNoFileCaching { get; set; }
public bool DoNotAddToRecentHistory { get; set; }
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
namespace Analogy.LogViewer.PowerToys.UnitTests
{
[TestClass]
public class UnitTests
public class Tests
{
[TestMethod]
public async Task TestMethod1()
Expand All @@ -16,8 +16,6 @@ public async Task TestMethod1()
await parser.InitializeDataProvider(null);
var results = await parser.Process("2020-10-03.txt", new CancellationToken(), new MessageHandlerForTesting());
Assert.IsTrue(results.Count() == 61);


}
}
}
}
12 changes: 10 additions & 2 deletions Analogy.LogViewer.PowerToys.sln
Original file line number Diff line number Diff line change
@@ -1,12 +1,20 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.30517.126
# Visual Studio Version 17
VisualStudioVersion = 17.8.34309.116
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Analogy.LogViewer.PowerToys", "Analogy.LogViewer.PowerToys\Analogy.LogViewer.PowerToys.csproj", "{EAF4F4EA-619E-4F93-8394-DCE68564FEE3}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Analogy.LogViewer.PowerToys.UnitTests", "Analogy.LogViewer.PowerToys.UnitTests\Analogy.LogViewer.PowerToys.UnitTests.csproj", "{566038EC-6A3E-4B13-AD8B-FB17A02337CB}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{B27D6FFC-0C5C-4878-977D-40BD42F7C184}"
ProjectSection(SolutionItems) = preProject
.editorconfig = .editorconfig
Directory.Build.props = Directory.Build.props
.github\workflows\dotnet-core-desktop.yml = .github\workflows\dotnet-core-desktop.yml
nuget.config = nuget.config
EndProjectSection
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down
34 changes: 3 additions & 31 deletions Analogy.LogViewer.PowerToys/Analogy.LogViewer.PowerToys.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,29 +2,16 @@

<PropertyGroup>
<OutputType>Library</OutputType>
<TargetFrameworks>net7.0-windows;net6.0-windows;net48;net471</TargetFrameworks>
<UseWindowsForms>true</UseWindowsForms>
<PublishRepositoryUrl>true</PublishRepositoryUrl>
<IncludeSymbols>true</IncludeSymbols>
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
<EmbedUntrackedSources>true</EmbedUntrackedSources>
<ContinuousIntegrationBuild>true</ContinuousIntegrationBuild>
<TargetFrameworks>net8.0-windows;net7.0-windows;net6.0-windows;net48;net471</TargetFrameworks>
<Authors>Lior Banai</Authors>
<Description>Analogy PowerToys log parser</Description>
<Copyright>Lior Banai © 2020-2023</Copyright>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
<Copyright>Lior Banai © 2020-2024</Copyright>
<PackageProjectUrl>https://github.com/Analogy-LogViewer/Analogy.LogViewer.PowerToys</PackageProjectUrl>
<RepositoryUrl>https://github.com/Analogy-LogViewer/Analogy.LogViewer.PowerToys</RepositoryUrl>
<RepositoryType>git</RepositoryType>
<PackageReleaseNotes>Analogy PowerToys log parser</PackageReleaseNotes>
<PackageIconUrl />
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<Version>0.15.0</Version>
<Version>0.16.0</Version>
<Company>Analogy.LogViewer</Company>
<GenerateResourceUsePreserializedResources>true</GenerateResourceUsePreserializedResources>
<PackageIcon>AnalogyPowerToys.png</PackageIcon>
<Nullable>enable</Nullable>
<LangVersion>latest</LangVersion>
</PropertyGroup>

<ItemGroup>
Expand All @@ -41,24 +28,9 @@
<PackageReference Include="Analogy.LogViewer.Interfaces" Version="5.0.3" />
<PackageReference Include="Analogy.LogViewer.RegexParser" Version="5.0.3" />
<PackageReference Include="Analogy.LogViewer.Template" Version="5.0.3" />
<PackageReference Include="Microsoft.Build.Tasks.Git" Version="1.1.1">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.1.1">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
<PackageReference Include="System.Resources.Extensions" Version="7.0.0" />
</ItemGroup>
<ItemGroup Condition=" '$(TargetFramework)' == 'net48' or '$(TargetFramework)' == 'net471' ">
<PackageReference Include="PolySharp" Version="1.13.2">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
</ItemGroup>

<ItemGroup>
<Compile Update="Properties\Resources.Designer.cs">
<DesignTime>True</DesignTime>
Expand Down
13 changes: 7 additions & 6 deletions Analogy.LogViewer.PowerToys/ChangeLogList.cs
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
using System;
using Analogy.Interfaces;
using System;
using System.Collections.Generic;
using Analogy.Interfaces;

namespace Analogy.LogViewer.PowerToys
{
static class ChangeLogList
public static class ChangeLogList
{
public static IEnumerable<AnalogyChangeLog> GetChangeLog()
{
return new List<AnalogyChangeLog>{
new AnalogyChangeLog("Initial version", AnalogChangeLogType.None, "Lior Banai", new DateTime(2020, 10, 03), "")
return new List<AnalogyChangeLog>
{
new AnalogyChangeLog("Initial version", AnalogChangeLogType.None, "Lior Banai", new DateTime(2020, 10, 03), ""),
};
}
}
}
}
8 changes: 4 additions & 4 deletions Analogy.LogViewer.PowerToys/IAnalogy/DataProvidersFactory.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using System;
using Analogy.Interfaces;
using System;
using System.Collections.Generic;
using Analogy.Interfaces;

namespace Analogy.LogViewer.PowerToys.IAnalogy
{
Expand All @@ -11,7 +11,7 @@ public class DataProvidersFactory : LogViewer.Template.DataProvidersFactory
public override IEnumerable<IAnalogyDataProvider> DataProviders { get; set; } = new List<IAnalogyDataProvider>
{
//new PowerToysRegexOfflineDataProvider(),
new OfflineDataProvider()
new OfflineDataProvider(),
};
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,4 @@ public override string InstalledVersionNumber
}
}
}
}
}
14 changes: 7 additions & 7 deletions Analogy.LogViewer.PowerToys/IAnalogy/OfflineDataProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,20 +27,20 @@ public OfflineDataProvider()
LogParserSettings = new SplitterLogParserSettings
{
Splitter = "|",
SupportedFilesExtensions = new List<string> {"*.txt"},
SupportedFilesExtensions = new List<string> { "*.txt"},
Maps = new Dictionary<int, AnalogyLogMessagePropertyName>
{
{0, AnalogyLogMessagePropertyName.Date},
{1, AnalogyLogMessagePropertyName.Level},
{2, AnalogyLogMessagePropertyName.Source},
{3, AnalogyLogMessagePropertyName.Text}
{ 0, AnalogyLogMessagePropertyName.Date},
{ 1, AnalogyLogMessagePropertyName.Level},
{ 2, AnalogyLogMessagePropertyName.Source},
{ 3, AnalogyLogMessagePropertyName.Text},
},
IsConfigured = true
IsConfigured = true,
};
parser = new PlainTextLogFileLoader(LogParserSettings);
}
public override Task<IEnumerable<IAnalogyLogMessage>> Process(string fileName, CancellationToken token,
ILogMessageCreatedHandler messagesHandler)
=> parser.Process(fileName, token, messagesHandler);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ public class PowerToysRegexOfflineDataProvider : RegexOfflineDataProvider
public override Image? LargeImage { get; set; }

Check warning on line 20 in Analogy.LogViewer.PowerToys/IAnalogy/PowerToysRegexOfflineDataProvider.cs

View workflow job for this annotation

GitHub Actions / build (Release)

Nullability of return type doesn't match overridden member (possibly because of nullability attributes).

Check warning on line 20 in Analogy.LogViewer.PowerToys/IAnalogy/PowerToysRegexOfflineDataProvider.cs

View workflow job for this annotation

GitHub Actions / build (Release)

Nullability of return type doesn't match overridden member (possibly because of nullability attributes).

Check warning on line 20 in Analogy.LogViewer.PowerToys/IAnalogy/PowerToysRegexOfflineDataProvider.cs

View workflow job for this annotation

GitHub Actions / build (Release)

Nullability of return type doesn't match overridden member (possibly because of nullability attributes).

Check warning on line 20 in Analogy.LogViewer.PowerToys/IAnalogy/PowerToysRegexOfflineDataProvider.cs

View workflow job for this annotation

GitHub Actions / build (Release)

Nullability of return type doesn't match overridden member (possibly because of nullability attributes).

Check warning on line 20 in Analogy.LogViewer.PowerToys/IAnalogy/PowerToysRegexOfflineDataProvider.cs

View workflow job for this annotation

GitHub Actions / build (Debug)

Nullability of return type doesn't match overridden member (possibly because of nullability attributes).

Check warning on line 20 in Analogy.LogViewer.PowerToys/IAnalogy/PowerToysRegexOfflineDataProvider.cs

View workflow job for this annotation

GitHub Actions / build (Debug)

Nullability of return type doesn't match overridden member (possibly because of nullability attributes).

Check warning on line 20 in Analogy.LogViewer.PowerToys/IAnalogy/PowerToysRegexOfflineDataProvider.cs

View workflow job for this annotation

GitHub Actions / build (Debug)

Nullability of return type doesn't match overridden member (possibly because of nullability attributes).
public override Image? SmallImage { get; set; }

Check warning on line 21 in Analogy.LogViewer.PowerToys/IAnalogy/PowerToysRegexOfflineDataProvider.cs

View workflow job for this annotation

GitHub Actions / build (Release)

Nullability of return type doesn't match overridden member (possibly because of nullability attributes).

Check warning on line 21 in Analogy.LogViewer.PowerToys/IAnalogy/PowerToysRegexOfflineDataProvider.cs

View workflow job for this annotation

GitHub Actions / build (Release)

Nullability of return type doesn't match overridden member (possibly because of nullability attributes).

Check warning on line 21 in Analogy.LogViewer.PowerToys/IAnalogy/PowerToysRegexOfflineDataProvider.cs

View workflow job for this annotation

GitHub Actions / build (Release)

Nullability of return type doesn't match overridden member (possibly because of nullability attributes).

Check warning on line 21 in Analogy.LogViewer.PowerToys/IAnalogy/PowerToysRegexOfflineDataProvider.cs

View workflow job for this annotation

GitHub Actions / build (Release)

Nullability of return type doesn't match overridden member (possibly because of nullability attributes).

Check warning on line 21 in Analogy.LogViewer.PowerToys/IAnalogy/PowerToysRegexOfflineDataProvider.cs

View workflow job for this annotation

GitHub Actions / build (Debug)

Nullability of return type doesn't match overridden member (possibly because of nullability attributes).

Check warning on line 21 in Analogy.LogViewer.PowerToys/IAnalogy/PowerToysRegexOfflineDataProvider.cs

View workflow job for this annotation

GitHub Actions / build (Debug)

Nullability of return type doesn't match overridden member (possibly because of nullability attributes).

Check warning on line 21 in Analogy.LogViewer.PowerToys/IAnalogy/PowerToysRegexOfflineDataProvider.cs

View workflow job for this annotation

GitHub Actions / build (Debug)

Nullability of return type doesn't match overridden member (possibly because of nullability attributes).


public override Task InitializeDataProvider(ILogger logger)
{
RegexParser.Managers.UserSettingsManager.UserSettings.Settings.FileOpenDialogFilters = "Plain log text file (*.txt)|*.txt";
Expand Down Expand Up @@ -56,7 +55,6 @@ public RemoveLeadingNewLine(ILogMessageCreatedHandler nominalMessagesHandler)
DoNotAddToRecentHistory = _messagesHandler.DoNotAddToRecentHistory;
}


public void AppendMessage(IAnalogyLogMessage message, string dataSource)
{
if (message.Text.StartsWith(Environment.NewLine))

Check warning on line 60 in Analogy.LogViewer.PowerToys/IAnalogy/PowerToysRegexOfflineDataProvider.cs

View workflow job for this annotation

GitHub Actions / build (Release)

Dereference of a possibly null reference.

Check warning on line 60 in Analogy.LogViewer.PowerToys/IAnalogy/PowerToysRegexOfflineDataProvider.cs

View workflow job for this annotation

GitHub Actions / build (Debug)

Dereference of a possibly null reference.

Check warning on line 60 in Analogy.LogViewer.PowerToys/IAnalogy/PowerToysRegexOfflineDataProvider.cs

View workflow job for this annotation

GitHub Actions / build (Debug)

Dereference of a possibly null reference.

Check warning on line 60 in Analogy.LogViewer.PowerToys/IAnalogy/PowerToysRegexOfflineDataProvider.cs

View workflow job for this annotation

GitHub Actions / build (Debug)

Dereference of a possibly null reference.
Expand All @@ -78,7 +76,6 @@ public void AppendMessages(List<IAnalogyLogMessage> messages, string dataSource)

_messagesHandler.AppendMessages(messages, dataSource);
}

}
}
}
}
10 changes: 4 additions & 6 deletions Analogy.LogViewer.PowerToys/IAnalogy/PrimaryFactory.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
using System;
using Analogy.Interfaces;
using Analogy.LogViewer.PowerToys.Properties;
using System;
using System.Collections.Generic;
using System.Drawing;
using Analogy.Interfaces;
using Analogy.LogViewer.PowerToys.Properties;

namespace Analogy.LogViewer.PowerToys.IAnalogy
{
Expand All @@ -16,7 +16,5 @@ public class PrimaryFactory : Analogy.LogViewer.Template.PrimaryFactory
public override string About { get; set; } = "Analogy Log Parser for Microsoft PowerToys";
public override Image? SmallImage { get; set; } = Resources.powertoys16x16;
public override Image? LargeImage { get; set; } = Resources.powertoys32x32;


}
}
}
13 changes: 4 additions & 9 deletions Analogy.LogViewer.PowerToys/Managers/UserSettingsManager.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
using System;
using System.IO;
using Analogy.LogViewer.Template.Managers;
using Analogy.LogViewer.Template.Managers;
using Microsoft.Extensions.Logging;
using Newtonsoft.Json;
using System;
using System.IO;

namespace Analogy.LogViewer.PowerToys.Managers
{
Expand All @@ -14,7 +14,6 @@ public class UserSettingsManager
public string PowerToysSettingsFileSetting { get; private set; } = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "Analogy.LogViewer", "AnalogyPowerToysSettings.json");
public PowerToysSettings Settings { get; set; }


public UserSettingsManager()
{
if (File.Exists(PowerToysSettingsFileSetting))
Expand All @@ -23,7 +22,7 @@ public UserSettingsManager()
{
var settings = new JsonSerializerSettings
{
ObjectCreationHandling = ObjectCreationHandling.Replace
ObjectCreationHandling = ObjectCreationHandling.Replace,
};
string data = File.ReadAllText(PowerToysSettingsFileSetting);
Settings = JsonConvert.DeserializeObject<PowerToysSettings>(data, settings)!;
Expand All @@ -32,14 +31,12 @@ public UserSettingsManager()
{
LogManager.Instance.LogError(ex, "Error loading user setting file", ex, "Analogy Power Toys Settings");
Settings = new PowerToysSettings();

}
}
else
{
Settings = new PowerToysSettings();
}

}

public void Save()
Expand All @@ -52,8 +49,6 @@ public void Save()
{
LogManager.Instance.LogError(e, "Error saving settings: " + e.Message, e, "Analogy Power Toys Settings");
}


}
}
}
10 changes: 5 additions & 5 deletions Analogy.LogViewer.PowerToys/Parser/PlainLogFileParser.cs
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
using System;
using Analogy.Interfaces;
using Analogy.Interfaces.DataTypes;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Text;
using Analogy.Interfaces;
using Analogy.Interfaces.DataTypes;

namespace Analogy.LogViewer.PowerToys.Parser
{
class PlainLogFileParser
public class PlainLogFileParser
{
private readonly ISplitterLogParserSettings _logFileSettings;
public readonly string[] splitters;
Expand All @@ -34,4 +34,4 @@ public AnalogyLogMessage Parse(string line)
return AnalogyLogMessage.Parse(map);
}
}
}
}
Loading

0 comments on commit 0f002a4

Please sign in to comment.