code style

This commit is contained in:
Lightczx
2024-01-25 12:55:26 +08:00
parent f83174d690
commit 948ec9a822
28 changed files with 171 additions and 42 deletions

View File

@@ -160,9 +160,39 @@ public sealed class GeniusInvokationDecoding
ushort[] testKnownResult =
[
060, 019, 001, 079, 120, 120, 129, 151, 151, 153, 153,
181, 184, 184, 185, 185, 194, 194, 200, 200, 201, 201,
217, 217, 219, 241, 241, 244, 244, 245, 245, 270, 270,
060,
019,
001,
079,
120,
120,
129,
151,
151,
153,
153,
181,
184,
184,
185,
185,
194,
194,
200,
200,
201,
201,
217,
217,
219,
241,
241,
244,
244,
245,
245,
270,
270,
];
CollectionAssert.AreEqual(resultArray, testKnownResult);

View File

@@ -89,6 +89,7 @@ internal static partial class IocHttpClientConfiguration
/// HoYoLAB web
/// </summary>
/// <param name="client">配置后的客户端</param>
[SuppressMessage("", "IDE0051")]
private static void XRpc4Configuration(HttpClient client)
{
client.Timeout = Timeout.InfiniteTimeSpan;

View File

@@ -109,7 +109,7 @@ internal sealed class WindowController
GetWindowPlacement(options.Hwnd, ref windowPlacement);
// prevent save value when we are maximized.
if (!windowPlacement.showCmd.HasFlag(SHOW_WINDOW_CMD.SW_SHOWMAXIMIZED))
if (!windowPlacement.ShowCmd.HasFlag(SHOW_WINDOW_CMD.SW_SHOWMAXIMIZED))
{
double scale = 1.0 / options.GetRasterizationScale();
LocalSetting.Set(SettingKeys.WindowRect, (CompactRect)window.AppWindow.GetRect().Scale(scale));

View File

@@ -7,7 +7,6 @@ using Snap.Hutao.Core.Windowing.HotKey;
using Snap.Hutao.Win32.Foundation;
using Snap.Hutao.Win32.UI.Shell;
using Snap.Hutao.Win32.UI.WindowsAndMessaging;
using System.Runtime.InteropServices;
using static Snap.Hutao.Win32.ComCtl32;
using static Snap.Hutao.Win32.ConstValues;
using static Snap.Hutao.Win32.User32;

View File

@@ -13,43 +13,118 @@ internal static class Materials
{
public static FrozenSet<MaterialId> MondayThursdayItems { get; } = FrozenSet.ToFrozenSet<MaterialId>(
[
104301U, 104302U, 104303U, // 「自由」
104310U, 104311U, 104312U, // 「繁荣」
104320U, 104321U, 104322U, // 「浮世
104329U, 104330U, 104331U, // 「诤言」
104338U, 104339U, 104340U, // 「公平」
114001U, 114002U, 114003U, 114004U, // 高塔孤王
114013U, 114014U, 114015U, 114016U, // 孤云寒林
114025U, 114026U, 114027U, 114028U, // 远海夷地
114037U, 114038U, 114039U, 114040U, // 谧林涓露
114049U, 114050U, 114051U, 114052U, // 悠古弦音
104301U,
104302U,
104303U, // 「自由
104310U,
104311U,
104312U, // 「繁荣」
104320U,
104321U,
104322U, // 「浮世」
104329U,
104330U,
104331U, // 「诤言」
104338U,
104339U,
104340U, // 「公平」
114001U,
114002U,
114003U,
114004U, // 高塔孤王
114013U,
114014U,
114015U,
114016U, // 孤云寒林
114025U,
114026U,
114027U,
114028U, // 远海夷地
114037U,
114038U,
114039U,
114040U, // 谧林涓露
114049U,
114050U,
114051U,
114052U, // 悠古弦音
]);
public static FrozenSet<MaterialId> TuesdayFridayItems { get; } = FrozenSet.ToFrozenSet<MaterialId>(
[
104304U, 104305U, 104306U, // 「抗争」
104313U, 104314U, 104315U, // 「勤劳」
104323U, 104324U, 104325U, // 「风雅
104332U, 104333U, 104334U, // 「巧思」
104341U, 104342U, 104343U, // 「正义」
114005U, 114006U, 114007U, 114008U, // 凛风奔狼
114017U, 114018U, 114019U, 114020U, // 雾海云间
114029U, 114030U, 114031U, 114032U, // 鸣神御灵
114041U, 114042U, 114043U, 114044U, // 绿洲花园
114053U, 114054U, 114055U, 114056U, // 纯圣露滴
104304U,
104305U,
104306U, // 「抗争
104313U,
104314U,
104315U, // 「勤劳」
104323U,
104324U,
104325U, // 「风雅」
104332U,
104333U,
104334U, // 「巧思」
104341U,
104342U,
104343U, // 「正义」
114005U,
114006U,
114007U,
114008U, // 凛风奔狼
114017U,
114018U,
114019U,
114020U, // 雾海云间
114029U,
114030U,
114031U,
114032U, // 鸣神御灵
114041U,
114042U,
114043U,
114044U, // 绿洲花园
114053U,
114054U,
114055U,
114056U, // 纯圣露滴
]);
public static FrozenSet<MaterialId> WednesdaySaturdayItems { get; } = FrozenSet.ToFrozenSet<MaterialId>(
[
104307U, 104308U, 104309U, // 「诗文」
104316U, 104317U, 104318U, // 「黄金」
104326U, 104327U, 104328U, // 「天光
104335U, 104336U, 104337U, // 「笃行」
104344U, 104345U, 104346U, // 「秩序」
114009U, 114010U, 114011U, 114012U, // 狮牙斗士
114021U, 114022U, 114023U, 114024U, // 漆黑陨铁
114033U, 114034U, 114035U, 114036U, // 今昔剧画
114045U, 114046U, 114047U, 114048U, // 谧林涓露
114057U, 114058U, 114059U, 114060U, // 无垢之海
104307U,
104308U,
104309U, // 「诗文
104316U,
104317U,
104318U, // 「黄金」
104326U,
104327U,
104328U, // 「天光」
104335U,
104336U,
104337U, // 「笃行」
104344U,
104345U,
104346U, // 「秩序」
114009U,
114010U,
114011U,
114012U, // 狮牙斗士
114021U,
114022U,
114023U,
114024U, // 漆黑陨铁
114033U,
114034U,
114035U,
114036U, // 今昔剧画
114045U,
114046U,
114047U,
114048U, // 谧林涓露
114057U,
114058U,
114059U,
114060U, // 无垢之海
]);
}

View File

@@ -164,7 +164,7 @@ internal sealed partial class GuideViewModel : Abstraction.ViewModel
.Select(category => new DownloadSummary(serviceProvider, category))
.ToObservableCollection();
await Parallel.ForEachAsync([..DownloadSummaries], async (summary, token) =>
await Parallel.ForEachAsync([.. DownloadSummaries], async (summary, token) =>
{
if (await summary.DownloadAndExtractAsync().ConfigureAwait(false))
{

View File

@@ -8,6 +8,7 @@ using System.Runtime.Versioning;
namespace Snap.Hutao.Win32;
// [SuppressMessage("", "SH002")]
[SuppressMessage("", "SYSLIB1054")]
internal static class ComCtl32
{

View File

@@ -7,6 +7,8 @@ using System.Runtime.Versioning;
namespace Snap.Hutao.Win32;
[SuppressMessage("", "SH002")]
[SuppressMessage("", "SYSLIB1054")]
internal static class Gdi32
{
[DllImport("GDI32.dll", ExactSpelling = true)]

View File

@@ -10,6 +10,8 @@ using System.Runtime.Versioning;
namespace Snap.Hutao.Win32;
[SuppressMessage("", "SH002")]
[SuppressMessage("", "SYSLIB1054")]
internal static class Kernel32
{
[DllImport("KERNEL32.dll", ExactSpelling = true, SetLastError = true)]

View File

@@ -7,6 +7,7 @@ using System.Runtime.CompilerServices;
namespace Snap.Hutao.Win32;
[SuppressMessage("", "SH002")]
internal static class Macros
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]

View File

@@ -8,6 +8,8 @@ using System.Runtime.Versioning;
namespace Snap.Hutao.Win32;
// [SuppressMessage("", "SH002")]
[SuppressMessage("", "SYSLIB1054")]
internal static class Ole32
{
[DllImport("OLE32.dll", ExactSpelling = true)]

View File

@@ -3,6 +3,7 @@
namespace Snap.Hutao.Win32.Registry;
[SuppressMessage("", "CA1069")]
[Flags]
internal enum REG_SAM_FLAGS : uint
{

View File

@@ -8,6 +8,8 @@ using System.Runtime.Versioning;
namespace Snap.Hutao.Win32;
[SuppressMessage("", "SH002")]
[SuppressMessage("", "SYSLIB1054")]
internal static class Shell32
{
[DllImport("SHELL32.dll", ExactSpelling = true)]

View File

@@ -3,6 +3,7 @@
namespace Snap.Hutao.Win32.System.Com;
[SuppressMessage("", "CA1069")]
[Flags]
internal enum CLSCTX : uint
{

View File

@@ -3,6 +3,7 @@
namespace Snap.Hutao.Win32.System.Com;
[SuppressMessage("", "CA1069")]
internal enum STGM : uint
{
STGM_DIRECT = 0u,

View File

@@ -3,6 +3,7 @@
namespace Snap.Hutao.Win32.System.Console;
[SuppressMessage("", "CA1069")]
[Flags]
internal enum CONSOLE_MODE : uint
{

View File

@@ -3,6 +3,7 @@
namespace Snap.Hutao.Win32.System.Diagnostics.Debug;
[SuppressMessage("", "CA1069")]
internal enum FACILITY_CODE : uint
{
FACILITY_NULL = 0u,

View File

@@ -3,6 +3,7 @@
namespace Snap.Hutao.Win32.System.SystemServices;
[SuppressMessage("", "CA1069")]
[Flags]
internal enum SFGAO_FLAGS : uint
{

View File

@@ -6,6 +6,7 @@ using System.Runtime.InteropServices;
namespace Snap.Hutao.Win32.System.WinRT;
[SuppressMessage("", "SYSLIB1096")]
[ComImport]
[Guid("5B0D3235-4DBA-4D44-865E-8F1D0E4FD04D")]
[InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]

View File

@@ -12,7 +12,7 @@ internal struct INPUT
public AnonymousUnion Anonymous;
[StructLayout(LayoutKind.Explicit)]
public struct AnonymousUnion
internal struct AnonymousUnion
{
[FieldOffset(0)]
public MOUSEINPUT mi;

View File

@@ -3,6 +3,7 @@
namespace Snap.Hutao.Win32.UI.Input.KeyboardAndMouse;
[SuppressMessage("", "CA1069")]
internal enum VIRTUAL_KEY : ushort
{
VK_0 = 48,

View File

@@ -9,6 +9,7 @@ using System.Runtime.Versioning;
namespace Snap.Hutao.Win32.UI.Shell;
[SuppressMessage("", "SH002")]
[SupportedOSPlatform("windows6.0.6000")]
internal unsafe struct IFileDialog
{

View File

@@ -4,6 +4,7 @@
namespace Snap.Hutao.Win32.UI.Shell;
[Flags]
[SuppressMessage("", "CA1069")]
internal enum SIATTRIBFLAGS
{
SIATTRIBFLAGS_AND = 1,

View File

@@ -3,6 +3,7 @@
namespace Snap.Hutao.Win32.UI.WindowsAndMessaging;
[SuppressMessage("", "CA1069")]
internal enum SHOW_WINDOW_CMD : int
{
SW_HIDE = 0,

View File

@@ -6,21 +6,20 @@ using Snap.Hutao.Win32.Foundation;
namespace Snap.Hutao.Win32.UI.WindowsAndMessaging;
[SuppressMessage("", "SA1202")]
[SuppressMessage("", "SA1300")]
[SuppressMessage("", "SA1307")]
internal struct WINDOWPLACEMENT
{
public uint length;
public WINDOWPLACEMENT_FLAGS flags;
private uint privateShowCmd;
private uint showCmd;
public POINT ptMinPosition;
public POINT ptMaxPosition;
public RECT rcNormalPosition;
public SHOW_WINDOW_CMD showCmd
public SHOW_WINDOW_CMD ShowCmd
{
get => (SHOW_WINDOW_CMD)privateShowCmd;
set => privateShowCmd = (uint)value;
readonly get => (SHOW_WINDOW_CMD)showCmd;
set => showCmd = (uint)value;
}
public static unsafe WINDOWPLACEMENT Create()

View File

@@ -3,6 +3,7 @@
namespace Snap.Hutao.Win32.UI.WindowsAndMessaging;
[SuppressMessage("", "CA1069")]
[Flags]
internal enum WINDOW_EX_STYLE : uint
{

View File

@@ -3,6 +3,7 @@
namespace Snap.Hutao.Win32.UI.WindowsAndMessaging;
[SuppressMessage("", "CA1069")]
internal enum WINDOW_LONG_PTR_INDEX
{
GWL_EXSTYLE = -20,

View File

@@ -10,6 +10,8 @@ using System.Runtime.Versioning;
namespace Snap.Hutao.Win32;
[SuppressMessage("", "SH002")]
[SuppressMessage("", "SYSLIB1054")]
internal static class User32
{
[DllImport("USER32.dll", ExactSpelling = true)]