Skip to content

Commit 35641d5

Browse files
committed
🐛 修复战网账号切换对旧版本数据支持问题
1 parent 07f1a9f commit 35641d5

File tree

5 files changed

+25
-3
lines changed

5 files changed

+25
-3
lines changed

src/BD.WTTS.Client.Avalonia/UI/Views/Pages/Settings/Settings_Plugin.axaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,12 @@
9191
CommandParameter="{Binding Data.AssemblyLocation}"
9292
Content="{Binding Path=Res.Plugin_OpenFolder, Mode=OneWay, Source={x:Static s:ResourceService.Current}}"
9393
IsClickEnabled="True" />
94+
<ui:SettingsExpanderItem
95+
ActionIconSource="Open"
96+
Command="{Binding $parent[spp:Settings_Plugin].((spp:SettingsPageViewModel)DataContext).OpenPluginCacheDirectory_Click}"
97+
CommandParameter="{Binding Data.AppDataDirectory}"
98+
Content="{Binding Path=Res.Plugin_OpenAppDataFolder, Mode=OneWay, Source={x:Static s:ResourceService.Current}}"
99+
IsClickEnabled="True" />
94100
<ui:SettingsExpanderItem
95101
ActionIconSource="Open"
96102
Command="{Binding $parent[spp:Settings_Plugin].((spp:SettingsPageViewModel)DataContext).OpenPluginCacheDirectory_Click}"

src/BD.WTTS.Client.Plugins.GameAccount/Services.Implementation/BasicPlatformSwitcher.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,8 @@ async ValueTask<bool> BasicCopyInAccount(string accId, PlatformAccount platform)
8282
var selector = accFile.Split("::")[2];
8383
if (!JTokenHelper.ReplaceVarInJsonFile(path, selector, jToken))
8484
{
85-
Toast.Show(ToastIcon.Error, AppResources.Error_ModifyJsonFileFailed);
85+
//Toast.Show(ToastIcon.Error, AppResources.Error_ModifyJsonFileFailed);
86+
Log.Error(nameof(BasicPlatformSwitcher), $"Failed to modify JSON file: {path}");
8687
//return false;
8788
}
8889
continue;
@@ -179,7 +180,7 @@ async ValueTask<bool> ClearCurrentLoginUserCore(PlatformAccount platform)
179180
{
180181
var path = uniqueIdFile.Split("::")[0];
181182
var selector = uniqueIdFile.Split("::")[1];
182-
JTokenHelper.ReplaceVarInJsonFile(path, selector, "");
183+
JTokenHelper.ReplaceVarInJsonFile(path, selector, string.Empty);
183184
}
184185

185186
if (platform.UniqueIdType != UniqueIdType.CREATE_ID_FILE) return true;

src/BD.WTTS.Client.Plugins.GameAccount/UI/Assets/Platforms.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,10 @@
148148
"PlatformIds": [ "b", "bnet", "battlenet", "blizzard" ],
149149
"DefaultExePath": "%ProgramFiles(x86)%\\Battle.net\\Battle.net.exe",
150150
"ExesToEnd": [ "Battle.net" ],
151-
"ClearPaths": [ "SAME_AS_LOGIN_FILES" ],
151+
"ClearPaths": [
152+
"JSON_SELECT_FIRST,::%AppData%\\Battle.net\\Battle.net.config::$.Client.SavedAccountNames",
153+
"%AppData%\\Battle.net\\WattToolkit.id"
154+
],
152155
"LoginFiles": {
153156
"JSON_SELECT_FIRST,::%AppData%\\Battle.net\\Battle.net.config::$.Client.SavedAccountNames": "email.json",
154157
"JSON_SELECT_FIRST,::%AppData%\\Battle.net\\Battle.net.config::$..Services.LastLoginRegion": "LastLoginRegion",

src/BD.WTTS.Client/Resources/Strings.Designer.cs

Lines changed: 9 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/BD.WTTS.Client/Resources/Strings.resx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2267,6 +2267,9 @@
22672267
</data>
22682268
<data name="Plugin_OpenCacheFolder" xml:space="preserve">
22692269
<value>打开插件缓存文件夹</value>
2270+
</data>
2271+
<data name="Plugin_OpenAppDataFolder" xml:space="preserve">
2272+
<value>打开插件 AppData 文件夹</value>
22702273
</data>
22712274
<data name="Plugin_OpenFolder" xml:space="preserve">
22722275
<value>打开插件文件夹</value>

0 commit comments

Comments
 (0)