Skip to content

Commit

Permalink
NET8
Browse files Browse the repository at this point in the history
  • Loading branch information
LiorBanai committed Nov 16, 2023
1 parent ad52f73 commit 7b9be4d
Show file tree
Hide file tree
Showing 15 changed files with 134 additions and 95 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,19 +1,18 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net7.0-windows</TargetFramework>

<TargetFramework>net8.0-windows</TargetFramework>
<IsPackable>false</IsPackable>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Logging" Version="7.0.0" />
<PackageReference Include="System.Resources.Extensions" Version="7.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="7.0.1" />
<PackageReference Include="Microsoft.Extensions.Configuration" Version="7.0.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.Abstractions" Version="7.0.0" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="7.0.0" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="7.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging" Version="8.0.0" />
<PackageReference Include="System.Resources.Extensions" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.Configuration" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.Abstractions" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="8.0.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.8.0" />
<PackageReference Include="MSTest.TestAdapter" Version="3.1.1" />
<PackageReference Include="MSTest.TestFramework" Version="3.1.1" />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
using System.Collections.Generic;
using Analogy.Interfaces;
using Analogy.Interfaces;
using Analogy.Interfaces.DataTypes;
using System.Collections.Generic;

namespace Analogy.LogViewer.Sqlite.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; }
}
}
}
8 changes: 4 additions & 4 deletions Analogy.LogViewer.Sqlite.UnitTests/UnitTest1.cs
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
using Analogy.LogViewer.Sqlite.IAnalogy;
using Microsoft.Extensions.Logging;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System;
using System.IO;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using Analogy.LogViewer.Sqlite.IAnalogy;
using Microsoft.Extensions.Logging;
using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace Analogy.LogViewer.Sqlite.UnitTests
{
Expand All @@ -27,4 +27,4 @@ public async Task ReadDBTest()
Assert.IsTrue(messages.Count == 389);
}
}
}
}
8 changes: 8 additions & 0 deletions Analogy.LogViewer.Sqlite.sln
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,14 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Analogy.LogViewer.Sqlite",
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Analogy.LogViewer.Sqlite.UnitTests", "Analogy.LogViewer.Sqlite.UnitTests\Analogy.LogViewer.Sqlite.UnitTests.csproj", "{25E3AF53-CBF5-4DD0-8651-C6D0450171C1}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{AA382F98-BCED-40D5-96FE-8CDC3112085D}"
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
48 changes: 9 additions & 39 deletions Analogy.LogViewer.Sqlite/Analogy.LogViewer.Sqlite.csproj
Original file line number Diff line number Diff line change
@@ -1,56 +1,26 @@
<Project Sdk="Microsoft.NET.Sdk.WindowsDesktop">

<PropertyGroup>
<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>
<Version>0.6.1.0</Version>
<TargetFrameworks>net8.0-windows;net7.0-windows;net6.0-windows;net48;net471</TargetFrameworks>
<Version>0.7.0</Version>
<Authors>Lior Banai</Authors>
<Company>Analogy.LogViewer</Company>
<Product>Analogy.LogViewer.Sqlite</Product>
<PackageId>Analogy.LogViewer.Sqlite</PackageId>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<Copyright>Lior Banai © 2023</Copyright>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
<Copyright>Lior Banai © 2023-2024</Copyright>
<PackageProjectUrl>https://github.com/Analogy-LogViewer/Analogy.LogViewer.Sqlite</PackageProjectUrl>
<RepositoryUrl>https://github.com/Analogy-LogViewer/Analogy.LogViewer.Sqlite</RepositoryUrl>
<RepositoryType>git</RepositoryType>
<PackageIcon>icon.png</PackageIcon>
<PackageIconUrl />
<Description>Implementation of Analogy Log Viewer Data Provider for reading sql lite db files</Description>
<PackageReleaseNotes>Implementation of Analogy Log Viewer Data Provider for reading sql lite db files</PackageReleaseNotes>
<GenerateResourceUsePreserializedResources>true</GenerateResourceUsePreserializedResources>
<Nullable>enable</Nullable>
<LangVersion>latest</LangVersion>

</PropertyGroup>

<ItemGroup>
<PackageReference Include="Analogy.LogViewer.Interfaces" Version="5.0.3" />
<PackageReference Include="Analogy.CommonUtilities" 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.Data.Sqlite" Version="7.0.13" />
<PackageReference Include="Microsoft.Data.Sqlite.Core" Version="7.0.13" />
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.1.1">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<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>
<PackageReference Include="Analogy.LogViewer.Interfaces" Version="6.0.0.1" />
<PackageReference Include="Analogy.CommonUtilities" Version="6.0.0" />
<PackageReference Include="Analogy.LogViewer.Template" Version="6.0.0" />
<PackageReference Include="Microsoft.Data.Sqlite" Version="8.0.0" />
<PackageReference Include="Microsoft.Data.Sqlite.Core" Version="8.0.0" />
<PackageReference Include="System.Resources.Extensions" Version="8.0.0" />
</ItemGroup>
<ItemGroup>
<None Include="..\icon.png">
Expand Down
10 changes: 5 additions & 5 deletions Analogy.LogViewer.Sqlite/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.Sqlite.Properties;
using System;
using System.Collections.Generic;
using System.Drawing;
using Analogy.Interfaces;
using Analogy.LogViewer.Sqlite.Properties;

