Skip to content

Commit

Permalink
NET8
Browse files Browse the repository at this point in the history
  • Loading branch information
LiorBanai committed Nov 15, 2023
1 parent 7deebf7 commit 9741a26
Show file tree
Hide file tree
Showing 25 changed files with 132 additions and 101 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
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
<Project Sdk="Microsoft.NET.Sdk">

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

<IsPackable>false</IsPackable>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.7.2" />
<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
2 changes: 1 addition & 1 deletion Analogy.CommonUtilities.UnitTests/UnitTest1.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ public void TestMethod1()
{
}
}
}
}
1 change: 1 addition & 0 deletions Analogy.CommonUtilities.sln
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{E6DDDA7B-41A7-4688-8D71-4DA31D1A5C68}"
ProjectSection(SolutionItems) = preProject
.editorconfig = .editorconfig
Directory.Build.props = Directory.Build.props
.github\workflows\dotnet-core-desktop.yml = .github\workflows\dotnet-core-desktop.yml
EndProjectSection
EndProject
Expand Down
22 changes: 4 additions & 18 deletions Analogy.CommonUtilities/Analogy.CommonUtilities.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<OutputType>Library</OutputType>
<TargetFrameworks>net7.0-windows;net6.0-windows;net48;net471</TargetFrameworks>
<TargetFrameworks>net8.0-windows;net7.0-windows;net6.0-windows;net48;net471</TargetFrameworks>
<UseWindowsForms>true</UseWindowsForms>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<PublishRepositoryUrl>true</PublishRepositoryUrl>
Expand All @@ -12,13 +12,13 @@
<ContinuousIntegrationBuild>true</ContinuousIntegrationBuild>
<Authors>Lior Banai</Authors>
<Company>Analogy.LogViewer</Company>
<Copyright>Lior Banai © 2020-2023</Copyright>
<Copyright>Lior Banai © 2020-2024</Copyright>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
<PackageProjectUrl>https://github.com/Analogy-LogViewer/Analogy.CommonUtilities</PackageProjectUrl>
<RepositoryUrl>https://github.com/Analogy-LogViewer/Analogy.CommonUtilities</RepositoryUrl>
<RepositoryType>git</RepositoryType>
<PackageIcon>icon.png</PackageIcon>
<VersionPrefix>5.0.3.0</VersionPrefix>
<VersionPrefix>6.0.0.0</VersionPrefix>
<VersionSuffix></VersionSuffix>
<Nullable>enable</Nullable>
<LangVersion>latest</LangVersion>
Expand All @@ -31,23 +31,9 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Analogy.LogViewer.Interfaces" 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="Newtonsoft.Json" Version="13.0.3" />
</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>
<None Include="..\Assets\icon.png">
<Pack>True</Pack>
Expand Down
6 changes: 0 additions & 6 deletions Analogy.CommonUtilities/DataProviders/RegexDataProvider.cs

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,4 @@ public static bool Contains(this IEnumerable<string> source, string toCheck, Str
source.Any(itm => itm.Contains(toCheck, comp));
}
}
}
}
2 changes: 1 addition & 1 deletion Analogy.CommonUtilities/Files/FilesPatternMatcher.cs
Original file line number Diff line number Diff line change
Expand Up @@ -182,4 +182,4 @@ public static bool StrictMatchPattern(string expression, string name)
return (num9 == num8);
}
}
}
}
3 changes: 1 addition & 2 deletions Analogy.CommonUtilities/Github/GitHubComment.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,8 @@ public class GitHubComment
[JsonProperty("body")] public string Body { get; set; }
}


public class GitHubComments
{
private GitHubComment[] Comments { get; set; }
}
}
}
1 change: 0 additions & 1 deletion Analogy.CommonUtilities/Github/GitHubCommit.cs
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ public class Verification
[JsonProperty("payload")] public string Payload { get; set; }

Check warning on line 53 in Analogy.CommonUtilities/Github/GitHubCommit.cs

View workflow job for this annotation

GitHub Actions / build (Release)

Non-nullable property 'Payload' must contain a non-null value when exiting constructor. Consider declaring the property as nullable.

Check warning on line 53 in Analogy.CommonUtilities/Github/GitHubCommit.cs

View workflow job for this annotation

GitHub Actions / build (Debug)

Non-nullable property 'Payload' must contain a non-null value when exiting constructor. Consider declaring the property as nullable.
}


