mirror of
https://jihulab.com/DGP-Studio/Snap.Hutao.git
synced 2025-11-19 21:02:53 +08:00
fix dependabot
This commit is contained in:
6
.github/dependabot.yml
vendored
6
.github/dependabot.yml
vendored
@@ -5,7 +5,7 @@
|
||||
|
||||
version: 2
|
||||
updates:
|
||||
- package-ecosystem: "nuget" # See documentation for possible values
|
||||
directory: "/" # Location of package manifests
|
||||
- package-ecosystem: "nuget"
|
||||
directory: "/src/Snap.Hutao" # Snap.Hutao.csproj
|
||||
schedule:
|
||||
interval: "weekly"
|
||||
interval: "weekly"
|
||||
@@ -1,3 +1,3 @@
|
||||
本文件夹中的所有图片,均由 [DGP Studio](https://github.com/DGP-Studio) 委托 [Bilibili 画画的芦苇](https://space.bilibili.com/274422134) 绘制
|
||||
|
||||
Copyright ©2023 DGP Studio, All Rights Reserved.
|
||||
Copyright © 2023 DGP Studio, All Rights Reserved.
|
||||
@@ -4,58 +4,54 @@ using System;
|
||||
namespace Snap.Hutao.Test;
|
||||
|
||||
[TestClass]
|
||||
public class DependencyInjectionTest
|
||||
public sealed class DependencyInjectionTest
|
||||
{
|
||||
[ClassInitialize]
|
||||
public void Setup()
|
||||
{
|
||||
|
||||
}
|
||||
private readonly IServiceProvider services = new ServiceCollection()
|
||||
.AddSingleton<IService, ServiceA>()
|
||||
.AddSingleton<IService, ServiceB>()
|
||||
.AddScoped<IScopedService, ServiceA>()
|
||||
.AddTransient(typeof(IGenericService<>), typeof(GenericService<>))
|
||||
.BuildServiceProvider();
|
||||
|
||||
[TestMethod]
|
||||
public void OriginalTypeNotDiscoverable()
|
||||
public void OriginalTypeCannotResolved()
|
||||
{
|
||||
IServiceProvider services = new ServiceCollection()
|
||||
.AddSingleton<IService, ServiceA>()
|
||||
.AddSingleton<IService, ServiceB>()
|
||||
.BuildServiceProvider();
|
||||
|
||||
Assert.IsNull(services.GetService<ServiceA>());
|
||||
Assert.IsNull(services.GetService<ServiceB>());
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void ScopedServiceInitializeMultipleTimesInScope()
|
||||
{
|
||||
IServiceProvider services = new ServiceCollection()
|
||||
.AddScoped<IService, ServiceA>()
|
||||
.BuildServiceProvider();
|
||||
|
||||
IServiceScopeFactory scopeFactory = services.GetRequiredService<IServiceScopeFactory>();
|
||||
using (IServiceScope scope = scopeFactory.CreateScope())
|
||||
{
|
||||
IService service1 = scope.ServiceProvider.GetRequiredService<IService>();
|
||||
IService service2 = scope.ServiceProvider.GetRequiredService<IService>();
|
||||
Assert.AreNotEqual(service1.Id, service2.Id);
|
||||
}
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void GenericServicesCanBeResolved()
|
||||
{
|
||||
IServiceProvider services = new ServiceCollection()
|
||||
.AddTransient(typeof(IGenericService<>),typeof(GenericService<>))
|
||||
.AddTransient(typeof(IGenericService<>), typeof(GenericService<>))
|
||||
.BuildServiceProvider();
|
||||
|
||||
Assert.IsNotNull(services.GetService<IGenericService<int>>());
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void ScopedServiceInitializeMultipleTimesInScope()
|
||||
{
|
||||
using (IServiceScope scope = services.CreateScope())
|
||||
{
|
||||
IScopedService service1 = scope.ServiceProvider.GetRequiredService<IScopedService>();
|
||||
IScopedService service2 = scope.ServiceProvider.GetRequiredService<IScopedService>();
|
||||
Assert.AreNotEqual(service1.Id, service2.Id);
|
||||
}
|
||||
}
|
||||
|
||||
private interface IService
|
||||
{
|
||||
Guid Id { get; }
|
||||
}
|
||||
|
||||
private sealed class ServiceA : IService
|
||||
private interface IScopedService
|
||||
{
|
||||
Guid Id { get; }
|
||||
}
|
||||
|
||||
private sealed class ServiceA : IService, IScopedService
|
||||
{
|
||||
public Guid Id
|
||||
{
|
||||
|
||||
@@ -13,13 +13,13 @@ public class JsonSerializeTest
|
||||
}
|
||||
""";
|
||||
|
||||
private const string SmapleNumberObjectJson = """
|
||||
private const string SmapleEmptyStringObjectJson = """
|
||||
{
|
||||
"A" : ""
|
||||
}
|
||||
""";
|
||||
|
||||
private const string SmapleNumberDictionaryJson = """
|
||||
private const string SmapleNumberKeyDictionaryJson = """
|
||||
{
|
||||
"111" : "12",
|
||||
"222" : "34"
|
||||
@@ -34,21 +34,11 @@ public class JsonSerializeTest
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
[ExpectedException(typeof(JsonException))]
|
||||
public void EmptyStringCannotSerializeAsNumber()
|
||||
{
|
||||
bool caught = false;
|
||||
try
|
||||
{
|
||||
// Throw
|
||||
StringNumberSample sample = JsonSerializer.Deserialize<StringNumberSample>(SmapleNumberObjectJson)!;
|
||||
Assert.AreEqual(sample.A, 0);
|
||||
}
|
||||
catch
|
||||
{
|
||||
caught = true;
|
||||
}
|
||||
|
||||
Assert.IsTrue(caught);
|
||||
StringNumberSample sample = JsonSerializer.Deserialize<StringNumberSample>(SmapleEmptyStringObjectJson)!;
|
||||
Assert.AreEqual(sample.A, 0);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
@@ -59,7 +49,7 @@ public class JsonSerializeTest
|
||||
NumberHandling = JsonNumberHandling.AllowReadingFromString,
|
||||
};
|
||||
|
||||
Dictionary<int,string> sample = JsonSerializer.Deserialize<Dictionary<int, string>>(SmapleNumberDictionaryJson, options)!;
|
||||
Dictionary<int,string> sample = JsonSerializer.Deserialize<Dictionary<int, string>>(SmapleNumberKeyDictionaryJson, options)!;
|
||||
Assert.AreEqual(sample[111], "12");
|
||||
}
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
namespace Snap.Hutao.Test.RuntimeBehavior;
|
||||
|
||||
[TestClass]
|
||||
internal sealed class EnumRuntimeBehaviorTest
|
||||
public sealed class EnumRuntimeBehaviorTest
|
||||
{
|
||||
[TestMethod]
|
||||
[ExpectedException(typeof(ArgumentException))]
|
||||
@@ -20,7 +20,6 @@ internal sealed class EnumRuntimeBehaviorTest
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
[ExpectedException(typeof(Exception), AllowDerivedTypes = true)]
|
||||
public void EnumToStringDecimal()
|
||||
{
|
||||
Assert.AreEqual("2", EnumA.ValueB.ToString("D"));
|
||||
|
||||
@@ -4,7 +4,7 @@ using System.Collections.Generic;
|
||||
namespace Snap.Hutao.Test.RuntimeBehavior;
|
||||
|
||||
[TestClass]
|
||||
public class ForEachRuntimeBehaviorTest
|
||||
public sealed class ForEachRuntimeBehaviorTest
|
||||
{
|
||||
[TestMethod]
|
||||
public void ListOfStringCanEnumerateAsReadOnlySpanOfChar()
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
namespace Snap.Hutao.Test.RuntimeBehavior;
|
||||
|
||||
[TestClass]
|
||||
internal sealed class PropertyRuntimeBehaviorTest
|
||||
public sealed class PropertyRuntimeBehaviorTest
|
||||
{
|
||||
[TestMethod]
|
||||
public void GetTwiceOnPropertyResultsNotSame()
|
||||
|
||||
@@ -2,7 +2,8 @@
|
||||
|
||||
namespace Snap.Hutao.Test.RuntimeBehavior;
|
||||
|
||||
public class RangeRuntimeBehaviorTest
|
||||
[TestClass]
|
||||
public sealed class RangeRuntimeBehaviorTest
|
||||
{
|
||||
[TestMethod]
|
||||
public void RangeTrimLastOne()
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
namespace Snap.Hutao.Test.RuntimeBehavior;
|
||||
|
||||
[TestClass]
|
||||
internal sealed class StringRuntimeBehaviorTest
|
||||
public sealed class StringRuntimeBehaviorTest
|
||||
{
|
||||
[TestMethod]
|
||||
public unsafe void NullStringFixedIsNullPointer()
|
||||
@@ -32,4 +32,4 @@ internal sealed class StringRuntimeBehaviorTest
|
||||
ReadOnlySpan<char> testSpan = testStr;
|
||||
Assert.IsTrue(testSpan.Length == 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
namespace Snap.Hutao.Test.RuntimeBehavior;
|
||||
|
||||
[TestClass]
|
||||
public sealed class UnsafeRuntimeBehaviorTest
|
||||
{
|
||||
[TestMethod]
|
||||
public unsafe void UInt32AllSetIs()
|
||||
{
|
||||
byte[] bytes = { 0xFF, 0xFF, 0xFF, 0xFF, };
|
||||
|
||||
fixed (byte* pBytes = bytes)
|
||||
{
|
||||
Assert.AreEqual(uint.MaxValue, *(uint*)pBytes);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -13,4 +13,14 @@ internal static class AnimationDurations
|
||||
/// 图片缩放动画
|
||||
/// </summary>
|
||||
public static readonly TimeSpan ImageZoom = TimeSpan.FromSeconds(0.5);
|
||||
|
||||
/// <summary>
|
||||
/// 图像淡入
|
||||
/// </summary>
|
||||
public static readonly TimeSpan ImageFadeIn = TimeSpan.FromSeconds(0.3);
|
||||
|
||||
/// <summary>
|
||||
/// 图像淡出
|
||||
/// </summary>
|
||||
public static readonly TimeSpan ImageFadeOut = TimeSpan.FromSeconds(0.2);
|
||||
}
|
||||
@@ -6,6 +6,7 @@ using Microsoft.UI.Composition;
|
||||
using Microsoft.UI.Xaml;
|
||||
using Microsoft.UI.Xaml.Hosting;
|
||||
using Microsoft.UI.Xaml.Media;
|
||||
using Snap.Hutao.Control.Animation;
|
||||
using Snap.Hutao.Core.Caching;
|
||||
using Snap.Hutao.Service.Notification;
|
||||
using System.IO;
|
||||
@@ -183,7 +184,11 @@ internal abstract class CompositionImage : Microsoft.UI.Xaml.Controls.Control
|
||||
|
||||
if (EnableLazyLoading)
|
||||
{
|
||||
await AnimationBuilder.Create().Opacity(from: 0D, to: 1D).StartAsync(this, token).ConfigureAwait(true);
|
||||
await AnimationBuilder
|
||||
.Create()
|
||||
.Opacity(from: 0D, to: 1D, duration: AnimationDurations.ImageFadeIn)
|
||||
.StartAsync(this, token)
|
||||
.ConfigureAwait(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -200,7 +205,11 @@ internal abstract class CompositionImage : Microsoft.UI.Xaml.Controls.Control
|
||||
|
||||
if (EnableLazyLoading)
|
||||
{
|
||||
await AnimationBuilder.Create().Opacity(from: 1D, to: 0D).StartAsync(this, token).ConfigureAwait(true);
|
||||
await AnimationBuilder
|
||||
.Create()
|
||||
.Opacity(from: 1D, to: 0D, duration: AnimationDurations.ImageFadeOut)
|
||||
.StartAsync(this, token)
|
||||
.ConfigureAwait(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -1,24 +0,0 @@
|
||||
// Copyright (c) DGP Studio. All rights reserved.
|
||||
// Licensed under the MIT license.
|
||||
|
||||
using Microsoft.UI.Xaml.Markup;
|
||||
|
||||
namespace Snap.Hutao.Control.Markup;
|
||||
|
||||
/// <summary>
|
||||
/// 类型拓展
|
||||
/// </summary>
|
||||
[MarkupExtensionReturnType(ReturnType = typeof(Type))]
|
||||
internal sealed class TypeExtension : MarkupExtension
|
||||
{
|
||||
/// <summary>
|
||||
/// 类型
|
||||
/// </summary>
|
||||
public Type Type { get; set; } = default!;
|
||||
|
||||
/// <inheritdoc/>
|
||||
protected override object ProvideValue()
|
||||
{
|
||||
return Type;
|
||||
}
|
||||
}
|
||||
@@ -38,7 +38,7 @@ internal struct Bgra32
|
||||
/// </summary>
|
||||
/// <param name="color">颜色</param>
|
||||
/// <returns>新的 BGRA8 结构</returns>
|
||||
public static unsafe Bgra32 FromColor(Color color)
|
||||
public static unsafe implicit operator Bgra32(Color color)
|
||||
{
|
||||
Unsafe.SkipInit(out Bgra32 bgra8);
|
||||
*(uint*)&bgra8 = BinaryPrimitives.ReverseEndianness(*(uint*)&color);
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
// Copyright (c) DGP Studio. All rights reserved.
|
||||
// Licensed under the MIT license.
|
||||
|
||||
using System.Runtime.CompilerServices;
|
||||
|
||||
namespace Snap.Hutao.Core;
|
||||
|
||||
/// <summary>
|
||||
@@ -33,4 +35,15 @@ internal static class StringLiterals
|
||||
/// CRLF 换行符
|
||||
/// </summary>
|
||||
public const string CRLF = "\r\n";
|
||||
|
||||
/// <summary>
|
||||
/// 获取小写的布尔字符串
|
||||
/// </summary>
|
||||
/// <param name="value">值</param>
|
||||
/// <returns>小写布尔字符串</returns>
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static string LowerBoolean(bool value)
|
||||
{
|
||||
return value ? "true" : "false";
|
||||
}
|
||||
}
|
||||
@@ -60,4 +60,6 @@ LPTHREAD_START_ROUTINE
|
||||
MINMAXINFO
|
||||
|
||||
// System.Com
|
||||
CWMO_FLAGS
|
||||
CWMO_FLAGS
|
||||
|
||||
D3D12CreateDevice
|
||||
@@ -5524,7 +5524,7 @@ namespace Snap.Hutao.Resource.Localization {
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查找类似 今日完成委托次数不足 的本地化字符串。
|
||||
/// 查找类似 今日完成委托数量不足 的本地化字符串。
|
||||
/// </summary>
|
||||
internal static string WebDailyNoteExtraTaskRewardNotAllowed {
|
||||
get {
|
||||
@@ -5533,7 +5533,7 @@ namespace Snap.Hutao.Resource.Localization {
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查找类似 「每日委托」奖励待领取 的本地化字符串。
|
||||
/// 查找类似 「每日委托」奖励未领取 的本地化字符串。
|
||||
/// </summary>
|
||||
internal static string WebDailyNoteExtraTaskRewardNotTaken {
|
||||
get {
|
||||
@@ -5542,7 +5542,7 @@ namespace Snap.Hutao.Resource.Localization {
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查找类似 已领取「每日委托」奖励 的本地化字符串。
|
||||
/// 查找类似 「每日委托」奖励已领取 的本地化字符串。
|
||||
/// </summary>
|
||||
internal static string WebDailyNoteExtraTaskRewardReceived {
|
||||
get {
|
||||
@@ -5551,7 +5551,7 @@ namespace Snap.Hutao.Resource.Localization {
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查找类似 {0} {1:HH:mm} 达到上限 的本地化字符串。
|
||||
/// 查找类似 预计 {0} {1:HH:mm} 达到存储上限 的本地化字符串。
|
||||
/// </summary>
|
||||
internal static string WebDailyNoteHomeCoinRecoveryFormat {
|
||||
get {
|
||||
@@ -5596,7 +5596,16 @@ namespace Snap.Hutao.Resource.Localization {
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查找类似 {0} {1:HH:mm} 后全部恢复 的本地化字符串。
|
||||
/// 查找类似 原粹树脂已完全恢复 的本地化字符串。
|
||||
/// </summary>
|
||||
internal static string WebDailyNoteResinRecoveryCompleted {
|
||||
get {
|
||||
return ResourceManager.GetString("WebDailyNoteResinRecoveryCompleted", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查找类似 将于 {0} {1:HH:mm} 后全部恢复 的本地化字符串。
|
||||
/// </summary>
|
||||
internal static string WebDailyNoteResinRecoveryFormat {
|
||||
get {
|
||||
|
||||
@@ -1711,16 +1711,16 @@
|
||||
<value>{0} 分</value>
|
||||
</data>
|
||||
<data name="WebDailyNoteExtraTaskRewardNotAllowed" xml:space="preserve">
|
||||
<value>今日完成委托次数不足</value>
|
||||
<value>今日完成委托数量不足</value>
|
||||
</data>
|
||||
<data name="WebDailyNoteExtraTaskRewardNotTaken" xml:space="preserve">
|
||||
<value>「每日委托」奖励待领取</value>
|
||||
<value>「每日委托」奖励未领取</value>
|
||||
</data>
|
||||
<data name="WebDailyNoteExtraTaskRewardReceived" xml:space="preserve">
|
||||
<value>已领取「每日委托」奖励</value>
|
||||
<value>「每日委托」奖励已领取</value>
|
||||
</data>
|
||||
<data name="WebDailyNoteHomeCoinRecoveryFormat" xml:space="preserve">
|
||||
<value>{0} {1:HH:mm} 达到上限</value>
|
||||
<value>预计 {0} {1:HH:mm} 达到存储上限</value>
|
||||
</data>
|
||||
<data name="WebDailyNoteRecoveryTimeDay0" xml:space="preserve">
|
||||
<value>今天</value>
|
||||
@@ -1735,7 +1735,7 @@
|
||||
<value>{0} 天</value>
|
||||
</data>
|
||||
<data name="WebDailyNoteResinRecoveryFormat" xml:space="preserve">
|
||||
<value>{0} {1:HH:mm} 后全部恢复</value>
|
||||
<value>将于 {0} {1:HH:mm} 后全部恢复</value>
|
||||
</data>
|
||||
<data name="WebDailyNoteSenselessVerificationSuccess" xml:space="preserve">
|
||||
<value>无感验证成功</value>
|
||||
@@ -2034,4 +2034,7 @@
|
||||
<data name="ServiceGameUnlockerReadProcessMemoryPointerAddressFailed" xml:space="preserve">
|
||||
<value>在读取游戏进程内存时遇到问题:无法读取到指定地址的有效值</value>
|
||||
</data>
|
||||
<data name="WebDailyNoteResinRecoveryCompleted" xml:space="preserve">
|
||||
<value>原粹树脂已完全恢复</value>
|
||||
</data>
|
||||
</root>
|
||||
@@ -42,7 +42,6 @@ internal sealed partial class AchievementService : IAchievementService
|
||||
AppDbContext appDbContext = scope.ServiceProvider.GetRequiredService<AppDbContext>();
|
||||
entityMap = appDbContext.Achievements
|
||||
.Where(a => a.ArchiveId == archive.InnerId)
|
||||
.AsEnumerable()
|
||||
.ToDictionary(a => (AchievementId)a.Id);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -116,20 +116,6 @@ internal sealed partial class DailyNoteService : IDailyNoteService, IRecipient<U
|
||||
await new DailyNoteNotifier(serviceProvider, entry).NotifyAsync().ConfigureAwait(false);
|
||||
await appDbContext.DailyNotes.UpdateAndSaveAsync(entry).ConfigureAwait(false);
|
||||
}
|
||||
else
|
||||
{
|
||||
IInfoBarService infoBarService = scope.ServiceProvider.GetRequiredService<IInfoBarService>();
|
||||
|
||||
// Special retcode handling for dailynote
|
||||
if (dailyNoteResponse.ReturnCode == (int)Web.Response.KnownReturnCode.CODE1034)
|
||||
{
|
||||
infoBarService.Warning(dailyNoteResponse.ToString());
|
||||
}
|
||||
else
|
||||
{
|
||||
infoBarService.Error(dailyNoteResponse.ToString());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -141,8 +141,8 @@ internal sealed class GameFpsUnlocker : IGameFpsUnlocker
|
||||
{
|
||||
// E8 ?? ?? ?? ?? 85 C0 7E 07 E8 ?? ?? ?? ?? EB 05
|
||||
int second = 0;
|
||||
ReadOnlySpan<byte> secondPart = new byte[] { 0x85, 0xC0, 0x7E, 0x07, 0xE8, };
|
||||
ReadOnlySpan<byte> thirdPart = new byte[] { 0xEB, 0x05, };
|
||||
ReadOnlySpan<byte> secondPart = stackalloc byte[] { 0x85, 0xC0, 0x7E, 0x07, 0xE8, };
|
||||
ReadOnlySpan<byte> thirdPart = stackalloc byte[] { 0xEB, 0x05, };
|
||||
|
||||
while (second >= 0 && second < memory.Length)
|
||||
{
|
||||
|
||||
@@ -85,7 +85,7 @@ internal sealed partial class MetadataOptions : IOptions<MetadataOptions>
|
||||
public string GetLocalizedRemoteFile(string fileNameWithExtension)
|
||||
{
|
||||
#if DEBUG
|
||||
return Web.HutaoEndpoints.RawGithubUserContentMetadataFile(LocaleName, fileNameWithExtension);
|
||||
return Web.HutaoEndpoints.HutaoMetadata2File(LocaleName, fileNameWithExtension);
|
||||
#else
|
||||
return Web.HutaoEndpoints.HutaoMetadata2File(LocaleName, fileNameWithExtension);
|
||||
#endif
|
||||
|
||||
@@ -9,6 +9,7 @@ using Snap.Hutao.Core.ExceptionService;
|
||||
using Snap.Hutao.Core.IO.Hashing;
|
||||
using Snap.Hutao.Service.Notification;
|
||||
using System.IO;
|
||||
using System.Net;
|
||||
using System.Net.Http;
|
||||
using System.Net.Http.Json;
|
||||
|
||||
@@ -77,7 +78,7 @@ internal sealed partial class MetadataService : IMetadataService, IMetadataServi
|
||||
}
|
||||
catch (HttpRequestException ex)
|
||||
{
|
||||
if (ex.StatusCode == System.Net.HttpStatusCode.Forbidden)
|
||||
if (ex.StatusCode is HttpStatusCode.Forbidden or HttpStatusCode.NotFound)
|
||||
{
|
||||
infoBarService.Error(SH.ServiceMetadataVersionNotSupported);
|
||||
}
|
||||
|
||||
@@ -244,8 +244,8 @@
|
||||
<PackageReference Include="CommunityToolkit.WinUI.Notifications" Version="7.1.2" />
|
||||
<PackageReference Include="CommunityToolkit.WinUI.UI.Behaviors" Version="7.1.2" />
|
||||
<PackageReference Include="CommunityToolkit.WinUI.UI.Controls" Version="7.1.2" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="7.0.5" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="7.0.5">
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="7.0.7" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="7.0.7">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
@@ -261,7 +261,7 @@
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Microsoft.Windows.SDK.BuildTools" Version="10.0.22621.756" />
|
||||
<PackageReference Include="Microsoft.WindowsAppSDK" Version="1.3.230502000" />
|
||||
<PackageReference Include="Microsoft.WindowsAppSDK" Version="1.3.230602002" />
|
||||
<PackageReference Include="StyleCop.Analyzers.Unstable" Version="1.2.0.435">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
|
||||
@@ -238,8 +238,7 @@ internal sealed partial class AvatarPropertyViewModel : Abstraction.ViewModel, I
|
||||
bool clipboardOpened = false;
|
||||
using (SoftwareBitmap softwareBitmap = SoftwareBitmap.CreateCopyFromBuffer(buffer, BitmapPixelFormat.Bgra8, bitmap.PixelWidth, bitmap.PixelHeight))
|
||||
{
|
||||
Color tintColor = serviceProvider.GetRequiredService<IAppResourceProvider>().GetResource<Color>("CompatBackgroundColor");
|
||||
Bgra32 tint = Bgra32.FromColor(tintColor);
|
||||
Bgra32 tint = serviceProvider.GetRequiredService<IAppResourceProvider>().GetResource<Color>("CompatBackgroundColor");
|
||||
softwareBitmap.NormalBlend(tint);
|
||||
using (InMemoryRandomAccessStream memory = new())
|
||||
{
|
||||
|
||||
@@ -109,7 +109,12 @@ internal static class ApiEndpoints
|
||||
/// <summary>
|
||||
/// 发起验证码
|
||||
/// </summary>
|
||||
public const string CardCreateVerification = $"{ApiTakumiCardWApi}/createVerification?is_high=false";
|
||||
/// <param name="highRisk">是否为高风险</param>
|
||||
/// <returns>发起验证码Url</returns>
|
||||
public static string CardCreateVerification(bool highRisk)
|
||||
{
|
||||
return $"{ApiTakumiCardWApi}/createVerification?is_high={Core.StringLiterals.LowerBoolean(highRisk)}";
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 验证验证码
|
||||
|
||||
@@ -46,7 +46,7 @@ internal sealed class CardClient
|
||||
Response<VerificationRegistration>? resp = await httpClient
|
||||
.SetUser(user, CookieType.LToken)
|
||||
.UseDynamicSecret(DynamicSecretVersion.Gen2, SaltType.X4, false)
|
||||
.TryCatchGetFromJsonAsync<Response<VerificationRegistration>>(ApiEndpoints.CardCreateVerification, options, logger, token)
|
||||
.TryCatchGetFromJsonAsync<Response<VerificationRegistration>>(ApiEndpoints.CardCreateVerification(false), options, logger, token)
|
||||
.ConfigureAwait(false);
|
||||
|
||||
return Response.Response.DefaultIfNull(resp);
|
||||
|
||||
@@ -26,6 +26,11 @@ internal sealed class DailyNote : DailyNoteCommon
|
||||
{
|
||||
get
|
||||
{
|
||||
if (ResinRecoveryTime == 0)
|
||||
{
|
||||
return SH.WebDailyNoteResinRecoveryCompleted;
|
||||
}
|
||||
|
||||
DateTime reach = DateTime.Now.AddSeconds(ResinRecoveryTime);
|
||||
int totalDays = (reach - DateTime.Today).Days;
|
||||
string day = totalDays switch
|
||||
|
||||
@@ -63,7 +63,7 @@ internal abstract class DailyNoteCommon
|
||||
public int MaxResin { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 树脂恢复时间 <see cref="string"/>类型的秒数
|
||||
/// 树脂恢复时间的秒数
|
||||
/// </summary>
|
||||
[JsonPropertyName("resin_recovery_time")]
|
||||
public int ResinRecoveryTime { get; set; }
|
||||
|
||||
@@ -51,6 +51,7 @@ internal sealed partial class GameRecordClient : IGameRecordClient
|
||||
// We have a verification procedure to handle
|
||||
if (resp?.ReturnCode == (int)KnownReturnCode.CODE1034)
|
||||
{
|
||||
// Replace message
|
||||
resp.Message = SH.WebDailyNoteVerificationFailed;
|
||||
CardVerifier cardVerifier = serviceProvider.GetRequiredService<CardVerifier>();
|
||||
|
||||
|
||||
@@ -130,10 +130,10 @@ internal sealed class Response<TData> : Response, IJsResult
|
||||
/// <summary>
|
||||
/// 响应是否正常
|
||||
/// </summary>
|
||||
/// <param name="response">响应</param>
|
||||
/// <param name="showInfoBar">是否显示错误信息</param>
|
||||
/// <returns>是否Ok</returns>
|
||||
[MemberNotNullWhen(true, nameof(Data))]
|
||||
public bool IsOk()
|
||||
public bool IsOk(bool showInfoBar = true)
|
||||
{
|
||||
if (ReturnCode == 0)
|
||||
{
|
||||
@@ -143,7 +143,11 @@ internal sealed class Response<TData> : Response, IJsResult
|
||||
}
|
||||
else
|
||||
{
|
||||
Ioc.Default.GetRequiredService<IInfoBarService>().Error(ToString());
|
||||
if (showInfoBar)
|
||||
{
|
||||
Ioc.Default.GetRequiredService<IInfoBarService>().Error(ToString());
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user