Skip to content

Commit ad883a6

Browse files
committed
更新框架和依赖
1 parent 47680c9 commit ad883a6

17 files changed

+59
-76
lines changed

APKInstaller.sln

-16
Original file line numberDiff line numberDiff line change
@@ -13,19 +13,14 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Zeroconf", "APKInstaller\Ze
1313
EndProject
1414
Global
1515
GlobalSection(SolutionConfigurationPlatforms) = preSolution
16-
Debug|Any CPU = Debug|Any CPU
1716
Debug|ARM64 = Debug|ARM64
1817
Debug|x64 = Debug|x64
1918
Debug|x86 = Debug|x86
20-
Release|Any CPU = Release|Any CPU
2119
Release|ARM64 = Release|ARM64
2220
Release|x64 = Release|x64
2321
Release|x86 = Release|x86
2422
EndGlobalSection
2523
GlobalSection(ProjectConfigurationPlatforms) = postSolution
26-
{DA7A7229-52EB-4054-BFD6-B454D694FBEC}.Debug|Any CPU.ActiveCfg = Debug|x64
27-
{DA7A7229-52EB-4054-BFD6-B454D694FBEC}.Debug|Any CPU.Build.0 = Debug|x64
28-
{DA7A7229-52EB-4054-BFD6-B454D694FBEC}.Debug|Any CPU.Deploy.0 = Debug|x64
2924
{DA7A7229-52EB-4054-BFD6-B454D694FBEC}.Debug|ARM64.ActiveCfg = Debug|ARM64
3025
{DA7A7229-52EB-4054-BFD6-B454D694FBEC}.Debug|ARM64.Build.0 = Debug|ARM64
3126
{DA7A7229-52EB-4054-BFD6-B454D694FBEC}.Debug|ARM64.Deploy.0 = Debug|ARM64
@@ -35,9 +30,6 @@ Global
3530
{DA7A7229-52EB-4054-BFD6-B454D694FBEC}.Debug|x86.ActiveCfg = Debug|x86
3631
{DA7A7229-52EB-4054-BFD6-B454D694FBEC}.Debug|x86.Build.0 = Debug|x86
3732
{DA7A7229-52EB-4054-BFD6-B454D694FBEC}.Debug|x86.Deploy.0 = Debug|x86
38-
{DA7A7229-52EB-4054-BFD6-B454D694FBEC}.Release|Any CPU.ActiveCfg = Release|x64
39-
{DA7A7229-52EB-4054-BFD6-B454D694FBEC}.Release|Any CPU.Build.0 = Release|x64
40-
{DA7A7229-52EB-4054-BFD6-B454D694FBEC}.Release|Any CPU.Deploy.0 = Release|x64
4133
{DA7A7229-52EB-4054-BFD6-B454D694FBEC}.Release|ARM64.ActiveCfg = Release|ARM64
4234
{DA7A7229-52EB-4054-BFD6-B454D694FBEC}.Release|ARM64.Build.0 = Release|ARM64
4335
{DA7A7229-52EB-4054-BFD6-B454D694FBEC}.Release|ARM64.Deploy.0 = Release|ARM64
@@ -47,32 +39,24 @@ Global
4739
{DA7A7229-52EB-4054-BFD6-B454D694FBEC}.Release|x86.ActiveCfg = Release|x86
4840
{DA7A7229-52EB-4054-BFD6-B454D694FBEC}.Release|x86.Build.0 = Release|x86
4941
{DA7A7229-52EB-4054-BFD6-B454D694FBEC}.Release|x86.Deploy.0 = Release|x86
50-
{A4B1E6D3-CFEF-4369-9B5F-197E3F921FD2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
51-
{A4B1E6D3-CFEF-4369-9B5F-197E3F921FD2}.Debug|Any CPU.Build.0 = Debug|Any CPU
5242
{A4B1E6D3-CFEF-4369-9B5F-197E3F921FD2}.Debug|ARM64.ActiveCfg = Debug|Any CPU
5343
{A4B1E6D3-CFEF-4369-9B5F-197E3F921FD2}.Debug|ARM64.Build.0 = Debug|Any CPU
5444
{A4B1E6D3-CFEF-4369-9B5F-197E3F921FD2}.Debug|x64.ActiveCfg = Debug|Any CPU
5545
{A4B1E6D3-CFEF-4369-9B5F-197E3F921FD2}.Debug|x64.Build.0 = Debug|Any CPU
5646
{A4B1E6D3-CFEF-4369-9B5F-197E3F921FD2}.Debug|x86.ActiveCfg = Debug|Any CPU
5747
{A4B1E6D3-CFEF-4369-9B5F-197E3F921FD2}.Debug|x86.Build.0 = Debug|Any CPU
58-
{A4B1E6D3-CFEF-4369-9B5F-197E3F921FD2}.Release|Any CPU.ActiveCfg = Release|Any CPU
59-
{A4B1E6D3-CFEF-4369-9B5F-197E3F921FD2}.Release|Any CPU.Build.0 = Release|Any CPU
6048
{A4B1E6D3-CFEF-4369-9B5F-197E3F921FD2}.Release|ARM64.ActiveCfg = Release|Any CPU
6149
{A4B1E6D3-CFEF-4369-9B5F-197E3F921FD2}.Release|ARM64.Build.0 = Release|Any CPU
6250
{A4B1E6D3-CFEF-4369-9B5F-197E3F921FD2}.Release|x64.ActiveCfg = Release|Any CPU
6351
{A4B1E6D3-CFEF-4369-9B5F-197E3F921FD2}.Release|x64.Build.0 = Release|Any CPU
6452
{A4B1E6D3-CFEF-4369-9B5F-197E3F921FD2}.Release|x86.ActiveCfg = Release|Any CPU
6553
{A4B1E6D3-CFEF-4369-9B5F-197E3F921FD2}.Release|x86.Build.0 = Release|Any CPU
66-
{C36B83A5-BE24-44E5-A88A-8F824735A1E5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
67-
{C36B83A5-BE24-44E5-A88A-8F824735A1E5}.Debug|Any CPU.Build.0 = Debug|Any CPU
6854
{C36B83A5-BE24-44E5-A88A-8F824735A1E5}.Debug|ARM64.ActiveCfg = Debug|Any CPU
6955
{C36B83A5-BE24-44E5-A88A-8F824735A1E5}.Debug|ARM64.Build.0 = Debug|Any CPU
7056
{C36B83A5-BE24-44E5-A88A-8F824735A1E5}.Debug|x64.ActiveCfg = Debug|Any CPU
7157
{C36B83A5-BE24-44E5-A88A-8F824735A1E5}.Debug|x64.Build.0 = Debug|Any CPU
7258
{C36B83A5-BE24-44E5-A88A-8F824735A1E5}.Debug|x86.ActiveCfg = Debug|Any CPU
7359
{C36B83A5-BE24-44E5-A88A-8F824735A1E5}.Debug|x86.Build.0 = Debug|Any CPU
74-
{C36B83A5-BE24-44E5-A88A-8F824735A1E5}.Release|Any CPU.ActiveCfg = Release|Any CPU
75-
{C36B83A5-BE24-44E5-A88A-8F824735A1E5}.Release|Any CPU.Build.0 = Release|Any CPU
7660
{C36B83A5-BE24-44E5-A88A-8F824735A1E5}.Release|ARM64.ActiveCfg = Release|Any CPU
7761
{C36B83A5-BE24-44E5-A88A-8F824735A1E5}.Release|ARM64.Build.0 = Release|Any CPU
7862
{C36B83A5-BE24-44E5-A88A-8F824735A1E5}.Release|x64.ActiveCfg = Release|Any CPU

APKInstaller/AAPTForNet/AAPTForNet.csproj

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<LangVersion>preview</LangVersion>
4+
<LangVersion>latest</LangVersion>
55
<TargetFramework>net8.0</TargetFramework>
66
</PropertyGroup>
77

@@ -16,7 +16,7 @@
1616
</ItemGroup>
1717

1818
<ItemGroup Condition="'$(TargetFrameworkIdentifier)' != '.NETFramework'">
19-
<PackageReference Include="System.Drawing.Common" Version="8.0.0" />
19+
<PackageReference Include="System.Drawing.Common" Version="8.0.13" />
2020
</ItemGroup>
2121

2222
<ItemGroup>

APKInstaller/AAPTForNet/AAPTool.cs

+6-6
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ public static ApkInfo Decompile(string path)
153153
Directory.CreateDirectory(TempPath);
154154
}
155155

156-
foreach (ZipArchiveEntry entry in archive.Entries.Where(x => !x.FullName.Contains("/")))
156+
foreach (ZipArchiveEntry entry in archive.Entries.Where(x => !x.FullName.Contains('/')))
157157
{
158158
if (entry.Name.ToLower().EndsWith(".apk"))
159159
{
@@ -163,7 +163,7 @@ public static ApkInfo Decompile(string path)
163163
}
164164
}
165165

166-
if (!apks.Any())
166+
if (apks.Count == 0)
167167
{
168168
apks.Add(path);
169169
}
@@ -197,11 +197,11 @@ public static ApkInfo Decompile(string path)
197197
apkInfos.Add(apk);
198198
}
199199

