fix bilibili server convert

This commit is contained in:
Lightczx
2023-09-08 17:14:50 +08:00
parent 8e625e19ee
commit b5f3cb92b2
3 changed files with 38 additions and 11 deletions

View File

@@ -163,7 +163,7 @@ internal sealed partial class GameService : IGameService
}
}
return changed || !LaunchSchemeMatchesExecutable(scheme, Path.GetFileName(gamePath));
return changed;
}
/// <inheritdoc/>
@@ -398,4 +398,6 @@ internal sealed partial class GameService : IGameService
_ => false,
};
}
private static bool LaunchScheme
}

View File

@@ -2,6 +2,7 @@
// Licensed under the MIT license.
using Snap.Hutao.Model.Intrinsic;
using System.IO;
namespace Snap.Hutao.Service.Game;
@@ -64,4 +65,29 @@ internal sealed partial class LaunchScheme
{
return Channel == multiChannel.Channel && SubChannel == multiChannel.SubChannel;
}
public bool ExecutableMatches(string gameFileName)
{
return (IsOversea, gameFileName) switch
{
(true, GameConstants.GenshinImpactFileName) => true,
(false, GameConstants.YuanShenFileName) => true,
_ => false,
};
}
public bool SdkLibraryMatches(string gameFolder)
{
if (IsOversea)
{
return false;
}
if (LauncherId is SdkStaticLauncherBilibiliId)
{
}
string sdkDll = Path.Combine(gameFolder, GameConstants.YuanShenData, "Plugins\\PCGameSDK.dll");
}
}

View File

@@ -186,18 +186,17 @@ internal sealed partial class LaunchGameViewModel : Abstraction.ViewModel
{
try
{
if (gameService.SetChannelOptions(SelectedScheme))
gameService.SetChannelOptions(SelectedScheme);
// Whether or not the channel options changed, we always ensure game resouces
LaunchGamePackageConvertDialog dialog = await contentDialogFactory.CreateInstanceAsync<LaunchGamePackageConvertDialog>().ConfigureAwait(false);
IProgress<PackageReplaceStatus> convertProgress = taskContext.CreateProgressForMainThread<PackageReplaceStatus>(state => dialog.State = state);
using (await dialog.BlockAsync(taskContext).ConfigureAwait(false))
{
// Channel changed, we need to change local file.
LaunchGamePackageConvertDialog dialog = await contentDialogFactory.CreateInstanceAsync<LaunchGamePackageConvertDialog>().ConfigureAwait(false);
IProgress<PackageReplaceStatus> convertProgress = taskContext.CreateProgressForMainThread<PackageReplaceStatus>(state => dialog.State = state);
using (await dialog.BlockAsync(taskContext).ConfigureAwait(false))
if (!await gameService.EnsureGameResourceAsync(SelectedScheme, convertProgress).ConfigureAwait(false))
{
if (!await gameService.EnsureGameResourceAsync(SelectedScheme, convertProgress).ConfigureAwait(false))
{
infoBarService.Warning(SH.ViewModelLaunchGameEnsureGameResourceFail);
return;
}
infoBarService.Warning(SH.ViewModelLaunchGameEnsureGameResourceFail);
return;
}
}