launch scheme renewed

This commit is contained in:
Lightczx
2023-11-02 14:23:34 +08:00
parent 067c7d7c4d
commit 4cb3d5f03f
7 changed files with 126 additions and 168 deletions

View File

@@ -0,0 +1,52 @@
// Copyright (c) DGP Studio. All rights reserved.
// Licensed under the MIT license.
using Snap.Hutao.Model.Intrinsic;
namespace Snap.Hutao.Service.Game;
internal static class KnownLaunchSchemes
{
private static readonly LaunchScheme ServerChineseChannelDefaultSubChannelDefaultCompat = new LaunchSchemeChinese(ChannelType.Default, SubChannelType.Default, false);
private static readonly LaunchScheme ServerChineseChannelOfficialSubChannelDefault = new LaunchSchemeChinese(ChannelType.Official, SubChannelType.Default);
private static readonly LaunchScheme ServerChineseChannelOfficialSubChannelOfficial = new LaunchSchemeChinese(ChannelType.Official, SubChannelType.Official);
private static readonly LaunchScheme ServerChineseChannelOfficialSubChannelNoTapTap = new LaunchSchemeChinese(ChannelType.Official, SubChannelType.NoTapTap);
private static readonly LaunchScheme ServerChineseChannelOfficialSubChannelEpicCompat = new LaunchSchemeChinese(ChannelType.Official, SubChannelType.Epic, false);
private static readonly LaunchScheme ServerChineseChannelBilibiliSubChannelDefault = new LaunchSchemeBilibili(SubChannelType.Default);
private static readonly LaunchScheme ServerChineseChannelBilibiliSubChannelOfficialCompat = new LaunchSchemeBilibili(SubChannelType.Official, false);
private static readonly LaunchScheme ServerGlobalChannelDefaultSubChannelDefaultCompat = new LaunchSchemeOversea(ChannelType.Default, SubChannelType.Default, false);
private static readonly LaunchScheme ServerGlobalChannelOfficialSubChannelDefault = new LaunchSchemeOversea(ChannelType.Official, SubChannelType.Default);
private static readonly LaunchScheme ServerGlobalChannelOfficialSubChannelOfficial = new LaunchSchemeOversea(ChannelType.Official, SubChannelType.Official);
private static readonly LaunchScheme ServerGlobalChannelOfficialSubChannelEpic = new LaunchSchemeOversea(ChannelType.Official, SubChannelType.Epic);
private static readonly LaunchScheme ServerGlobalChannelOfficialSubChannelGoogle = new LaunchSchemeOversea(ChannelType.Official, SubChannelType.Google);
/// <summary>
/// 获取已知的启动方案
/// </summary>
/// <returns>已知的启动方案</returns>
public static List<LaunchScheme> Get()
{
return new List<LaunchScheme>()
{
// 官服
ServerChineseChannelDefaultSubChannelDefaultCompat,
ServerChineseChannelOfficialSubChannelDefault,
ServerChineseChannelOfficialSubChannelOfficial,
ServerChineseChannelOfficialSubChannelNoTapTap,
ServerChineseChannelOfficialSubChannelEpicCompat,
// 渠道服
ServerChineseChannelBilibiliSubChannelDefault,
ServerChineseChannelBilibiliSubChannelOfficialCompat,
// 国际服
ServerGlobalChannelDefaultSubChannelDefaultCompat,
ServerGlobalChannelOfficialSubChannelDefault,
ServerGlobalChannelOfficialSubChannelOfficial,
ServerGlobalChannelOfficialSubChannelEpic,
ServerGlobalChannelOfficialSubChannelGoogle,
};
}
}

View File