namespace Analogy.LogViewer.Sqlite.IAnalogy
{
Expand All @@ -17,9 +17,9 @@ public class PrimaryFactory : Analogy.LogViewer.Template.PrimaryFactory

public override IEnumerable<IAnalogyChangeLog> ChangeLog { get; set; } = new List<AnalogyChangeLog>
{
new AnalogyChangeLog("Initial version",AnalogChangeLogType.None, "Lior Banai",new DateTime(2023, 03, 03), "")
new AnalogyChangeLog("Initial version", AnalogChangeLogType.None, "Lior Banai", new DateTime(2023, 03, 03), ""),
};
public override IEnumerable<string> Contributors { get; set; } = new List<string> { "Lior Banai" };
public override string About { get; set; } = "Analogy Sqlite Data Provider";
}
}
}
23 changes: 9 additions & 14 deletions Analogy.LogViewer.Sqlite/IAnalogy/SqliteBroswerDataProvider.cs
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
using System;
using Analogy.Interfaces;
using Analogy.LogViewer.Sqlite.Properties;
using Analogy.LogViewer.Template.Managers;
using Microsoft.Data.Sqlite;
using Microsoft.Extensions.Logging;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Data;
using System.Drawing;
using System.Threading;
using System.Threading.Tasks;
using Analogy.Interfaces;
using Analogy.LogViewer.Sqlite.Properties;
using Analogy.LogViewer.Template.Managers;
using Microsoft.Data.Sqlite;
using Microsoft.Extensions.Logging;

namespace Analogy.LogViewer.Sqlite.IAnalogy
{
Expand All @@ -23,10 +23,9 @@ public class SqliteBroswerDataProvider : Template.OfflineDataProvider
public override string FileOpenDialogFilters { get; set; } = "sqlite db file (*.db)|*.db";
public override IEnumerable<string> SupportFormats { get; set; } = new[] { "*.db" };
public override string? InitialFolderFullPath { get; set; } = Environment.CurrentDirectory;
public override IEnumerable<(string originalHeader, string replacementHeader)> GetReplacementHeaders()
public override IEnumerable<(string OriginalHeader, string ReplacementHeader)> GetReplacementHeaders()
=> Array.Empty<(string, string)>();


public override Task InitializeDataProvider(ILogger logger)
{
//do some initialization for this provider
Expand All @@ -52,7 +51,6 @@ public override IEnumerable<AnalogyLogMessagePropertyName> HideExistingColumns()
yield return AnalogyLogMessagePropertyName.Id;
}


public override void MessageOpened(IAnalogyLogMessage message)
{
//nop
Expand All @@ -63,6 +61,7 @@ public override async Task<IEnumerable<IAnalogyLogMessage>> Process(string fileN
using (var conn = new SqliteConnection($"Data Source={fileName};Mode=readonly"))
{
await conn.OpenAsync(token);

Check warning on line 64 in Analogy.LogViewer.Sqlite/IAnalogy/SqliteBroswerDataProvider.cs

View workflow job for this annotation

GitHub Actions / build (Release)

Check warning on line 64 in Analogy.LogViewer.Sqlite/IAnalogy/SqliteBroswerDataProvider.cs

View workflow job for this annotation

GitHub Actions / build (Debug)

Check warning on line 64 in Analogy.LogViewer.Sqlite/IAnalogy/SqliteBroswerDataProvider.cs

View workflow job for this annotation

GitHub Actions / build (Debug)

// executes query that select names of all tables in master table of the database
string query = "SELECT name FROM sqlite_master " +
"WHERE type = 'table'" +
Expand All @@ -77,9 +76,7 @@ public override async Task<IEnumerable<IAnalogyLogMessage>> Process(string fileN
{
dt.Load(rdr);
}

}

DataTable dtData = new DataTable();
foreach (DataRow row in dt.Rows)
{
Expand Down Expand Up @@ -110,9 +107,7 @@ public override async Task<IEnumerable<IAnalogyLogMessage>> Process(string fileN
}
messages.Add(m);
messagesHandler.AppendMessage(m, fileName);

}

return messages;
}

Expand All @@ -125,4 +120,4 @@ public override async Task<IEnumerable<IAnalogyLogMessage>> Process(string fileN
}
}
}
}
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using System;
using System.Collections.Generic;
using Analogy.Interfaces;
using Analogy.Interfaces;
using Analogy.LogViewer.Template;
using System;
using System.Collections.Generic;

