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 036fabd commit 7dd7895
Show file tree
Hide file tree
Showing 22 changed files with 135 additions and 113 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
Expand Up @@ -7,9 +7,9 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Analogy.LogViewer.Interfaces" Version="5.0.3" />
<PackageReference Include="Analogy.CommonUtilities" Version="5.0.3" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.7.2" />
<PackageReference Include="Analogy.LogViewer.Interfaces" Version="6.0.0.1" />
<PackageReference Include="Analogy.CommonUtilities" Version="6.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" />
<PackageReference Include="coverlet.collector" Version="6.0.0">
Expand Down
4 changes: 2 additions & 2 deletions Analogy.LogViewer.Github.UnitTests/UnitTest1.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
using Analogy.CommonUtilities.Github;
using Analogy.Interfaces;
using Analogy.LogViewer.Github.DataTypes;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Newtonsoft.Json;
using System.Threading.Tasks;
using Analogy.CommonUtilities.Github;

namespace Analogy.LogViewer.Github.UnitTests
{
Expand All @@ -28,4 +28,4 @@ public async Task TestMethod1()
//var r = JsonConvert.DeserializeObject<GithubReleaseEntry[]>(releases);
}
}
}
}
2 changes: 1 addition & 1 deletion Analogy.LogViewer.Github.UnitTests/Utils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,4 @@ public static async Task<string> GetAsync(string uri)
//}
}
}
}
}
14 changes: 11 additions & 3 deletions Analogy.LogViewer.Github.sln
Original file line number Diff line number Diff line change
@@ -1,11 +1,19 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.29926.136
# Visual Studio Version 17
VisualStudioVersion = 17.8.34309.116
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Analogy.LogViewer.Github", "Analogy.LogViewer.Github\Analogy.LogViewer.Github.csproj", "{6F9F6F8D-E943-4BC1-8E74-9D853F0E6BB2}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Analogy.LogViewer.Github.UnitTests", "Analogy.LogViewer.Github.UnitTests\Analogy.LogViewer.Github.UnitTests.csproj", "{E20C1B88-D4E1-4BCC-AF45-686F3CB988FA}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Analogy.LogViewer.Github.UnitTests", "Analogy.LogViewer.Github.UnitTests\Analogy.LogViewer.Github.UnitTests.csproj", "{E20C1B88-D4E1-4BCC-AF45-686F3CB988FA}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{5BAA8DAD-6A8B-4AB1-A51D-C2D1423F7B31}"
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
Expand Down
45 changes: 8 additions & 37 deletions Analogy.LogViewer.Github/Analogy.LogViewer.Github.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,45 +2,25 @@

<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>
<VersionPrefix>6.0.0</VersionPrefix>
<VersionSuffix></VersionSuffix>
<Authors>Lior Banai</Authors>
<Description>Extension for Analogy Log Viewer that shows Git Histroy in searchable UI</Description>
<Copyright>Lior Banai @ 2020-2023</Copyright>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
<Copyright>Lior Banai @ 2020-2024</Copyright>
<PackageProjectUrl>https://github.com/Analogy-LogViewer/Analogy.LogViewer.Github</PackageProjectUrl>
<RepositoryUrl>https://github.com/Analogy-LogViewer/Analogy.LogViewer.Github</RepositoryUrl>
<RepositoryType>git</RepositoryType>
<PackageIcon>Analogy.GitHistoryBanner.png</PackageIcon>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<VersionPrefix>5.0.3.2</VersionPrefix>
<VersionSuffix></VersionSuffix>
<Nullable>enable</Nullable>
<LangVersion>latest</LangVersion>
<GenerateResourceUsePreserializedResources>true</GenerateResourceUsePreserializedResources>
<Company>Analogy.LogViewer</Company>
</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.SourceLink.GitHub" Version="1.1.1">
<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="Newtonsoft.Json" Version="13.0.3" />
<PackageReference Include="Octokit" Version="9.0.0" />
<PackageReference Include="System.Resources.Extensions" Version="7.0.0" />
<PackageReference Include="System.Resources.Extensions" Version="8.0.0" />
</ItemGroup>

<ItemGroup>
Expand All @@ -64,13 +44,4 @@
<PackagePath></PackagePath>
</None>
</ItemGroup>

