Skip to content

Commit 67c0806

Browse files
authored
Merge pull request #89 from NosCoreIO/claude/upgrade-dotnet-10-01Wxr163GGMrogYztojcys1T
Upgrade Project to .NET 10
2 parents 463ee85 + 296c4b2 commit 67c0806

File tree

15 files changed

+200
-33
lines changed

15 files changed

+200
-33
lines changed

.github/workflows/dotnet.yml

Lines changed: 9 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -12,17 +12,17 @@ jobs:
1212
build:
1313
runs-on: ubuntu-latest
1414
steps:
15-
- uses: actions/checkout@v2
15+
- uses: actions/checkout@v5
1616
- name: Setup .NET
17-
uses: actions/setup-dotnet@v3
17+
uses: actions/setup-dotnet@v5
1818
with:
19-
dotnet-version: 7.0.x
19+
dotnet-version: '10.0.x'
2020

2121
- name: Check Tag
2222
id: check-tag
2323
run: |
2424
if [[ v${{ github.event.ref }} =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
25-
echo ::set-output name=match::true
25+
echo "match=true" >> $GITHUB_OUTPUT
2626
fi
2727
2828
- name: Run Unit Tests
@@ -39,24 +39,13 @@ jobs:
3939
dotnet build -c Release
4040
dotnet pack -c Release -o /tmp/nupkgs -v m -p:IncludeSymbols=true -p:SymbolPackageFormat=snupkg
4141
dotnet nuget push /tmp/nupkgs/NosCore.ParserInputGenerator.${{github.event.ref}}.nupkg -s https://api.nuget.org/v3/index.json -k ${{secrets.NUGET_API_KEY}}
42-
echo ::set-output name=ARTIFACT_PATH::/tmp/nupkgs/NosCore.ParserInputGenerator.${{github.event.ref}}.snupkg
43-
echo ::set-output name=ARTIFACT_NAME::NosCore.ParserInputGenerator.${{github.event.ref}}.snupkg
44-
45-
- name: Gets Latest Release
46-
if: steps.check-tag.outputs.match == 'true'
47-
id: latest_release_info
48-
uses: jossef/[email protected]
49-
env:
50-
GITHUB_TOKEN: ${{ secrets.REPO_TOKEN }}
42+
echo "ARTIFACT_PATH=/tmp/nupkgs/NosCore.ParserInputGenerator.${{github.event.ref}}.snupkg" >> $GITHUB_OUTPUT
43+
echo "ARTIFACT_NAME=NosCore.ParserInputGenerator.${{github.event.ref}}.snupkg" >> $GITHUB_OUTPUT
5144
5245
- name: Upload Release Asset
5346
if: steps.check-tag.outputs.match == 'true'
54-
uses: actions/upload-release-asset@v1
55-
env:
56-
GITHUB_TOKEN: ${{ secrets.REPO_TOKEN }}
47+
uses: softprops/action-gh-release@v2
5748
with:
58-
upload_url: ${{ steps.latest_release_info.outputs.upload_url }}
59-
asset_path: ${{ steps.build_artifact.outputs.ARTIFACT_PATH }}
60-
asset_name: ${{ steps.build_artifact.outputs.ARTIFACT_NAME }}
61-
asset_content_type: application/zip
49+
files: ${{ steps.build_artifact.outputs.ARTIFACT_PATH }}
50+
token: ${{ secrets.REPO_TOKEN }}
6251

src/NosCore.ParserInputGenerator.Launcher/Configuration/ParserInputGeneratorConfiguration.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22

33
namespace NosCore.ParserInputGenerator.Launcher.Configuration
44
{
5+
/// <summary>
6+
/// Configuration for the Parser Input Generator.
7+
/// </summary>
58
public class ParserInputGeneratorConfiguration : LanguageConfiguration
69
{
710
}

src/NosCore.ParserInputGenerator.Launcher/NosCore.ParserInputGenerator.Launcher.csproj

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,19 @@
22

33
<PropertyGroup>
44
<OutputType>Exe</OutputType>
5-
<TargetFramework>net8.0</TargetFramework>
5+
<TargetFramework>net10.0</TargetFramework>
66
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
77
</PropertyGroup>
88

99
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
1010
<OutputPath>..\..\build\</OutputPath>
1111
</PropertyGroup>
1212

13+
<ItemGroup>
14+
<PackageReference Include="Microsoft.IdentityModel.JsonWebTokens" Version="8.2.1" />
15+
<PackageReference Include="System.IdentityModel.Tokens.Jwt" Version="8.2.1" />
16+
</ItemGroup>
17+
1318
<ItemGroup>
1419
<ProjectReference Include="..\NosCore.ParserInputGenerator\NosCore.ParserInputGenerator.csproj" />
1520
</ItemGroup>

src/NosCore.ParserInputGenerator.Launcher/Program.cs

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,25 @@
1010

1111
namespace NosCore.ParserInputGenerator.Launcher
1212
{
13-
class Program
13+
/// <summary>
14+
/// Main program entry point for the Parser Input Generator launcher.
15+
/// </summary>
16+
public class Program
1417
{
18+
/// <summary>
19+
/// Application entry point.
20+
/// </summary>
21+
/// <param name="args">Command line arguments.</param>
1522
public static void Main(string[] args)
1623
{
1724
CreateHostBuilder(args).Build().Run();
1825
}
1926

27+
/// <summary>
28+
/// Creates and configures the host builder.
29+
/// </summary>
30+
/// <param name="args">Command line arguments.</param>
31+
/// <returns>The configured host builder.</returns>
2032
public static IHostBuilder CreateHostBuilder(string[] args)
2133
{
2234
var configuration = new ParserInputGeneratorConfiguration();

src/NosCore.ParserInputGenerator.Launcher/Worker.cs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@
1414

1515
namespace NosCore.ParserInputGenerator.Launcher
1616
{
17+
/// <summary>
18+
/// Background service worker that downloads and processes parser input files.
19+
/// </summary>
1720
public class Worker : BackgroundService
1821
{
1922
private const string ConsoleText = "PARSER INPUT GENERATOR - NosCoreIO";
@@ -45,13 +48,24 @@ public class Worker : BackgroundService
4548
"NSgtdData.NOS"
4649
};
4750

51+
/// <summary>
52+
/// Initializes a new instance of the <see cref="Worker"/> class.
53+
/// </summary>
54+
/// <param name="logger">The logger instance.</param>
55+
/// <param name="client">The client downloader.</param>
56+
/// <param name="extractor">The file extractor.</param>
4857
public Worker(ILogger<Worker> logger, IClientDownloader client, IExtractor extractor)
4958
{
5059
_logger = logger;
5160
_client = client;
5261
_extractor = extractor;
5362
}
5463

64+
/// <summary>
65+
/// Executes the worker task to download, extract, and package parser input files.
66+
/// </summary>
67+
/// <param name="stoppingToken">Cancellation token to stop the service.</param>
68+
/// <returns>A task representing the asynchronous operation.</returns>
5569
protected override async Task ExecuteAsync(CancellationToken stoppingToken)
5670
{
5771
try

src/NosCore.ParserInputGenerator/Downloader/ClientDownloader.cs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,19 +17,29 @@
1717

1818
namespace NosCore.ParserInputGenerator.Downloader
1919
{
20+
/// <summary>
21+
/// Implements client file downloading functionality.
22+
/// </summary>
2023
public class ClientDownloader : IClientDownloader
2124
{
2225
private readonly IHttpClientFactory _clientFactory;
2326
private readonly ILogger<ClientDownloader> _logger;
2427

28+
/// <summary>
29+
/// Initializes a new instance of the <see cref="ClientDownloader"/> class.
30+
/// </summary>
31+
/// <param name="clientFactory">The HTTP client factory.</param>
32+
/// <param name="logger">The logger instance.</param>
2533
public ClientDownloader(IHttpClientFactory clientFactory, ILogger<ClientDownloader> logger)
2634
{
2735
_clientFactory = clientFactory;
2836
_logger = logger;
2937
}
3038

39+
/// <inheritdoc/>
3140
public Task<ClientManifest> DownloadManifest() => DownloadManifestAsync(RegionType.EN);
3241

42+
/// <inheritdoc/>
3343
public async Task<ClientManifest> DownloadManifestAsync(RegionType region)
3444
{
3545
var client = _clientFactory.CreateClient();
@@ -42,8 +52,10 @@ public async Task<ClientManifest> DownloadManifestAsync(RegionType region)
4252
}) ?? throw new InvalidOperationException();
4353
}
4454

55+
/// <inheritdoc/>
4556
public async Task DownloadClientAsync() => await DownloadClientAsync(await DownloadManifest());
4657

58+
/// <inheritdoc/>
4759
public async Task DownloadClientAsync(ClientManifest manifest)
4860
{
4961
async Task Download(Entry entry)

src/NosCore.ParserInputGenerator/Downloader/ClientManifest.cs

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,35 +3,68 @@
33

44
namespace NosCore.ParserInputGenerator.Downloader
55
{
6+
/// <summary>
7+
/// Represents a client manifest containing file entries and metadata.
8+
/// </summary>
69
public class ClientManifest
710
{
11+
/// <summary>
12+
/// Gets or sets the array of file entries in the manifest.
13+
/// </summary>
814
[JsonPropertyName("entries")]
915
public Entry[] Entries { get; set; } = null!;
1016

17+
/// <summary>
18+
/// Gets or sets the total size of all files in bytes.
19+
/// </summary>
1120
[JsonPropertyName("totalSize")]
1221
public long TotalSize { get; set; }
1322

23+
/// <summary>
24+
/// Gets or sets the build number of the client.
25+
/// </summary>
1426
[JsonPropertyName("build")]
1527
public long Build { get; set; }
1628
}
1729

30+
/// <summary>
31+
/// Represents an individual file entry in the client manifest.
32+
/// </summary>
1833
public class Entry
1934
{
35+
/// <summary>
36+
/// Gets or sets the file path.
37+
/// </summary>
2038
[JsonPropertyName("path")]
2139
public string? Path { get; set; }
2240

41+
/// <summary>
42+
/// Gets or sets the SHA1 hash of the file.
43+
/// </summary>
2344
[JsonPropertyName("sha1")]
2445
public string? Sha1 { get; set; }
2546

47+
/// <summary>
48+
/// Gets or sets the file name.
49+
/// </summary>
2650
[JsonPropertyName("file")]
2751
public string File { get; set; } = null!;
2852

53+
/// <summary>
54+
/// Gets or sets file flags.
55+
/// </summary>
2956
[JsonPropertyName("flags")]
3057
public long Flags { get; set; }
3158

59+
/// <summary>
60+
/// Gets or sets the file size in bytes.
61+
/// </summary>
3262
[JsonPropertyName("size")]
3363
public long Size { get; set; }
3464

65+
/// <summary>
66+
/// Gets or sets a value indicating whether this entry is a folder.
67+
/// </summary>
3568
[JsonPropertyName("folder")]
3669
public bool Folder { get; set; }
3770
}

src/NosCore.ParserInputGenerator/Downloader/IClientDownloader.cs

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,35 @@
66

77
namespace NosCore.ParserInputGenerator.Downloader
88
{
9+
/// <summary>
10+
/// Interface for downloading client files and manifests.
11+
/// </summary>
912
public interface IClientDownloader
1013
{
14+
/// <summary>
15+
/// Downloads the client manifest using the default region.
16+
/// </summary>
17+
/// <returns>The downloaded client manifest.</returns>
1118
Task<ClientManifest> DownloadManifest();
19+
20+
/// <summary>
21+
/// Downloads the client manifest for a specific region.
22+
/// </summary>
23+
/// <param name="region">The region to download from.</param>
24+
/// <returns>The downloaded client manifest.</returns>
1225
Task<ClientManifest> DownloadManifestAsync(RegionType region);
1326

27+
/// <summary>
28+
/// Downloads the client files using the default manifest.
29+
/// </summary>
30+
/// <returns>A task representing the asynchronous operation.</returns>
1431
Task DownloadClientAsync();
32+
33+
/// <summary>
34+
/// Downloads the client files specified in the manifest.
35+
/// </summary>
36+
/// <param name="manifest">The manifest containing file information.</param>
37+
/// <returns>A task representing the asynchronous operation.</returns>
1538
Task DownloadClientAsync(ClientManifest manifest);
1639
}
1740
}

src/NosCore.ParserInputGenerator/Extractor/Extractor.cs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,19 +10,29 @@
1010

1111
namespace NosCore.ParserInputGenerator.Extractor
1212
{
13+
/// <summary>
14+
/// Implements file extraction functionality for NostaleData archives.
15+
/// </summary>
1316
public class Extractor : IExtractor
1417
{
1518
private readonly ILogger<Extractor> _logger;
1619

20+
/// <summary>
21+
/// Initializes a new instance of the <see cref="Extractor"/> class.
22+
/// </summary>
23+
/// <param name="logger">The logger instance.</param>
1724
public Extractor(ILogger<Extractor> logger)
1825
{
1926
_logger = logger;
2027
}
2128

29+
/// <inheritdoc/>
2230
public Task ExtractAsync(FileInfo file, string dest) => ExtractAsync(file, dest, false);
2331

32+
/// <inheritdoc/>
2433
public Task ExtractAsync(FileInfo file) => ExtractAsync(file, $".{Path.DirectorySeparatorChar}output{Path.DirectorySeparatorChar}");
2534

35+
/// <inheritdoc/>
2636
public async Task ExtractAsync(FileInfo nosFile, string directory, bool rename)
2737
{
2838
async Task WriteFile(string fileName, MemoryStream decryptedContent)

src/NosCore.ParserInputGenerator/Extractor/IExtractor.cs

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,33 @@
99

1010
namespace NosCore.ParserInputGenerator.Extractor
1111
{
12+
/// <summary>
13+
/// Interface for extracting archived files.
14+
/// </summary>
1215
public interface IExtractor
1316
{
17+
/// <summary>
18+
/// Extracts a file to the default directory.
19+
/// </summary>
20+
/// <param name="file">The file to extract.</param>
21+
/// <returns>A task representing the asynchronous operation.</returns>
1422
Task ExtractAsync(FileInfo file);
23+
24+
/// <summary>
25+
/// Extracts a file to a specified directory.
26+
/// </summary>
27+
/// <param name="file">The file to extract.</param>
28+
/// <param name="directory">The target directory.</param>
29+
/// <returns>A task representing the asynchronous operation.</returns>
1530
Task ExtractAsync(FileInfo file, string directory);
31+
32+
/// <summary>
33+
/// Extracts a file to a specified directory with optional renaming.
34+
/// </summary>
35+
/// <param name="file">The file to extract.</param>
36+
/// <param name="directory">The target directory.</param>
37+
/// <param name="rename">Whether to rename extracted files.</param>
38+
/// <returns>A task representing the asynchronous operation.</returns>
1639
Task ExtractAsync(FileInfo file, string directory, bool rename);
1740
}
1841
}

0 commit comments

Comments
 (0)