200-
if (!apkInfos.Any()) { return new ApkInfo(); }
200+
if (apkInfos.Count == 0) { return new ApkInfo(); }
201201

202202
if (apkInfos.Count <= 1) { return apkInfos.FirstOrDefault(); }
203203

204-
List<ApkInfos> packages = apkInfos.GroupBy(x => x.PackageName).Select(x => new ApkInfos { PackageName = x.Key, Apks = x.ToList() }).ToList();
204+
List<ApkInfos> packages = [.. apkInfos.GroupBy(x => x.PackageName).Select(x => new ApkInfos { PackageName = x.Key, Apks = [.. x] })];
205205

206206
if (packages.Count > 1) { throw new Exception("This is a Multiple Package."); }
207207

@@ -210,14 +210,14 @@ public static ApkInfo Decompile(string path)
210210
{
211211
foreach (ApkInfo baseapk in package.Apks.Where(x => !x.IsSplit))
212212
{
213-
baseapk.SplitApks = package.Apks.Where(x => x.IsSplit).Where(x => x.VersionCode == baseapk.VersionCode).ToList();
213+
baseapk.SplitApks = [.. package.Apks.Where(x => x.IsSplit).Where(x => x.VersionCode == baseapk.VersionCode)];
214214
infos.Add(baseapk);
215215
}
216216
}
217217