<ItemGroup Condition=" '$(TargetFramework)' == 'net48' or '$(TargetFramework)' == 'net471' ">
<Reference Include="System.Net.Http" />
<PackageReference Include="PolySharp" Version="1.13.2">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
</ItemGroup>

</Project>
2 changes: 1 addition & 1 deletion Analogy.LogViewer.Github/DataTypes/RepositorySettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,4 @@ public override string ToString()
return $"{nameof(RepoName)}: {RepoName}";
}
}
}
}
8 changes: 4 additions & 4 deletions Analogy.LogViewer.Github/GitHubActions/GitFetchAction.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using System.Drawing;
using System.Windows.Forms;
using Analogy.Interfaces;
using Analogy.Interfaces;
using Analogy.Interfaces.DataTypes;
using System.Drawing;
using System.Windows.Forms;

namespace Analogy.LogViewer.Github.GitHubActions
{
Expand All @@ -20,4 +20,4 @@ public class GitFetchAction : IAnalogyCustomAction
public AnalogyCustomActionType Type { get; } = AnalogyCustomActionType.BelongsToProvider;
public AnalogyToolTip? ToolTip { get; set; }
}
}
}
2 changes: 1 addition & 1 deletion Analogy.LogViewer.Github/GitOperationsForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ public GitOperationsForm()
InitializeComponent();
}
}
}
}
3 changes: 1 addition & 2 deletions Analogy.LogViewer.Github/GitRepositoriesSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ private void GitRepositoriesSettings_Load(object sender, EventArgs e)
{
RefreshList();
txtbLocalToken.Text = UserSettingsManager.UserSettings.GithubSettings.GitHubToken;

}

private void RefreshList()
Expand Down Expand Up @@ -47,4 +46,4 @@ private void btnLocalToken_Click(object sender, EventArgs e)
UserSettingsManager.UserSettings.GithubSettings.LocalGitHubToken = txtbLocalToken.Text;
}
}
}
}
5 changes: 1 addition & 4 deletions Analogy.LogViewer.Github/GithubSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

namespace Analogy.LogViewer.Github
{

public class GithubSettings
{
public string RegistryGitHubToken { get; set; } = Environment.GetEnvironmentVariable("Analogy.LogViewer.Github_Token");

Check warning on line 8 in Analogy.LogViewer.Github/GithubSettings.cs

View workflow job for this annotation

GitHub Actions / build (Release)

Possible null reference assignment.

Check warning on line 8 in Analogy.LogViewer.Github/GithubSettings.cs

View workflow job for this annotation

GitHub Actions / build (Debug)

Possible null reference assignment.
Expand Down Expand Up @@ -33,7 +32,5 @@ public void DeleteRepository(RepositorySettings repository)
Repositories.Remove(repository);
}
}


}
}
}
2 changes: 1 addition & 1 deletion Analogy.LogViewer.Github/IAnalogy/DownloadInformation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,4 @@ public override string InstalledVersionNumber
}
}
}
}
}
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
using Analogy.LogViewer.Github.Managers;
using Analogy.Interfaces;
using Analogy.LogViewer.Github.Managers;
using Microsoft.Extensions.Logging;
using System.Drawing;
using System.Windows.Forms;
using Analogy.Interfaces;
using Microsoft.Extensions.Logging;

namespace Analogy.LogViewer.Github.IAnalogy
{
Expand All @@ -26,4 +26,4 @@ public override Task SaveSettingsAsync()
return Task.CompletedTask;
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,9 @@ public class GitHubIssuesTrackerFactory : Template.DataProvidersFactory
public override string Title { get; set; } = "Repositories Releases";
public override IEnumerable<IAnalogyDataProvider> DataProviders { get; set; } = GenerateDataProviders();


private static IEnumerable<IAnalogyDataProvider> GenerateDataProviders()
{
yield return new IssuesTracker();
}
}

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ public class GitHubRepositoriesReleasesFactory : Template.DataProvidersFactory
public override string Title { get; set; } = "Repositories Releases";
public override IEnumerable<IAnalogyDataProvider> DataProviders { get; set; } = GenerateDataProviders();