namespace Analogy.LogViewer.Sqlite.IAnalogy
{
Expand All @@ -15,4 +15,4 @@ public class SqliteDataProviderFactory : DataProvidersFactory
new SqliteBroswerDataProvider(),
};
}
}
}
15 changes: 6 additions & 9 deletions Analogy.LogViewer.Sqlite/IAnalogy/SqliteUserSettingsFactory.cs
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
using System;
using System.Drawing;
using System.Threading.Tasks;
using System.Windows.Forms;
using Analogy.Interfaces;
using Analogy.Interfaces;
using Analogy.Interfaces.DataTypes;
using Analogy.LogViewer.Sqlite.Properties;
using Analogy.LogViewer.Template;
using Microsoft.Extensions.Logging;
using System;
using System.Drawing;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace Analogy.LogViewer.Sqlite.IAnalogy
{
Expand All @@ -19,7 +19,6 @@ public class SqliteUserSettingsFactory : TemplateUserSettingsFactory
public override Image? SmallImage { get; set; } = Resources.Analogy_image_16x16;
public override Image? LargeImage { get; set; } = Resources.Analogy_image_32x32;


public override AnalogyToolTip? ToolTip { get; set; } = new AnalogyToolTip("Sqlite dB", "",
"", Resources.Analogy_image_16x16, Resources.Analogy_image_32x32);

Expand All @@ -32,7 +31,5 @@ public override Task SaveSettingsAsync()
{
return Task.CompletedTask;
}


}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,5 @@ public override string InstalledVersionNumber
public override string? LatestVersionNumber { get; set; }
public override TargetFrameworkAttribute CurrentFrameworkAttribute { get; set; } = (TargetFrameworkAttribute)Assembly.GetExecutingAssembly().GetCustomAttribute(typeof(TargetFrameworkAttribute));

Check warning on line 33 in Analogy.LogViewer.Sqlite/IAnalogy/sqliteDownloadInformation.cs

View workflow job for this annotation

GitHub Actions / build (Release)

Converting null literal or possible null value to non-nullable type.

Check warning on line 33 in Analogy.LogViewer.Sqlite/IAnalogy/sqliteDownloadInformation.cs

View workflow job for this annotation

GitHub Actions / build (Release)

Possible null reference assignment.

Check warning on line 33 in Analogy.LogViewer.Sqlite/IAnalogy/sqliteDownloadInformation.cs

View workflow job for this annotation

GitHub Actions / build (Release)

Converting null literal or possible null value to non-nullable type.

Check warning on line 33 in Analogy.LogViewer.Sqlite/IAnalogy/sqliteDownloadInformation.cs

View workflow job for this annotation

GitHub Actions / build (Release)

Converting null literal or possible null value to non-nullable type.

Check warning on line 33 in Analogy.LogViewer.Sqlite/IAnalogy/sqliteDownloadInformation.cs

View workflow job for this annotation

GitHub Actions / build (Release)

Possible null reference assignment.

Check warning on line 33 in Analogy.LogViewer.Sqlite/IAnalogy/sqliteDownloadInformation.cs

View workflow job for this annotation

GitHub Actions / build (Debug)

Converting null literal or possible null value to non-nullable type.

Check warning on line 33 in Analogy.LogViewer.Sqlite/IAnalogy/sqliteDownloadInformation.cs

View workflow job for this annotation

GitHub Actions / build (Debug)

Possible null reference assignment.
protected override string RepositoryURL { get; set; } = "https://api.github.com/repos/Analogy-LogViewer/Analogy.LogViewer.Sqlite";

}
}
}
2 changes: 1 addition & 1 deletion Analogy.LogViewer.Sqlite/IAnalogy/sqlitePolicyEnforcer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ public class sqlitePolicyEnforcer : Template.AnalogyPolicyEnforcer
{
public override bool DisableUpdates { get; set; }
}
}
}
9 changes: 9 additions & 0 deletions BannedSymbols.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#https://github.com/dotnet/csharplang/blob/main/spec/documentation-comments.md#id-string-format

M:System.String.ToLower;Use ToLowerInvariant instead
M:System.String.ToUpper;Use ToUpperInvariant instead

F:System.StringComparison.CurrentCulture;Consider using Ordinal
F:System.StringComparison.CurrentCultureIgnoreCase;Consider using OrdinalIgnoreCase
F:System.StringComparison.InvariantCurrent;Consider using Ordinal
F:System.StringComparison.InvariantCurrentIgnoreCase;Consider using OrdinalIgnoreCase
Loading

0 comments on commit 7b9be4d

Please sign in to comment.