compat: switch expression → ternary for .NET 4.8 双兼容
IsmctsBot.cs:539: C#8 switch expression → C#7.3 ternary
num switch {1=>14,2=>16,_=>num} → num==1?14:num==2?16:num
bot代码(.NET 4.8)兼容性清单:
✅ LINQ (GroupBy/OrderBy/SelectMany) — 原生
✅ string 插值 $"..." — C#6
✅ ?./?? — C#6
✅ ValueTuple — 需 NuGet System.ValueTuple (net48)
✅ 已移除 switch expression — 唯一 C#8 特性
net48 项目集成只需3步:
1. 复制 PdkBot.cs + IsmctsBot.cs → PdkFriendServer/Logic/
2. csproj: <PackageReference Include="System.ValueTuple" Version="4.5.0"/>
3. WaitWanJiaShuRu 加入 BotMode 分支(同 net10.0 逻辑)
This commit is contained in:
@ -536,7 +536,7 @@ namespace PdkFriendServer.Logic
|
||||
foreach (int flower in new[] { 1, 2, 3, 4 })
|
||||
for (int num = 1; num <= 13; num++)
|
||||
{
|
||||
int gameNum = num switch { 1 => 14, 2 => 16, _ => num };
|
||||
int gameNum = num == 1 ? (byte)14 : num == 2 ? (byte)16 : (byte)num;
|
||||
deck.Add(new TCardInfoPdkF
|
||||
{
|
||||
ID = (byte)id++, Flower = (byte)flower,
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user