public class Parent
{
[JsonProperty("sha")] public string Sha { get; set; }

Check warning on line 58 in Analogy.CommonUtilities/Github/GitHubCommit.cs

View workflow job for this annotation

GitHub Actions / build (Release)

Non-nullable property 'Sha' must contain a non-null value when exiting constructor. Consider declaring the property as nullable.

Check warning on line 58 in Analogy.CommonUtilities/Github/GitHubCommit.cs

View workflow job for this annotation

GitHub Actions / build (Debug)

Non-nullable property 'Sha' must contain a non-null value when exiting constructor. Consider declaring the property as nullable.

Check warning on line 58 in Analogy.CommonUtilities/Github/GitHubCommit.cs

View workflow job for this annotation

GitHub Actions / build (Debug)

Non-nullable property 'Sha' must contain a non-null value when exiting constructor. Consider declaring the property as nullable.
Expand Down
3 changes: 1 addition & 2 deletions Analogy.CommonUtilities/Github/GitHubIssue.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ public class GitHubIssue
[JsonProperty("pull_request")] public GitHubPullRequest PullRequest { get; set; }
}


public class GitHubPullRequest
{
[JsonProperty("url")] public string Url { get; set; }
Expand All @@ -55,4 +54,4 @@ public class GitHubLabel
[JsonProperty("_default")] public bool Default { get; set; }
[JsonProperty("description")] public string Description { get; set; }
}
}
}
18 changes: 9 additions & 9 deletions Analogy.CommonUtilities/Github/GitHubRateLimit.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
using Newtonsoft.Json;


namespace Analogy.CommonUtilities.Github
{
[Serializable]
Expand All @@ -9,16 +8,17 @@ public class GitHubRateLimit
{
[JsonProperty("resources")] public GitHubResources Resources { get; set; }
[JsonProperty("rate")] public GitHubRate Rate { get; set; }


}

public class GitHubRate
{
public int limit { get; set; }
public int used { get; set; }
public int remaining { get; set; }
public int reset { get; set; }
[JsonProperty("limit")]
public int Limit { get; set; }
[JsonProperty("used")]
public int Used { get; set; }
[JsonProperty("remaining")]
public int Remaining { get; set; }
[JsonProperty("reset")]
public int Reset { get; set; }
}

}
}
2 changes: 1 addition & 1 deletion Analogy.CommonUtilities/Github/GitHubRepository.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,4 @@ internal void OnDeserializedMethod(StreamingContext context)
ApiCommitsUrl = ApiCommitsUrl.Replace(@"{/sha}", "");
}
}
}
}
3 changes: 1 addition & 2 deletions Analogy.CommonUtilities/Github/GitHubResources.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
using Newtonsoft.Json;


namespace Analogy.CommonUtilities.Github
{
[Serializable]
Expand All @@ -12,4 +11,4 @@ public class GitHubResources
[JsonProperty("integration_manifest")] public GitHubRate IntegrationManifest { get; set; }
[JsonProperty("search")] public GitHubRate Search { get; set; }
}
}
}
2 changes: 1 addition & 1 deletion Analogy.CommonUtilities/Github/GitHubTrafficView.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,4 @@ public class GitHubClone
public int count { get; set; }
public int uniques { get; set; }
}
}
}
4 changes: 1 addition & 3 deletions Analogy.CommonUtilities/Github/GitHubUserNotification.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

namespace Analogy.CommonUtilities.Github
{

[Serializable]
[JsonObject]
public class GitHubUserNotification
Expand All @@ -22,7 +21,6 @@ public class GitHubNotificationSubject
[JsonProperty("url")] public string URL { get; set; }
[JsonProperty("type")] public string Type { get; set; }
[JsonProperty("latest_comment_url")] public string LatestCommentUrl { get; set; }

}

[Serializable]
Expand All @@ -36,4 +34,4 @@ public class GitHubNotificationRepository
[JsonProperty("description")] public string RepositoryDescription { get; set; }
[JsonProperty("url")] public string Url { get; set; }
}
}
}
23 changes: 8 additions & 15 deletions Analogy.CommonUtilities/Github/GitHubUtils.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
using System.Net;
using Newtonsoft.Json;
using Newtonsoft.Json;
using System.Net;

