mirror of
https://jihulab.com/DGP-Studio/Snap.Hutao.git
synced 2025-11-19 21:02:53 +08:00
fix collection style
This commit is contained in:
@@ -39,8 +39,10 @@ public sealed class ResxGenerator : IIncrementalGenerator
|
||||
private static void Execute(SourceProductionContext context, AnalyzerConfigOptionsProvider options, string? assemblyName, bool supportNullableReferenceTypes, ImmutableArray<AdditionalText> files)
|
||||
{
|
||||
// Group additional file by resource kind ((a.resx, a.en.resx, a.en-us.resx), (b.resx, b.en-us.resx))
|
||||
List<IGrouping<string, AdditionalText>> resxGroups = [.. files.GroupBy(file => GetResourceName(file.Path), StringComparer.OrdinalIgnoreCase).OrderBy(x => x.Key, StringComparer.Ordinal)];
|
||||
|
||||
IOrderedEnumerable<IGrouping<string, AdditionalText>> group = files
|
||||
.GroupBy(file => GetResourceName(file.Path), StringComparer.OrdinalIgnoreCase)
|
||||
.OrderBy(x => x.Key, StringComparer.Ordinal);
|
||||
List<IGrouping<string, AdditionalText>> resxGroups = [.. group];
|
||||
|
||||
foreach (IGrouping<string, AdditionalText>? resxGroug in resxGroups)
|
||||
{
|
||||
|
||||
@@ -129,7 +129,8 @@ internal sealed partial class AchievementDbService : IAchievementDbService
|
||||
using (IServiceScope scope = serviceProvider.CreateScope())
|
||||
{
|
||||
AppDbContext appDbContext = scope.ServiceProvider.GetRequiredService<AppDbContext>();
|
||||
return [.. appDbContext.Achievements.AsNoTracking().Where(i => i.ArchiveId == archiveId)];
|
||||
IQueryable<EntityAchievement> result = appDbContext.Achievements.AsNoTracking().Where(i => i.ArchiveId == archiveId);
|
||||
return [.. result];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -151,7 +152,8 @@ internal sealed partial class AchievementDbService : IAchievementDbService
|
||||
using (IServiceScope scope = serviceProvider.CreateScope())
|
||||
{
|
||||
AppDbContext appDbContext = scope.ServiceProvider.GetRequiredService<AppDbContext>();
|
||||
return [.. appDbContext.AchievementArchives.AsNoTracking()];
|
||||
IQueryable<AchievementArchive> result = appDbContext.AchievementArchives.AsNoTracking();
|
||||
return [.. result];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -19,7 +19,8 @@ internal sealed partial class AvatarInfoDbService : IAvatarInfoDbService
|
||||
using (IServiceScope scope = serviceProvider.CreateScope())
|
||||
{
|
||||
AppDbContext appDbContext = scope.ServiceProvider.GetRequiredService<AppDbContext>();
|
||||
return [.. appDbContext.AvatarInfos.AsNoTracking().Where(i => i.Uid == uid)];
|
||||
IQueryable<EntityAvatarInfo> result = appDbContext.AvatarInfos.AsNoTracking().Where(i => i.Uid == uid);
|
||||
return [.. result];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
// Licensed under the MIT license.
|
||||
|
||||
using Snap.Hutao.Web.Hoyolab.Hk4e.Event.GachaInfo;
|
||||
using System.Collections.Frozen;
|
||||
using System.Collections.Immutable;
|
||||
|
||||
namespace Snap.Hutao.Service.GachaLog;
|
||||
@@ -14,11 +15,11 @@ internal static class GachaLog
|
||||
/// <summary>
|
||||
/// 查询类型
|
||||
/// </summary>
|
||||
public static readonly ImmutableList<GachaConfigType> QueryTypes = new List<GachaConfigType>
|
||||
{
|
||||
public static readonly FrozenSet<GachaConfigType> QueryTypes = FrozenSet.ToFrozenSet(
|
||||
[
|
||||
GachaConfigType.NoviceWish,
|
||||
GachaConfigType.StandardWish,
|
||||
GachaConfigType.AvatarEventWish,
|
||||
GachaConfigType.WeaponEventWish,
|
||||
}.ToImmutableList(); // TODO: FrozenSet
|
||||
]);
|
||||
}
|
||||
@@ -160,7 +160,7 @@ internal sealed partial class GuideViewModel : Abstraction.ViewModel
|
||||
|
||||
private async ValueTask DownloadStaticResourceAsync()
|
||||
{
|
||||
HashSet<DownloadSummary> downloadSummaries = new();
|
||||
HashSet<DownloadSummary> downloadSummaries = [];
|
||||
|
||||
HashSet<string> categories = StaticResource.GetUnfulfilledCategorySet();
|
||||
|
||||
|
||||
@@ -87,17 +87,17 @@ internal sealed partial class WikiWeaponViewModel : Abstraction.ViewModel
|
||||
Dictionary<MaterialId, Material> idMaterialMap = await metadataService.GetIdToMaterialMapAsync().ConfigureAwait(false);
|
||||
|
||||
List<Weapon> weapons = await metadataService.GetWeaponsAsync().ConfigureAwait(false);
|
||||
List<Weapon> sorted = weapons
|
||||
IEnumerable<Weapon> sorted = weapons
|
||||
.OrderByDescending(weapon => weapon.RankLevel)
|
||||
.ThenBy(weapon => weapon.WeaponType)
|
||||
.ThenByDescending(weapon => weapon.Id.Value)
|
||||
.ToList();
|
||||
.ThenByDescending(weapon => weapon.Id.Value);
|
||||
List<Weapon> list = [.. sorted];
|
||||
|
||||
await CombineComplexDataAsync(sorted, idMaterialMap).ConfigureAwait(false);
|
||||
await CombineComplexDataAsync(list, idMaterialMap).ConfigureAwait(false);
|
||||
|
||||
await taskContext.SwitchToMainThreadAsync();
|
||||
|
||||
Weapons = new AdvancedCollectionView(sorted, true);
|
||||
Weapons = new AdvancedCollectionView(list, true);
|
||||
Selected = Weapons.Cast<Weapon>().FirstOrDefault();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user