Skip to content

Commit

Permalink
Merge pull request #126 from fumiichan/net8
Browse files Browse the repository at this point in the history
.NET 8 Upgrade (1.3.0.0 Release)
  • Loading branch information
fumiichan authored Jan 8, 2024
2 parents 3cec67f + 33524d5 commit 57608fa
Show file tree
Hide file tree
Showing 79 changed files with 1,050 additions and 1,183 deletions.
2 changes: 1 addition & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
jobs:
build:
docker:
- image: mcr.microsoft.com/dotnet/sdk:7.0
- image: mcr.microsoft.com/dotnet/sdk:8.0
steps:
- checkout
- run:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/dotnet.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
- name: Setup .NET
uses: actions/setup-dotnet@v1
with:
dotnet-version: 7.0.x
dotnet-version: 8.0.x
- name: Restore dependencies
run: dotnet restore
- name: Build
Expand Down
4 changes: 2 additions & 2 deletions Api/Queries/SearchQuery.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ namespace asuka.Api.Queries;
public record SearchQuery
{
[AliasAs("query")]
public string Queries { get; init; }
public required string Queries { get; init; }

[AliasAs("page")]
public int PageNumber { get; init; }

[AliasAs("sort")]
public string Sort { get; init; }
public required string Sort { get; init; }
}
3 changes: 2 additions & 1 deletion Api/Responses/GalleryImageObjectResponse.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@

namespace asuka.Api.Responses;

#nullable disable
public record GalleryImageObjectResponse
{
[JsonPropertyName("pages")]
public IReadOnlyList<GalleryImageResponse> Images { get; set; }
public IReadOnlyList<GalleryImageResponse> Images { get; set; }
}
1 change: 1 addition & 0 deletions Api/Responses/GalleryImageResponse.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace asuka.Api.Responses;