@@ -1,160 +0,0 @@
// Copyright (c) DGP Studio. All rights reserved.
// Licensed under the MIT license.
using Snap.Hutao.Model.Intrinsic;
namespace Snap.Hutao.Service.Game;
/// <summary>
/// 方案列表部分
/// </summary>
internal sealed partial class LaunchScheme
{
private const int SdkStaticLauncherChineseId = 18;
private const int SdkStaticLauncherBilibiliId = 17;
private const int SdkStaticLauncherGlobalId = 10;
private const string SdkStaticLauncherChineseKey = "eYd89JmJ";
private const string SdkStaticLauncherBilibiliKey = "KAtdSsoQ";
private const string SdkStaticLauncherGlobalKey = "gcStgarh";
private static readonly LaunchScheme ServerChineseChannelDefaultSubChannelDefaultCompatOnly = new()
{
LauncherId = SdkStaticLauncherChineseId,
Key = SdkStaticLauncherChineseKey,
Channel = ChannelType.Default,
SubChannel = SubChannelType.Default,
IsOversea = false,
IsNotCompatOnly = false,
};
private static readonly LaunchScheme ServerChineseChannelOfficialSubChannelDefault = new()
{
LauncherId = SdkStaticLauncherChineseId,
Key = SdkStaticLauncherChineseKey,
Channel = ChannelType.Official,
SubChannel = SubChannelType.Default,
IsOversea = false,
};
private static readonly LaunchScheme ServerChineseChannelOfficialSubChannelOfficial = new()
{
LauncherId = SdkStaticLauncherChineseId,
Key = SdkStaticLauncherChineseKey,
Channel = ChannelType.Official,
SubChannel = SubChannelType.Official,
IsOversea = false,
};
private static readonly LaunchScheme ServerChineseChannelOfficialSubChannelNoTapTap = new()
{
LauncherId = SdkStaticLauncherChineseId,
Key = SdkStaticLauncherChineseKey,
Channel = ChannelType.Official,
SubChannel = SubChannelType.NoTapTap,
IsOversea = false,
};
private static readonly LaunchScheme ServerChineseChannelOfficialSubChannelEpicCompatOnly = new()
{
LauncherId = SdkStaticLauncherChineseId,
Key = SdkStaticLauncherChineseKey,
Channel = ChannelType.Official,
SubChannel = SubChannelType.Epic,
IsOversea = false,
IsNotCompatOnly = false,
};
private static readonly LaunchScheme ServerChineseChannelBilibiliSubChannelDefault = new()
{
LauncherId = SdkStaticLauncherBilibiliId,
Key = SdkStaticLauncherBilibiliKey,
Channel = ChannelType.Bili,
SubChannel = SubChannelType.Default,
IsOversea = false,
};
private static readonly LaunchScheme ServerChineseChannelBilibiliSubChannelOfficialCompatOnly = new()
{
LauncherId = SdkStaticLauncherBilibiliId,
Key = SdkStaticLauncherBilibiliKey,
Channel = ChannelType.Bili,
SubChannel = SubChannelType.Official,
IsOversea = false,
IsNotCompatOnly = false,
};
private static readonly LaunchScheme ServerGlobalChannelDefaultSubChannelDefaultCompatOnly = new()
{
LauncherId = SdkStaticLauncherGlobalId,
Key = SdkStaticLauncherGlobalKey,
Channel = ChannelType.Default,
SubChannel = SubChannelType.Default,
IsOversea = true,
IsNotCompatOnly = false,
};
private static readonly LaunchScheme ServerGlobalChannelOfficialSubChannelDefault = new()
{
LauncherId = SdkStaticLauncherGlobalId,
Key = SdkStaticLauncherGlobalKey,
Channel = ChannelType.Official,
SubChannel = SubChannelType.Default,
IsOversea = true,
};
private static readonly LaunchScheme ServerGlobalChannelOfficialSubChannelOfficial = new()
{
LauncherId = SdkStaticLauncherGlobalId,
Key = SdkStaticLauncherGlobalKey,
Channel = ChannelType.Official,
SubChannel = SubChannelType.Official,
IsOversea = true,
};
private static readonly LaunchScheme ServerGlobalChannelOfficialSubChannelEpic = new()
{
LauncherId = SdkStaticLauncherGlobalId,
Key = SdkStaticLauncherGlobalKey,
Channel = ChannelType.Official,
SubChannel = SubChannelType.Epic,
IsOversea = true,
};
private static readonly LaunchScheme ServerGlobalChannelOfficialSubChannelGoogle = new()
{
LauncherId = SdkStaticLauncherGlobalId,
Key = SdkStaticLauncherGlobalKey,
Channel = ChannelType.Official,
SubChannel = SubChannelType.Google,
IsOversea = true,
};
/// <summary>
/// 获取已知的启动方案
/// </summary>
/// <returns>已知的启动方案</returns>
public static List<LaunchScheme> GetKnownSchemes()
{
return new List<LaunchScheme>()
{
// 官服
ServerChineseChannelDefaultSubChannelDefaultCompatOnly,
ServerChineseChannelOfficialSubChannelDefault,
ServerChineseChannelOfficialSubChannelOfficial,
ServerChineseChannelOfficialSubChannelNoTapTap,
ServerChineseChannelOfficialSubChannelEpicCompatOnly,
// 渠道服
ServerChineseChannelBilibiliSubChannelDefault,
ServerChineseChannelBilibiliSubChannelOfficialCompatOnly,
// 国际服
ServerGlobalChannelDefaultSubChannelDefaultCompatOnly,
ServerGlobalChannelOfficialSubChannelDefault,
ServerGlobalChannelOfficialSubChannelOfficial,
ServerGlobalChannelOfficialSubChannelEpic,
ServerGlobalChannelOfficialSubChannelGoogle,
};
}
}