private static IEnumerable<IAnalogyDataProvider> GenerateDataProviders()
{
foreach (var repo in UserSettingsManager.UserSettings.GithubSettings.Repositories.Select(rs =>
Expand All @@ -19,5 +18,4 @@ private static IEnumerable<IAnalogyDataProvider> GenerateDataProviders()
}
}
}

}
}
32 changes: 12 additions & 20 deletions Analogy.LogViewer.Github/IAnalogy/GitRepositoryLoader.cs
Original file line number Diff line number Diff line change
@@ -1,17 +1,16 @@
using Analogy.Interfaces;
using Analogy.LogViewer.Github.Managers;
using System.Drawing;
using System.Threading;
using Analogy.CommonUtilities.Github;
using Analogy.CommonUtilities.Github;
using Analogy.Interfaces;
using Analogy.LogViewer.Github.DataTypes;
using Analogy.LogViewer.Github.Managers;
using Microsoft.Extensions.Logging;
using Octokit;
using System.Drawing;
using System.Threading;

namespace Analogy.LogViewer.Github
{
public class GitRepositoryLoader : Template.OnlineDataProvider
{

public override Guid Id { get; set; } = new Guid("B92CA79D-3621-416E-ADA7-52EEAF243759");

public override Image? ConnectedLargeImage { get; set; }
Expand All @@ -26,10 +25,10 @@ public class GitRepositoryLoader : Template.OnlineDataProvider

private RepositorySettings Repository { get; }
public override bool UseCustomColors { get; set; }
public override IEnumerable<(string originalHeader, string replacementHeader)> GetReplacementHeaders()
=> new List<(string originalHeader, string replacementHeader)> { ("Module", "Downloads"), ("User", "Type"), ("Category", "URL") };
public override IEnumerable<(string OriginalHeader, string ReplacementHeader)> GetReplacementHeaders()
=> new List<(string OriginalHeader, string ReplacementHeader)> { ("Module", "Downloads"), ("User", "Type"), ("Category", "URL") };

public override (Color backgroundColor, Color foregroundColor) GetColorForMessage(IAnalogyLogMessage logMessage)
public override (Color BackgroundColor, Color ForegroundColor) GetColorForMessage(IAnalogyLogMessage logMessage)
=> (Color.Empty, Color.Empty);

private GitHubClient? Client { get; set; }
Expand All @@ -39,10 +38,8 @@ public GitRepositoryLoader(RepositorySettings repo)
{
Repository = repo;
OptionalTitle = "Release for: " + Repository.DisplayName;

}


public override Task StartReceiving()
{
Client = new GitHubClient(new ProductHeaderValue("Analogy.LogViewer.Github"));
Expand Down Expand Up @@ -78,11 +75,10 @@ private async void Fetch(object? state)
Date = entry.PublishedAt?.DateTime ?? DateTime.MinValue,
FileName = entry.Url,
User = "Release",
Module = entry.Assets.Sum(a => a.DownloadCount).ToString()
Module = entry.Assets.Sum(a => a.DownloadCount).ToString(),
};
m.AddOrReplaceAdditionalProperty("Category", entry.HtmlUrl);
MessageReady(this, new AnalogyLogMessageArgs(m, Repository.DisplayName, "Github", Id));

}
int total = releases.SelectMany(e => e.Assets).Sum(a => a.DownloadCount);
AnalogyLogMessage d = new AnalogyLogMessage
Expand All @@ -93,10 +89,9 @@ private async void Fetch(object? state)
Date = DateTime.Now,
FileName = "",
User = "Release",
Module = total.ToString()
Module = total.ToString(),
};
MessageReady(this, new AnalogyLogMessageArgs(d, Repository.DisplayName, "Github", Id));

}
catch (Exception e)
{
Expand All @@ -107,14 +102,11 @@ private async void Fetch(object? state)
Module = Repository.DisplayName,
Text = $"Error: {e}",
Level = AnalogyLogLevel.Error,
Class = AnalogyLogClass.General
Class = AnalogyLogClass.General,
};
MessageReady(this, new AnalogyLogMessageArgs(m, "", "", Id));
}

}
public override Task ShutDown() => Task.CompletedTask;


}
}
}
Loading

0 comments on commit 7dd7895

Please sign in to comment.