mirror of
https://jihulab.com/DGP-Studio/Snap.Hutao.git
synced 2025-11-19 21:02:53 +08:00
fix nuget sources
This commit is contained in:
19
NuGet.Config
Normal file
19
NuGet.Config
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<configuration>
|
||||||
|
<packageSources>
|
||||||
|
<add key="nuget.org" value="https://api.nuget.org/v3/index.json" protocolVersion="3" />
|
||||||
|
<add key="Microsoft CsWin32" value="https://pkgs.dev.azure.com/azure-public/winsdk/_packaging/CI/nuget/v3/index.json" />
|
||||||
|
<add key="CommunityToolkit Labs" value="https://pkgs.dev.azure.com/dotnet/CommunityToolkit/_packaging/CommunityToolkit-Labs/nuget/v3/index.json" />
|
||||||
|
</packageSources>
|
||||||
|
<packageRestore>
|
||||||
|
<add key="enabled" value="True" />
|
||||||
|
<add key="automatic" value="True" />
|
||||||
|
</packageRestore>
|
||||||
|
<bindingRedirects>
|
||||||
|
<add key="skip" value="False" />
|
||||||
|
</bindingRedirects>
|
||||||
|
<packageManagement>
|
||||||
|
<add key="format" value="1" />
|
||||||
|
<add key="disabled" value="False" />
|
||||||
|
</packageManagement>
|
||||||
|
</configuration>
|
||||||
@@ -1,27 +1,59 @@
|
|||||||
// Copyright (c) DGP Studio. All rights reserved.
|
// Copyright (c) DGP Studio. All rights reserved.
|
||||||
// Licensed under the MIT license.
|
// Licensed under the MIT license.
|
||||||
|
|
||||||
using System.Collections.Concurrent;
|
using System.Collections.Immutable;
|
||||||
using System.Globalization;
|
|
||||||
|
|
||||||
namespace Snap.Hutao.Model.Intrinsic.Immutable;
|
namespace Snap.Hutao.Model.Intrinsic.Immutable;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 不可变的原生枚举
|
/// 本地化的不可变的原生枚举
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[HighQuality]
|
[HighQuality]
|
||||||
internal static class IntrinsicImmutables
|
internal static class IntrinsicImmutables
|
||||||
{
|
{
|
||||||
private static readonly ConcurrentDictionary<string, LocalizedIntrinsicImmutables> EnumMap = new();
|
private static readonly ImmutableHashSet<string> associationTypes = Enum.GetValues<AssociationType>().Select(e => e.GetLocalizedDescriptionOrDefault()).OfType<string>().ToImmutableHashSet();
|
||||||
|
private static readonly ImmutableHashSet<string> weaponTypes = Enum.GetValues<WeaponType>().Select(e => e.GetLocalizedDescriptionOrDefault()).OfType<string>().ToImmutableHashSet();
|
||||||
|
private static readonly ImmutableHashSet<string> itemQualities = Enum.GetValues<ItemQuality>().Select(e => e.GetLocalizedDescriptionOrDefault()).OfType<string>().ToImmutableHashSet();
|
||||||
|
private static readonly ImmutableHashSet<string> bodyTypes = Enum.GetValues<BodyType>().Select(e => e.GetLocalizedDescriptionOrDefault()).OfType<string>().ToImmutableHashSet();
|
||||||
|
private static readonly ImmutableHashSet<string> fightProperties = Enum.GetValues<FightProperty>().Select(e => e.GetLocalizedDescriptionOrDefault()).OfType<string>().ToImmutableHashSet();
|
||||||
|
private static readonly ImmutableHashSet<string> elementNames = new HashSet<string>(7)
|
||||||
|
{
|
||||||
|
SH.ModelIntrinsicElementNameFire,
|
||||||
|
SH.ModelIntrinsicElementNameWater,
|
||||||
|
SH.ModelIntrinsicElementNameGrass,
|
||||||
|
SH.ModelIntrinsicElementNameElec,
|
||||||
|
SH.ModelIntrinsicElementNameWind,
|
||||||
|
SH.ModelIntrinsicElementNameIce,
|
||||||
|
SH.ModelIntrinsicElementNameRock,
|
||||||
|
}.ToImmutableHashSet();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 获取当前语言的枚举
|
/// 所属地区
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="culture">指定的语言</param>
|
public static ImmutableHashSet<string> AssociationTypes { get => associationTypes; }
|
||||||
/// <returns>枚举</returns>
|
|
||||||
public static LocalizedIntrinsicImmutables GetForCurrentCulture(CultureInfo? culture = default)
|
/// <summary>
|
||||||
{
|
/// 武器类型
|
||||||
culture ??= CultureInfo.CurrentCulture;
|
/// </summary>
|
||||||
return EnumMap.GetOrAdd(culture.Name, (name) => new());
|
public static ImmutableHashSet<string> WeaponTypes { get => weaponTypes; }
|
||||||
}
|
|
||||||
|
/// <summary>
|
||||||
|
/// 物品类型
|
||||||
|
/// </summary>
|
||||||
|
public static ImmutableHashSet<string> ItemQualities { get => itemQualities; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 身材类型
|
||||||
|
/// </summary>
|
||||||
|
public static ImmutableHashSet<string> BodyTypes { get => bodyTypes; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 战斗属性
|
||||||
|
/// </summary>
|
||||||
|
public static ImmutableHashSet<string> FightProperties { get => fightProperties; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 元素名称
|
||||||
|
/// </summary>
|
||||||
|
public static ImmutableHashSet<string> ElementNames { get => elementNames; }
|
||||||
}
|
}
|
||||||
@@ -1,59 +0,0 @@
|
|||||||
// Copyright (c) DGP Studio. All rights reserved.
|
|
||||||
// Licensed under the MIT license.
|
|
||||||
|
|
||||||
using System.Collections.Immutable;
|
|
||||||
|
|
||||||
namespace Snap.Hutao.Model.Intrinsic.Immutable;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 本地化的不可变的原生枚举
|
|
||||||
/// </summary>
|
|
||||||
[HighQuality]
|
|
||||||
internal sealed class LocalizedIntrinsicImmutables
|
|
||||||
{
|
|
||||||
private readonly ImmutableHashSet<string> associationTypes = Enum.GetValues<AssociationType>().Select(e => e.GetLocalizedDescriptionOrDefault()).OfType<string>().ToImmutableHashSet();
|
|
||||||
private readonly ImmutableHashSet<string> weaponTypes = Enum.GetValues<WeaponType>().Select(e => e.GetLocalizedDescriptionOrDefault()).OfType<string>().ToImmutableHashSet();
|
|
||||||
private readonly ImmutableHashSet<string> itemQualities = Enum.GetValues<ItemQuality>().Select(e => e.GetLocalizedDescriptionOrDefault()).OfType<string>().ToImmutableHashSet();
|
|
||||||
private readonly ImmutableHashSet<string> bodyTypes = Enum.GetValues<BodyType>().Select(e => e.GetLocalizedDescriptionOrDefault()).OfType<string>().ToImmutableHashSet();
|
|
||||||
private readonly ImmutableHashSet<string> fightProperties = Enum.GetValues<FightProperty>().Select(e => e.GetLocalizedDescriptionOrDefault()).OfType<string>().ToImmutableHashSet();
|
|
||||||
private readonly ImmutableHashSet<string> elementNames = new HashSet<string>(7)
|
|
||||||
{
|
|
||||||
SH.ModelIntrinsicElementNameFire,
|
|
||||||
SH.ModelIntrinsicElementNameWater,
|
|
||||||
SH.ModelIntrinsicElementNameGrass,
|
|
||||||
SH.ModelIntrinsicElementNameElec,
|
|
||||||
SH.ModelIntrinsicElementNameWind,
|
|
||||||
SH.ModelIntrinsicElementNameIce,
|
|
||||||
SH.ModelIntrinsicElementNameRock,
|
|
||||||
}.ToImmutableHashSet();
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 所属地区
|
|
||||||
/// </summary>
|
|
||||||
public ImmutableHashSet<string> AssociationTypes { get => associationTypes; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 武器类型
|
|
||||||
/// </summary>
|
|
||||||
public ImmutableHashSet<string> WeaponTypes { get => weaponTypes; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 物品类型
|
|
||||||
/// </summary>
|
|
||||||
public ImmutableHashSet<string> ItemQualities { get => itemQualities; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 身材类型
|
|
||||||
/// </summary>
|
|
||||||
public ImmutableHashSet<string> BodyTypes { get => bodyTypes; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 战斗属性
|
|
||||||
/// </summary>
|
|
||||||
public ImmutableHashSet<string> FightProperties { get => fightProperties; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 元素名称
|
|
||||||
/// </summary>
|
|
||||||
public ImmutableHashSet<string> ElementNames { get => elementNames; }
|
|
||||||
}
|
|
||||||
@@ -2,7 +2,7 @@
|
|||||||
"profiles": {
|
"profiles": {
|
||||||
"Snap.Hutao (Package)": {
|
"Snap.Hutao (Package)": {
|
||||||
"commandName": "MsixPackage",
|
"commandName": "MsixPackage",
|
||||||
"nativeDebugging": true,
|
"nativeDebugging": false,
|
||||||
"doNotLaunchApp": false,
|
"doNotLaunchApp": false,
|
||||||
"allowLocalNetworkLoopbackProperty": true
|
"allowLocalNetworkLoopbackProperty": true
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -223,10 +223,9 @@
|
|||||||
<Content Include="Resource\WelcomeView_Background.png" />
|
<Content Include="Resource\WelcomeView_Background.png" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<!-- Packages -->
|
<!-- Packages -->
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<!-- https://pkgs.dev.azure.com/dotnet/CommunityToolkit/_packaging/CommunityToolkit-Labs/nuget/v3/index.json -->
|
||||||
<PackageReference Include="CommunityToolkit.Labs.WinUI.SettingsControls" Version="0.0.17" />
|
<PackageReference Include="CommunityToolkit.Labs.WinUI.SettingsControls" Version="0.0.17" />
|
||||||
<PackageReference Include="CommunityToolkit.Mvvm" Version="8.1.0" />
|
<PackageReference Include="CommunityToolkit.Mvvm" Version="8.1.0" />
|
||||||
<PackageReference Include="CommunityToolkit.WinUI.Notifications" Version="7.1.2" />
|
<PackageReference Include="CommunityToolkit.WinUI.Notifications" Version="7.1.2" />
|
||||||
|
|||||||
@@ -256,7 +256,6 @@ internal sealed class WikiAvatarViewModel : Abstraction.ViewModel
|
|||||||
private static bool DoFilter(string input, Avatar avatar)
|
private static bool DoFilter(string input, Avatar avatar)
|
||||||
{
|
{
|
||||||
List<bool> matches = new();
|
List<bool> matches = new();
|
||||||
LocalizedIntrinsicImmutables intrinsics = IntrinsicImmutables.GetForCurrentCulture();
|
|
||||||
|
|
||||||
foreach (StringSegment segment in new StringTokenizer(input, ' '.Enumerate().ToArray()))
|
foreach (StringSegment segment in new StringTokenizer(input, ' '.Enumerate().ToArray()))
|
||||||
{
|
{
|
||||||
@@ -268,31 +267,31 @@ internal sealed class WikiAvatarViewModel : Abstraction.ViewModel
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (intrinsics.ElementNames.Contains(value))
|
if (IntrinsicImmutables.ElementNames.Contains(value))
|
||||||
{
|
{
|
||||||
matches.Add(avatar.FetterInfo.VisionBefore == value);
|
matches.Add(avatar.FetterInfo.VisionBefore == value);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (intrinsics.AssociationTypes.Contains(value))
|
if (IntrinsicImmutables.AssociationTypes.Contains(value))
|
||||||
{
|
{
|
||||||
matches.Add(avatar.FetterInfo.Association.GetLocalizedDescriptionOrDefault() == value);
|
matches.Add(avatar.FetterInfo.Association.GetLocalizedDescriptionOrDefault() == value);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (intrinsics.WeaponTypes.Contains(value))
|
if (IntrinsicImmutables.WeaponTypes.Contains(value))
|
||||||
{
|
{
|
||||||
matches.Add(avatar.Weapon.GetLocalizedDescriptionOrDefault() == value);
|
matches.Add(avatar.Weapon.GetLocalizedDescriptionOrDefault() == value);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (intrinsics.ItemQualities.Contains(value))
|
if (IntrinsicImmutables.ItemQualities.Contains(value))
|
||||||
{
|
{
|
||||||
matches.Add(avatar.Quality.GetLocalizedDescriptionOrDefault() == value);
|
matches.Add(avatar.Quality.GetLocalizedDescriptionOrDefault() == value);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (intrinsics.BodyTypes.Contains(value))
|
if (IntrinsicImmutables.BodyTypes.Contains(value))
|
||||||
{
|
{
|
||||||
matches.Add(avatar.Body.GetLocalizedDescriptionOrDefault() == value);
|
matches.Add(avatar.Body.GetLocalizedDescriptionOrDefault() == value);
|
||||||
continue;
|
continue;
|
||||||
|
|||||||
@@ -246,7 +246,6 @@ internal class WikiWeaponViewModel : Abstraction.ViewModel
|
|||||||
private static bool DoFilter(string input, Weapon weapon)
|
private static bool DoFilter(string input, Weapon weapon)
|
||||||
{
|
{
|
||||||
List<bool> matches = new();
|
List<bool> matches = new();
|
||||||
LocalizedIntrinsicImmutables intrinsics = IntrinsicImmutables.GetForCurrentCulture();
|
|
||||||
|
|
||||||
foreach (StringSegment segment in new StringTokenizer(input, ' '.Enumerate().ToArray()))
|
foreach (StringSegment segment in new StringTokenizer(input, ' '.Enumerate().ToArray()))
|
||||||
{
|
{
|
||||||
@@ -258,19 +257,19 @@ internal class WikiWeaponViewModel : Abstraction.ViewModel
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (intrinsics.WeaponTypes.Contains(value))
|
if (IntrinsicImmutables.WeaponTypes.Contains(value))
|
||||||
{
|
{
|
||||||
matches.Add(weapon.WeaponType.GetLocalizedDescriptionOrDefault() == value);
|
matches.Add(weapon.WeaponType.GetLocalizedDescriptionOrDefault() == value);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (intrinsics.ItemQualities.Contains(value))
|
if (IntrinsicImmutables.ItemQualities.Contains(value))
|
||||||
{
|
{
|
||||||
matches.Add(weapon.Quality.GetLocalizedDescriptionOrDefault() == value);
|
matches.Add(weapon.Quality.GetLocalizedDescriptionOrDefault() == value);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (intrinsics.FightProperties.Contains(value))
|
if (IntrinsicImmutables.FightProperties.Contains(value))
|
||||||
{
|
{
|
||||||
matches.Add(weapon.GrowCurves.ElementAtOrDefault(1).Key.GetLocalizedDescriptionOrDefault() == value);
|
matches.Add(weapon.GrowCurves.ElementAtOrDefault(1).Key.GetLocalizedDescriptionOrDefault() == value);
|
||||||
continue;
|
continue;
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
// Copyright (c) DGP Studio. All rights reserved.
|
// Copyright (c) DGP Studio. All rights reserved.
|
||||||
// Licensed under the MIT license.
|
// Licensed under the MIT license.
|
||||||
|
|
||||||
|
using System.Runtime.InteropServices;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using Windows.Win32.Foundation;
|
using Windows.Win32.Foundation;
|
||||||
|
|
||||||
@@ -19,6 +20,7 @@ internal static class MemoryExtension
|
|||||||
/// <returns>结果字符串</returns>
|
/// <returns>结果字符串</returns>
|
||||||
public static unsafe string AsString(this in __CHAR_256 char256)
|
public static unsafe string AsString(this in __CHAR_256 char256)
|
||||||
{
|
{
|
||||||
|
MemoryMarshal.AsBytes(char256.AsReadOnlySpan());
|
||||||
fixed (CHAR* pszModule = &char256._0)
|
fixed (CHAR* pszModule = &char256._0)
|
||||||
{
|
{
|
||||||
return Encoding.UTF8.GetString((byte*)pszModule, StringLength(pszModule));
|
return Encoding.UTF8.GetString((byte*)pszModule, StringLength(pszModule));
|
||||||
|
|||||||
Reference in New Issue
Block a user