View File

@@ -9,7 +9,7 @@ namespace Snap.Hutao.Service.Game;
/// 启动方案
/// </summary>
[HighQuality]
internal sealed partial class LaunchScheme
internal partial class LaunchScheme
{
/// <summary>
/// 显示名称
@@ -32,29 +32,29 @@ internal sealed partial class LaunchScheme
/// <summary>
/// 通道
/// </summary>
public ChannelType Channel { get; private set; }
public ChannelType Channel { get; private protected set; }
/// <summary>
/// 子通道
/// </summary>
public SubChannelType SubChannel { get; private set; }
public SubChannelType SubChannel { get; private protected set; }
/// <summary>
/// 启动器 Id
/// </summary>
public int LauncherId { get; private set; }
public int LauncherId { get; private protected set; }
/// <summary>
/// API Key
/// </summary>
public string Key { get; private set; } = default!;
public string Key { get; private protected set; } = default!;
/// <summary>
/// 是否为海外
/// </summary>
public bool IsOversea { get; private set; }
public bool IsOversea { get; private protected set; }
public bool IsNotCompatOnly { get; private set; } = true;
public bool IsNotCompatOnly { get; private protected set; } = true;
/// <summary>
/// 多通道相等

View File

@@ -0,0 +1,22 @@
// Copyright (c) DGP Studio. All rights reserved.
// Licensed under the MIT license.
using Snap.Hutao.Model.Intrinsic;
namespace Snap.Hutao.Service.Game;
internal sealed class LaunchSchemeBilibili : LaunchScheme
{
private const int SdkStaticLauncherBilibiliId = 17;
private const string SdkStaticLauncherBilibiliKey = "KAtdSsoQ";
public LaunchSchemeBilibili(SubChannelType subChannel, bool isNotCompatOnly = true)
{
LauncherId = SdkStaticLauncherBilibiliId;
Key = SdkStaticLauncherBilibiliKey;
Channel = ChannelType.Bili;
SubChannel = subChannel;
IsOversea = false;
IsNotCompatOnly = isNotCompatOnly;
}
}

View File

@@ -0,0 +1,22 @@
// Copyright (c) DGP Studio. All rights reserved.
// Licensed under the MIT license.
using Snap.Hutao.Model.Intrinsic;
namespace Snap.Hutao.Service.Game;
internal sealed class LaunchSchemeChinese : LaunchScheme
{
private const int SdkStaticLauncherChineseId = 18;
private const string SdkStaticLauncherChineseKey = "eYd89JmJ";
public LaunchSchemeChinese(ChannelType channel, SubChannelType subChannel, bool isNotCompatOnly = true)
{
LauncherId = SdkStaticLauncherChineseId;
Key = SdkStaticLauncherChineseKey;
Channel = channel;
SubChannel = subChannel;
IsOversea = false;
IsNotCompatOnly = isNotCompatOnly;
}
}

View File

@@ -0,0 +1,22 @@
// Copyright (c) DGP Studio. All rights reserved.
// Licensed under the MIT license.
using Snap.Hutao.Model.Intrinsic;
namespace Snap.Hutao.Service.Game;
internal sealed class LaunchSchemeOversea : LaunchScheme
{
private const int SdkStaticLauncherOverseaId = 10;
private const string SdkStaticLauncherOverseaKey = "gcStgarh";
public LaunchSchemeOversea(ChannelType channel, SubChannelType subChannel, bool isNotCompatOnly = true)
{
LauncherId = SdkStaticLauncherOverseaId;
Key = SdkStaticLauncherOverseaKey;
Channel = channel;
SubChannel = subChannel;
IsOversea = true;
IsNotCompatOnly = isNotCompatOnly;
}
}

View File

@@ -55,7 +55,7 @@ internal sealed partial class LaunchGameViewModel : Abstraction.ViewModel
/// 已知的服务器方案
/// </summary>
[SuppressMessage("", "CA1822")]
public List<LaunchScheme> KnownSchemes { get => LaunchScheme.GetKnownSchemes(); }
public List<LaunchScheme> KnownSchemes { get => KnownLaunchSchemes.Get(); }
/// <summary>
/// 当前选择的服务器方案