#nullable disable
public record GalleryImageResponse
{
[JsonPropertyName("t")]
Expand Down
1 change: 1 addition & 0 deletions Api/Responses/GalleryListResponse.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

namespace asuka.Api.Responses;

#nullable disable
public record GalleryListResponse
{
[JsonPropertyName("result")]
Expand Down
5 changes: 3 additions & 2 deletions Api/Responses/GalleryResponse.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

namespace asuka.Api.Responses;

#nullable disable
public record GalleryResponse
{
[JsonPropertyName("id")]
Expand All @@ -14,10 +15,10 @@ public record GalleryResponse
public int MediaId { get; set; }

[JsonPropertyName("title")]
public GalleryTitleResponse Title { get; set; }
public required GalleryTitleResponse Title { get; set; }

[JsonPropertyName("images")]
public GalleryImageObjectResponse Images { get; set; }
public required GalleryImageObjectResponse Images { get; set; }

[JsonPropertyName("tags")]
public IReadOnlyList<GalleryTagResponse> Tags { get; set; }
Expand Down
1 change: 1 addition & 0 deletions Api/Responses/GalleryTagResponse.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace asuka.Api.Responses;

#nullable disable
public record GalleryTagResponse
{
[JsonPropertyName("id")]
Expand Down
1 change: 1 addition & 0 deletions Api/Responses/GalleryTitleResponse.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace asuka.Api.Responses;

#nullable disable
public record GalleryTitleResponse
{
[JsonPropertyName("japanese")]
Expand Down
52 changes: 0 additions & 52 deletions AsukaApplication.cs

This file was deleted.

37 changes: 0 additions & 37 deletions Commandline/CommandLineParserFactory.cs

This file was deleted.

13 changes: 0 additions & 13 deletions Commandline/CommandLineParserTokens.cs

This file was deleted.

6 changes: 0 additions & 6 deletions Commandline/ICommandLineParserFactory.cs

This file was deleted.

1 change: 1 addition & 0 deletions Commandline/Options/ConfigureOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace asuka.Commandline.Options;

#nullable disable
[Verb("config", HelpText = "Configure the client")]
public record ConfigureOptions
{
Expand Down
1 change: 1 addition & 0 deletions Commandline/Options/CookieConfigureOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace asuka.Commandline.Options;

#nullable disable
[Verb("cookie", HelpText = "Configure cookies and User Agent")]
public record CookieConfigureOptions
{
Expand Down
1 change: 1 addition & 0 deletions Commandline/Options/FileCommandOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace asuka.Commandline.Options;

#nullable disable
[Verb("file", HelpText = "Download galleries from text file")]
public record FileCommandOptions : ICommonOptions
{
Expand Down
1 change: 1 addition & 0 deletions Commandline/Options/GetOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

namespace asuka.Commandline.Options;

#nullable disable
[Verb("get", HelpText = "Download a Single Gallery from URL.")]
public record GetOptions : ICommonOptions
{
Expand Down
1 change: 1 addition & 0 deletions Commandline/Options/RandomOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace asuka.Commandline.Options;

#nullable disable
[Verb("random", HelpText = "Randomly pick a gallery.")]
public record RandomOptions : ICommonOptions
{
Expand Down
1 change: 1 addition & 0 deletions Commandline/Options/RecommendOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace asuka.Commandline.Options;

#nullable disable
[Verb("recommend", HelpText = "Download recommendation from the gallery URL.")]
public record RecommendOptions : ICommonOptions
{
Expand Down
1 change: 1 addition & 0 deletions Commandline/Options/SearchOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

namespace asuka.Commandline.Options;

#nullable disable
[Verb("search", HelpText = "Search something in the gallery")]
public record SearchOptions : ICommonOptions
{
Expand Down
1 change: 1 addition & 0 deletions Commandline/Options/SeriesCreatorCommandOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

namespace asuka.Commandline.Options;

#nullable disable
[Verb("series", HelpText = "Construct series")]
public record SeriesCreatorCommandOptions: ICommonOptions
{
Expand Down
27 changes: 13 additions & 14 deletions Commandline/Parsers/ConfigureCommand.cs
Original file line number Diff line number Diff line change
@@ -1,21 +1,20 @@
using System;
using System.Threading.Tasks;
using asuka.Commandline.Options;
using asuka.Configuration;
using asuka.Output.Writer;
using asuka.Output;
using FluentValidation;

namespace asuka.Commandline.Parsers;

public class ConfigureCommand : ICommandLineParser
{
private readonly IConfigurationManager _configurationManager;
private readonly IConsoleWriter _consoleWriter;
private readonly IAppConfigManager _appConfigManager;
private readonly IValidator<ConfigureOptions> _validator;

public ConfigureCommand(IValidator<ConfigureOptions> validator, IConfigurationManager configurationManager, IConsoleWriter consoleWriter)
public ConfigureCommand(IValidator<ConfigureOptions> validator, IAppConfigManager appConfigManager)
{
_configurationManager = configurationManager;
_consoleWriter = consoleWriter;
_appConfigManager = appConfigManager;
_validator = validator;
}

Expand All @@ -25,41 +24,41 @@ public async Task RunAsync(object options)
var validation = await _validator.ValidateAsync(opts);
if (!validation.IsValid)
{
_consoleWriter.ValidationErrors(validation.Errors);
validation.Errors.PrintValidationExceptions();
return;
}

if (opts.SetConfigMode)
{
_configurationManager.SetValue(opts.Key, opts.Value);
await _configurationManager.Flush();
_appConfigManager.SetValue(opts.Key, opts.Value);
await _appConfigManager.Flush();

return;
}

if (opts.ReadConfigMode)
{
var configValue = _configurationManager.GetValue(opts.Key);
_consoleWriter.WriteLine($"{opts.Key} = {configValue}");
var configValue = _appConfigManager.GetValue(opts.Key);
Console.WriteLine($"{opts.Key} = {configValue}");

return;
}

if (opts.ListConfigMode)
{
var keyValuePairs = _configurationManager.GetAllValues();
var keyValuePairs = _appConfigManager.GetAllValues();

foreach (var (key, value) in keyValuePairs)
{
_consoleWriter.WriteLine($"{key} = {value}");
Console.WriteLine($"{key} = {value}");
}

return;
}

if (opts.ResetConfig)
{
await _configurationManager.Reset();
await _appConfigManager.Reset();
}
}
}
Loading

0 comments on commit 57608fa

Please sign in to comment.