218218
if (infos.Count > 1) { throw new Exception("There are more than one base APK in this Package."); }
219219

220-
if (!infos.Any()) { throw new Exception("There are all dependents in this Package."); }
220+
if (infos.Count == 0) { throw new Exception("There are all dependents in this Package."); }
221221

222222
ApkInfo info = infos.FirstOrDefault();
223223

APKInstaller/AAPTForNet/ApkExtractor.cs

+6-6
Original file line numberDiff line numberDiff line change
@@ -78,12 +78,11 @@ private static Dictionary<string, Icon> DumpMarkupIcon(
7878
return [];
7979
}
8080

81-
string msg = string.Empty;
8281
start = start >= 0 && start < tree.Messages.Count ? start : 0;
8382
for (int i = start; i < tree.Messages.Count; i++)
8483
{
8584
lastTryIndex = i;
86-
msg = tree.Messages[i];
85+
string msg = tree.Messages[i];
8786

8887
if (Detector.IsBitmapElement(msg))
8988
{
@@ -186,11 +185,12 @@ private static Dictionary<string, Icon> CreateIconTable(List<int> positions, Lis
186185
return [];
187186
}
188187

189-
const char seperator = '\"';
188+
const char separator = '\"';
190189
// Prevent duplicate key when add to Dictionary,
191190
// because comparison statement with 'hdpi' in config's values,
192191
// reverse list and get first elem with LINQ
193-
IEnumerable<string> configNames = Enum.GetNames(typeof(Configs)).Reverse();
192+
string[] configNames = Enum.GetNames(typeof(Configs));
193+
configNames.Reverse();
194194
Dictionary<string, Icon> iconTable = [];
195195
void AddIcon2Table(string cfg, string iconName)
196196
{
@@ -224,7 +224,7 @@ void AddIcon2Table(string cfg, string iconName)
224224
if (Detector.IsResourceValue(resValue))
225225
{
226226
// Resource value is icon url
227-
string iconName = resValue.Split(seperator)
227+
string iconName = resValue.Split(separator)
228228
.FirstOrDefault(n => n.Contains('/'));
229229
AddIcon2Table(config, iconName);
230230
break;
@@ -314,7 +314,7 @@ private static Icon ExtractLargestIcon(Dictionary<string, Icon> iconTable)
314314
}
315315

316316
Icon icon = Icon.Default;
317-
List<string> configNames = Enum.GetNames(typeof(Configs)).ToList();
317+
List<string> configNames = [.. Enum.GetNames(typeof(Configs))];
318318
configNames.Sort(new ConfigComparer());
319319

320320
foreach (string cfg in configNames)

APKInstaller/AAPTForNet/Filters/ABIFilter.cs

+3-3
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,13 @@ namespace AAPTForNet.Filters
1010
/// <remarks>https://developer.android.com/ndk/guides/abis</remarks>
1111
internal class ABIFilter : BaseFilter
1212
{
13-
private string[] Segments = Array.Empty<string>();
13+
private string[] Segments = [];
1414

1515
public override bool CanHandle(string msg) => msg.StartsWith("native-code:");
1616

17-
public override void AddMessage(string msg) => Segments = msg.Split(new char[2] { ' ', '\'' }, StringSplitOptions.RemoveEmptyEntries);
17+
public override void AddMessage(string msg) => Segments = msg.Split([' ', '\''], StringSplitOptions.RemoveEmptyEntries);
1818

19-
public override ApkInfo GetAPK() => new() { SupportedABIs = Segments.Skip(1).ToList() }; // Skip "native-code"
19+
public override ApkInfo GetAPK() => new() { SupportedABIs = [.. Segments.Skip(1)] }; // Skip "native-code"
2020

2121
public override void Clear() => throw new NotImplementedException();
2222
}

APKInstaller/AAPTForNet/Filters/ApplicationFilter.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ namespace AAPTForNet.Filters
55
{
66
internal class ApplicationFilter : BaseFilter
77
{
8-
private string[] Segments = Array.Empty<string>();
8+
private string[] Segments = [];
99

1010
public override bool CanHandle(string msg) => msg.StartsWith("application:");
1111

@@ -24,7 +24,7 @@ public override ApkInfo GetAPK()
2424
};
2525
}
2626

27-
public override void Clear() => Segments = Array.Empty<string>();
27+
public override void Clear() => Segments = [];
2828

2929
private string GetValue(string key)
3030
{

APKInstaller/AAPTForNet/Filters/DensityFilter.cs

+3-3
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,13 @@ namespace AAPTForNet.Filters
66
{
77
internal class DensityFilter : BaseFilter
88
{
9-
private string[] Segments = Array.Empty<string>();
9+
private string[] Segments = [];
1010

1111
public override bool CanHandle(string msg) => msg.StartsWith("densities:");
1212

13-
public override void AddMessage(string msg) => Segments = msg.Split(new char[2] { ' ', '\'' }, StringSplitOptions.RemoveEmptyEntries);
13+
public override void AddMessage(string msg) => Segments = msg.Split([' ', '\''], StringSplitOptions.RemoveEmptyEntries);
1414

15-
public override ApkInfo GetAPK() => new() { SupportDensities = Segments.Skip(1).ToList() }; // Skip "densities"
15+
public override ApkInfo GetAPK() => new() { SupportDensities = [.. Segments.Skip(1)] }; // Skip "densities"
1616

1717
public override void Clear() => throw new NotImplementedException();
1818
}

APKInstaller/AAPTForNet/Filters/LocaleFilter.cs

+3-3
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,13 @@ namespace AAPTForNet.Filters
66
{
77
internal class LocaleFilter : BaseFilter
88
{
9-
private string[] Segments = Array.Empty<string>();
9+
private string[] Segments = [];
1010

1111
public override bool CanHandle(string msg) => msg.StartsWith("locales: '--_--'");
1212

13-
public override void AddMessage(string msg) => Segments = msg.Split(new char[2] { ' ', '\'' }, StringSplitOptions.RemoveEmptyEntries);
13+
public override void AddMessage(string msg) => Segments = msg.Split([' ', '\''], StringSplitOptions.RemoveEmptyEntries);
1414

15-
public override ApkInfo GetAPK() => new() { SupportLocales = Segments.Skip(2).ToList() }; // Skip "locales" and "--_--"
15+
public override ApkInfo GetAPK() => new() { SupportLocales = [.. Segments.Skip(2)] }; // Skip "locales" and "--_--"
1616

1717
public override void Clear() => throw new NotImplementedException();
1818
}

APKInstaller/AAPTForNet/Filters/PackageFilter.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ namespace AAPTForNet.Filters
55
{
66
internal class PackageFilter : BaseFilter
77
{
8-
private string[] Segments = Array.Empty<string>();
8+
private string[] Segments = [];
99

1010
public override bool CanHandle(string msg) => msg.StartsWith("package:");
1111

@@ -22,7 +22,7 @@ public override ApkInfo GetAPK()
2222
};
2323
}
2424

25-
public override void Clear() => Segments = Array.Empty<string>();
25+
public override void Clear() => Segments = [];
2626

2727
private string GetValueOrDefault(string key)
2828
{

APKInstaller/AAPTForNet/Models/ApkInfo.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ public long PackageSize
6060

6161
public bool IsSplit => SplitName != "Unknown";
6262

63-
public bool IsBundle => SplitApks != null && SplitApks.Any();
63+
public bool IsBundle => SplitApks != null && SplitApks.Count != 0;
6464

6565
public void AddSplit(ApkInfo info) => SplitApks.Add(info);
6666

APKInstaller/AAPTForNet/Models/SDKInfo.cs

+4-4
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ public class SDKInfo : IComparable
88
internal static readonly SDKInfo Unknown = new("0", "0", "0");
99

1010
// https://source.android.com/setup/start/build-numbers
11-
private static readonly string[] AndroidCodeNames = {
11+
private static readonly string[] AndroidCodeNames = [
1212
"Unknown",
1313
"Unnamed", // API level 1
1414
"Petit Four",
@@ -50,9 +50,9 @@ public class SDKInfo : IComparable
5050
"Y",
5151
"Z",
5252
"Hello from 2022!" // API level 40
53-
};
53+
];
5454

55-
private static readonly string[] AndroidVersionCodes = {
55+
private static readonly string[] AndroidVersionCodes = [
5656
"Unknown",
5757
"1.0", // API level 1
5858
"1.1",
@@ -94,7 +94,7 @@ public class SDKInfo : IComparable
9494
"18",
9595
"19",
9696
"20" // API level 40
97-
};
97+
];
9898

9999
public string APILevel { get; }
100100
public string Version { get; }

APKInstaller/APKInstaller/APKInstaller.csproj

+9-9
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,16 @@
88
<Copyright>Copyright © 2017 - 2025 PavingBase. All Rights Reserved.</Copyright>
99
<Description>An Android Application Installer for Windows</Description>
1010
<EnableMsixTooling>True</EnableMsixTooling>
11-
<LangVersion>preview</LangVersion>
11+
<LangVersion>latest</LangVersion>
1212
<OutputType>WinExe</OutputType>
1313
<PackageProjectUrl>https://github.com/Paving-Base/APK-Installer</PackageProjectUrl>
1414
<Platforms>x86;x64;ARM64</Platforms>
1515
<PublishProfile>win10-$(Platform).pubxml</PublishProfile>
1616
<RepositoryUrl>https://github.com/Paving-Base/APK-Installer</RepositoryUrl>
1717
<RootNamespace>APKInstaller</RootNamespace>
1818
<RuntimeIdentifiers>win-x86;win-x64;win-arm64</RuntimeIdentifiers>
19-
<TargetFramework>net8.0-windows10.0.22621.0</TargetFramework>
20-
<TargetPlatformMaxVersion>10.0.22621.0</TargetPlatformMaxVersion>
19+
<TargetFramework>net8.0-windows10.0.26100.0</TargetFramework>
20+
<TargetPlatformMaxVersion>10.0.26100.0</TargetPlatformMaxVersion>
2121
<TargetPlatformMinVersion>10.0.17763.0</TargetPlatformMinVersion>
2222
<TrimMode>partial</TrimMode>
2323
<UseWinUI>True</UseWinUI>
@@ -53,13 +53,13 @@
5353
<PackageReference Include="CommunityToolkit.WinUI.UI.Controls.DataGrid" Version="7.1.2" />
5454
<PackageReference Include="CommunityToolkit.WinUI.UI.Controls.Layout" Version="7.1.2" />
5555
<PackageReference Include="CommunityToolkit.WinUI.UI.Controls.Markdown" Version="7.1.2" />
56-
<PackageReference Include="Downloader" Version="3.0.6" />
56+
<PackageReference Include="Downloader" Version="3.3.3" />
5757
<PackageReference Include="MetroLog.Net6" Version="2.1.0" />
58-
<PackageReference Include="Microsoft.Windows.CsWin32" Version="0.3.49-beta" PrivateAssets="all" />
59-
<PackageReference Include="Microsoft.Windows.SDK.BuildTools" Version="10.0.22621.2428" />
60-
<PackageReference Include="Microsoft.WindowsAppSDK" Version="1.4.231115000" />
61-
<PackageReference Include="QRCoder" Version="1.4.3" />
62-
<PackageReference Include="SharpCompress" Version="0.35.0" />
58+
<PackageReference Include="Microsoft.Windows.CsWin32" Version="0.3.183" PrivateAssets="all" />
59+
<PackageReference Include="Microsoft.Windows.SDK.BuildTools" Version="10.0.26100.1742" />
60+
<PackageReference Include="Microsoft.WindowsAppSDK" Version="1.6.250205002" />
61+
<PackageReference Include="QRCoder" Version="1.6.0" />
62+
<PackageReference Include="SharpCompress" Version="0.39.0" />
6363
<Manifest Include="$(ApplicationManifest)" />
6464
</ItemGroup>
6565

APKInstaller/APKInstaller/Helpers/SettingsHelper.cs

+12-15
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,12 @@
55
using MetroLog.Targets;
66
using Microsoft.UI.Xaml;
77
using System;
8+
using System.Diagnostics.CodeAnalysis;
89
using System.IO;
910
using System.Reflection;
1011
using System.Text.Json;
1112
using System.Text.Json.Serialization;
13+
using System.Text.Json.Serialization.Metadata;
1214
using System.Threading.Tasks;
1315
using Windows.ApplicationModel;
1416
using Windows.Storage;
@@ -154,27 +156,22 @@ public class SystemTextJsonObjectSerializer : IObjectSerializer
154156
#endif
155157
};
156158

157-
public T Deserialize<T>(string value)
159+
public T Deserialize<T>([StringSyntax(StringSyntaxAttribute.Json)] string value)
158160
{
159161
if (string.IsNullOrEmpty(value)) { return default; }
160162
Type type = typeof(T);
161-
return type == typeof(bool) && JsonSerializer.Deserialize(value, SourceGenerationContext.Default.Boolean) is T @bool
162-
? @bool
163-
: type == typeof(string) && JsonSerializer.Deserialize(value, SourceGenerationContext.Default.String) is T @string
164-
? @string
165-
: type == typeof(DateTime) && JsonSerializer.Deserialize(value, SourceGenerationContext.Default.DateTime) is T DateTime
166-
? DateTime
167-
: type == typeof(DeviceData) && JsonSerializer.Deserialize(value, SourceGenerationContext.Default.DeviceData) is T DeviceData
168-
? DeviceData
169-
: type == typeof(ElementTheme) && JsonSerializer.Deserialize(value, SourceGenerationContext.Default.ElementTheme) is T ElementTheme
170-
? ElementTheme
171-
: type == typeof(BackdropType) && JsonSerializer.Deserialize(value, SourceGenerationContext.Default.BackdropType) is T BackdropType
172-
? BackdropType
163+
return type == typeof(bool) ? Deserialize(value, SourceGenerationContext.Default.Boolean)
164+
: type == typeof(string) ? Deserialize(value, SourceGenerationContext.Default.String)
165+
: type == typeof(DateTime) ? Deserialize(value, SourceGenerationContext.Default.DateTime)
166+
: type == typeof(DeviceData) ? Deserialize(value, SourceGenerationContext.Default.DeviceData)
167+
: type == typeof(ElementTheme) ? Deserialize(value, SourceGenerationContext.Default.ElementTheme)
168+
: type == typeof(BackdropType) ? Deserialize(value, SourceGenerationContext.Default.BackdropType)
173169
#if DEBUG
174-
: JsonSerializer.Deserialize<T>(value);
170+
: JsonSerializer.Deserialize<T>(value);
175171
#else
176-
: default;
172+
: default;
177173
#endif
174+
static T Deserialize<TValue>([StringSyntax(StringSyntaxAttribute.Json)] string json, JsonTypeInfo<TValue> jsonTypeInfo) => JsonSerializer.Deserialize(json, jsonTypeInfo) is T value ? value : default;
178175
}
179176
}
180177

0 commit comments

Comments
 (0)