namespace Analogy.CommonUtilities.Github
{
Expand All @@ -10,7 +10,7 @@ public class GitHubUtils
public static async Task<GitHubRateLimit> GetRateLimit(string? token, string? userAgent)
{
var data = await GetAsync<GitHubRateLimit>("https://api.github.com/rate_limit", token, userAgent, DateTime.Now);
return data.result;
return data.Result;
}
public static async Task<List<GitHubRepository>> GetForks(GitHubRepository repo, string? gitHubToken, string? userAgent)
{
Expand All @@ -20,23 +20,20 @@ public static async Task<List<GitHubRepository>> GetForks(GitHubRepository repo,
}
private static async Task GetForks(GitHubRepository repo, string? gitHubToken, string? userAgent, List<GitHubRepository> repos)
{

List<GitHubRepository> forks = new List<GitHubRepository>();
int page = 1;
bool hasMore = true;
while (hasMore)
{
var forksData = await GetAsync<GitHubRepository[]>(repo.ForksUrl + "?per_page=100&page=" + page, gitHubToken, userAgent, DateTime.MinValue);
if (forksData.result != null)
if (forksData.Result != null)
{


foreach (var fork in forksData.result)
foreach (var fork in forksData.Result)
{
forks.Add(fork);
}
}
hasMore = forksData.result is { Length: 100 };
hasMore = forksData.Result is { Length: 100 };

page++;
}
Expand All @@ -50,8 +47,7 @@ private static async Task GetForks(GitHubRepository repo, string? gitHubToken, s
}
}


public static async Task<(bool newData, T result)> GetAsync<T>(string uri, string? token, string? userAgent, DateTime lastModified)
public static async Task<(bool NewData, T Result)> GetAsync<T>(string uri, string? token, string? userAgent, DateTime lastModified)
{
try
{
Expand Down Expand Up @@ -104,8 +100,5 @@ private static async Task GetForks(GitHubRepository repo, string? gitHubToken, s
return (false, default);
}
}



}
}
}
2 changes: 1 addition & 1 deletion Analogy.CommonUtilities/Github/GithubAsset.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,4 @@ public class GithubAsset

public override string ToString() => $"Asset Name: {Name}, URL: {URL}, Size: {Size}, Downloads: {Downloads}, Created: {Created}";
}
}
}
2 changes: 1 addition & 1 deletion Analogy.CommonUtilities/Github/GithubReleaseEntry.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,4 +47,4 @@ public override string ToString()
return $"{TagName + Environment.NewLine}{nameof(Title)}: {Title}, {nameof(Content)}: {Content + Environment.NewLine}";
}
}
}
}
3 changes: 1 addition & 2 deletions Analogy.CommonUtilities/Github/GithubUser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,5 @@ public class GitHubUser
public string Type { get; set; }
[JsonProperty("site_admin")]
public bool SiteAdmin { get; set; }

}
}
}
4 changes: 1 addition & 3 deletions Analogy.CommonUtilities/UI/AnalogyPropertiesMatcherUC.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,13 @@ private void AnalogyPropertiesMatcherUC_Load(object sender, EventArgs e)
Selection = (AnalogyLogMessagePropertyName)cbLogProperties.SelectedItem;

Check warning on line 25 in Analogy.CommonUtilities/UI/AnalogyPropertiesMatcherUC.cs

View workflow job for this annotation

GitHub Actions / build (Release)

Unboxing a possibly null value.
UpdateMappings();
cbLogProperties.SelectedIndexChanged += this.cbLogProperties_SelectedIndexChanged;

}

private void cbLogProperties_SelectedIndexChanged(object? sender, EventArgs e)
{
Selection = (AnalogyLogMessagePropertyName)cbLogProperties.SelectedItem;

Check warning on line 32 in Analogy.CommonUtilities/UI/AnalogyPropertiesMatcherUC.cs

View workflow job for this annotation

GitHub Actions / build (Release)

Unboxing a possibly null value.
lblInfo.Text = $"Log files keys/properties to map to {Selection}:";
UpdateMappings();

}

private void UpdateMappings()
Expand Down Expand Up @@ -68,4 +66,4 @@ private void btnDeleteSelection_Click(object sender, EventArgs e)
}
}
}
}
}
8 changes: 2 additions & 6 deletions Analogy.CommonUtilities/UI/CommonLogSettingsUC.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
using Analogy.Interfaces;
using Analogy.Interfaces.DataTypes;
using Newtonsoft.Json;
using System.IO;
using System.Windows.Forms;
using Newtonsoft.Json;

namespace Analogy.CommonUtilities.UI
{
Expand Down Expand Up @@ -38,7 +38,6 @@ private void btnImport_Click(object sender, EventArgs e)
LoadJsonSettings();
MessageBox.Show("File Imported. Save settings if desired", @"Import settings", MessageBoxButtons.OK,
MessageBoxIcon.Information);

}
catch (Exception ex)
{
Expand Down Expand Up @@ -70,14 +69,12 @@ private void btnExportSettings_Click(object sender, EventArgs e)
File.WriteAllText(saveFileDialog.FileName, JsonConvert.SerializeObject(ParserSettings));
MessageBox.Show("File Saved", @"Export settings", MessageBoxButtons.OK,
MessageBoxIcon.Information);

}
catch (Exception ex)
{
MessageBox.Show("Error Export: " + ex.Message, @"Error Saving file", MessageBoxButtons.OK,
MessageBoxIcon.Error);
}

}
}

Expand Down Expand Up @@ -117,5 +114,4 @@ public void SetDefaultDirectory(string dir)
txtbLogDirectory.Text = dir;
}
}
}

}
Loading

0 comments on commit 9741a26

Please sign in to comment.