Compare commits

...

9 Commits

Author SHA1 Message Date
SongSongSo 44a775a3ee 🔀 解决冲突 2023-07-20 11:58:56 +08:00
lxy829 62025ee15b 🎨 修正缺少命名空间 2023-07-19 19:20:59 +08:00
lxy829 42bab60aab Merge branch 'v3.x' into features/localization/resx 2023-07-19 17:24:04 +08:00
lxy829 a245d2b305 🎨 修改遗漏资源 2023-07-19 17:21:32 +08:00
lxy829 583c2cd487 解决冲突 2023-07-19 16:39:47 +08:00
lxy829 43358cf808 merge 2023-07-19 15:45:16 +08:00
lxy829 8198ad8e44 删除未引用的resource 2023-07-19 14:50:27 +08:00
lxy829 6d8e5c18db 🎨 #290 2023-07-18 18:59:04 +08:00
lxy829 b14cc2f74a 字符串替换resource 2023-07-17 19:40:07 +08:00
45 changed files with 2757 additions and 4829 deletions
+1 -1
View File
@@ -194,7 +194,7 @@ public sealed partial class App : Application
// // t == WindowTransparencyLevel.Mica)
// //{
// // UISettings.EnableDesktopBackground.Value = false;
// // Toast.Show(string.Format(AppResources.Settings_UI_EnableDesktopBackground_Error, t));
// // Toast.Show(string.Format(AppResources.Settings_UI_EnableDesktopBackground_Error_, t));
// // return;
// //}
// SetDesktopBackgroundWindow();
@@ -43,7 +43,7 @@
DockPanel.Dock="Left"
FontSize="12"
Foreground="{DynamicResource TextFillColorSecondaryBrush}"
Text="感谢支持" />
Text="{ReflectionBinding Path=Res.About_ThankSupport, Mode=OneWay, Source={x:Static s:ResourceService.Current}}" />
</DockPanel>
@@ -4,6 +4,7 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:s="https://steampp.net/services"
xmlns:spp="https://steampp.net/ui"
xmlns:ui="using:FluentAvalonia.UI.Controls"
Title="{Binding Name}"
@@ -121,7 +122,9 @@
<TextBox
Name="CommandTextBox"
Grid.Row="1"
Watermark="在此输入控制台指令" />
Watermark="{ReflectionBinding Path=Res.Debug_InstructionPlaceholder,
Mode=OneWay,
Source={x:Static s:ResourceService.Current}}" />
</Grid>
</Border>
</spp:PageBase>
@@ -1,15 +1,21 @@
<UserControl xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
x:Class="BD.WTTS.UI.Views.Pages.ErrorPage">
<Panel>
<Image Source="/UI/Assets/back.png"
Stretch="UniformToFill"/>
<TextBlock Text="发生了一些错误,无法打开此页面"
FontSize="16"
HorizontalAlignment="Center"
VerticalAlignment="Center"/>
</Panel>
</UserControl>
<UserControl
x:Class="BD.WTTS.UI.Views.Pages.ErrorPage"
xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:s="https://steampp.net/services"
d:DesignHeight="450"
d:DesignWidth="800"
mc:Ignorable="d">
<Panel>
<Image Source="/UI/Assets/back.png" Stretch="UniformToFill" />
<TextBlock
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontSize="16"
Text="{ReflectionBinding Path=Res.Error_PageFault,
Mode=OneWay,
Source={x:Static s:ResourceService.Current}}" />
</Panel>
</UserControl>
@@ -302,10 +302,10 @@
</MenuItem.Header>
</MenuItem>
<MenuItem Header="-" IsVisible="{ReflectionBinding Path=User, Mode=OneWay, Source={x:Static s:UserService.Current}, Converter={StaticResource IsNullConverter}, ConverterParameter=invert}" />
<MenuItem Header="个人中心" IsVisible="{ReflectionBinding Path=User, Mode=OneWay, Source={x:Static s:UserService.Current}, Converter={StaticResource IsNullConverter}, ConverterParameter=invert}" />
<MenuItem Header="我的订单" IsVisible="{ReflectionBinding Path=User, Mode=OneWay, Source={x:Static s:UserService.Current}, Converter={StaticResource IsNullConverter}, ConverterParameter=invert}" />
<MenuItem Header="绑定第三方账号" IsVisible="{ReflectionBinding Path=User, Mode=OneWay, Source={x:Static s:UserService.Current}, Converter={StaticResource IsNullConverter}, ConverterParameter=invert}" />
<MenuItem Header="修改密码" IsVisible="{ReflectionBinding Path=User, Mode=OneWay, Source={x:Static s:UserService.Current}, Converter={StaticResource IsNullConverter}, ConverterParameter=invert}" />
<MenuItem Header="{ReflectionBinding Path=Res.PersonalCenter, Mode=OneWay, Source={x:Static s:ResourceService.Current}}" IsVisible="{ReflectionBinding Path=User, Mode=OneWay, Source={x:Static s:UserService.Current}, Converter={StaticResource IsNullConverter}, ConverterParameter=invert}" />
<MenuItem Header="{ReflectionBinding Path=Res.MyOrder, Mode=OneWay, Source={x:Static s:ResourceService.Current}}" IsVisible="{ReflectionBinding Path=User, Mode=OneWay, Source={x:Static s:UserService.Current}, Converter={StaticResource IsNullConverter}, ConverterParameter=invert}" />
<MenuItem Header="{ReflectionBinding Path=Res.BindThirdPartyAccount, Mode=OneWay, Source={x:Static s:ResourceService.Current}}" IsVisible="{ReflectionBinding Path=User, Mode=OneWay, Source={x:Static s:UserService.Current}, Converter={StaticResource IsNullConverter}, ConverterParameter=invert}" />
<MenuItem Header="{ReflectionBinding Path=Res.ChangePassword, Mode=OneWay, Source={x:Static s:ResourceService.Current}}" IsVisible="{ReflectionBinding Path=User, Mode=OneWay, Source={x:Static s:UserService.Current}, Converter={StaticResource IsNullConverter}, ConverterParameter=invert}" />
<MenuItem Header="-" />
<MenuItem
Command="{ReflectionBinding Path=SignOut,
@@ -20,7 +20,8 @@
Mode=OneWay,
Source={x:Static s:ResourceService.Current}}"
Theme="{StaticResource SubtitleTextBlockStyle}" />
<spp:OptionsDisplayItem Description="系统启动时程序自动运行" Header="{ReflectionBinding Path=Res.Settings_General_StartAutoRun, Mode=OneWay, Source={x:Static s:ResourceService.Current}}">
<spp:OptionsDisplayItem Description="{ReflectionBinding Path=Res.Settings_StartupAutoRun, Mode=OneWay, Source={x:Static s:ResourceService.Current}}"
Header="{ReflectionBinding Path=Res.Settings_General_StartAutoRun, Mode=OneWay, Source={x:Static s:ResourceService.Current}}">
<spp:OptionsDisplayItem.Icon>
<ui:FontIcon FontFamily="{StaticResource SymbolThemeFontFamily}" Glyph="&#xE770;" />
</spp:OptionsDisplayItem.Icon>
@@ -29,7 +30,8 @@
</spp:OptionsDisplayItem.ActionButton>
</spp:OptionsDisplayItem>
<spp:OptionsDisplayItem Description="设置后程序启动时不再主动显示主窗口" Header="{ReflectionBinding Path=Res.Settings_General_RuningMinimize, Mode=OneWay, Source={x:Static s:ResourceService.Current}}">
<spp:OptionsDisplayItem Description="{ReflectionBinding Path=Res.Settings_StartupNoShowMainWindow, Mode=OneWay, Source={x:Static s:ResourceService.Current}}"
Header="{ReflectionBinding Path=Res.Settings_General_RuningMinimize, Mode=OneWay, Source={x:Static s:ResourceService.Current}}">
<spp:OptionsDisplayItem.Icon>
<ui:FontIcon FontFamily="{StaticResource SymbolThemeFontFamily}" Glyph="&#xEA6C;" />
</spp:OptionsDisplayItem.Icon>
@@ -100,7 +102,7 @@
ActionIconSource="Open"
Command="{Binding OpenFolder_Click}"
CommandParameter="AppData"
Content="AppData 数据"
Content="{ReflectionBinding Path=Res.Settings_General_AppData, Mode=OneWay, Source={x:Static s:ResourceService.Current}}"
IsClickEnabled="True"
ToolTip.Tip="{ReflectionBinding Path=Res.Settings_General_BrowseCustomFolder,
Mode=OneWay,
@@ -111,7 +113,7 @@
ActionIconSource="Open"
Command="{Binding OpenFolder_Click}"
CommandParameter="Cache"
Content="Cache 数据"
Content="{ReflectionBinding Path=Res.Settings_General_CacheData, Mode=OneWay, Source={x:Static s:ResourceService.Current}}"
IsClickEnabled="True"
ToolTip.Tip="{ReflectionBinding Path=Res.Settings_General_BrowseCustomFolder,
Mode=OneWay,
@@ -130,7 +132,7 @@
ActionIconSource="Open"
Command="{Binding OpenFolder_Click}"
CommandParameter="Logs"
Content="Logs 数据"
Content="{ReflectionBinding Path=Res.Settings_General_LogsData, Mode=OneWay, Source={x:Static s:ResourceService.Current}}"
IsClickEnabled="True"
ToolTip.Tip="{ReflectionBinding Path=Res.Settings_General_BrowseCustomFolder,
Mode=OneWay,
@@ -21,7 +21,8 @@
Source={x:Static s:ResourceService.Current}}"
Theme="{StaticResource SubtitleTextBlockStyle}" />
<ui:SettingsExpander Description="仅加载官方插件" Header="安全模式">
<ui:SettingsExpander Description="{ReflectionBinding Path=Res.Settings_Plugin_OnlyLoadOfficial, Mode=OneWay, Source={x:Static s:ResourceService.Current}}"
Header="{ReflectionBinding Path=Res.Settings_Plugin_SafeMode, Mode=OneWay, Source={x:Static s:ResourceService.Current}}">
<ui:SettingsExpander.IconSource>
<ui:FontIconSource FontFamily="Segoe Fluent Icons" Glyph="{StaticResource DefenderApp}" />
</ui:SettingsExpander.IconSource>
@@ -32,7 +33,7 @@
<TextBlock
Margin="0,10,0,5"
Text="已安装插件"
Text="{ReflectionBinding Path=Res.Settings_Plugin_WasInstalled, Mode=OneWay, Source={x:Static s:ResourceService.Current}}"
Theme="{StaticResource BodyStrongTextBlockStyle}" />
<ItemsControl ItemsSource="{Binding Plugins}">
@@ -55,7 +56,7 @@
</ui:SettingsExpander.Footer>
<ui:SettingsExpanderItem
ActionIconSource="Refresh"
Content="检查更新"
Content="{ReflectionBinding Path=Res.CheckUpdate, Mode=OneWay, Source={x:Static s:ResourceService.Current}}"
IsClickEnabled="True">
<ui:SettingsExpanderItem.Description>
<MultiBinding StringFormat="{}{0}{1}">
@@ -69,15 +70,15 @@
</ui:SettingsExpanderItem>
<ui:SettingsExpanderItem
ActionIconSource="Open"
Content="打开插件文件夹"
Content="{ReflectionBinding Path=Res.Settings_Plugin_OpenFolder, Mode=OneWay, Source={x:Static s:ResourceService.Current}}"
IsClickEnabled="True" />
<ui:SettingsExpanderItem
ActionIconSource="Open"
Content="打开插件缓存文件夹"
Content="{ReflectionBinding Path=Res.Settings_Plugin_OpenCacheFolder, Mode=OneWay, Source={x:Static s:ResourceService.Current}}"
IsClickEnabled="True" />
<ui:SettingsExpanderItem
ActionIconSource="Delete"
Content="删除"
Content="{ReflectionBinding Path=Res.Delete, Mode=OneWay, Source={x:Static s:ResourceService.Current}}"
IsClickEnabled="True" />
</ui:SettingsExpander>
</DataTemplate>
@@ -25,11 +25,11 @@
<ui:FontIcon FontFamily="Segoe Fluent Icons" Glyph="&#xE756;" />
</spp:OptionsDisplayItem.Icon>
<spp:OptionsDisplayItem.ActionButton>
<Button Command="{ReflectionBinding SelectSteamProgramLocation}" Content="选择路径" />
<Button Command="{ReflectionBinding SelectSteamProgramLocation}" Content="{ReflectionBinding Path=Res.LocalAuth_ExportAuth_SelectPath, Mode=OneWay, Source={x:Static s:ResourceService.Current}}" />
</spp:OptionsDisplayItem.ActionButton>
</spp:OptionsDisplayItem>
<spp:OptionsDisplayItem Header="{ReflectionBinding Path=Res.Settings_Steam_AutoRunSteam, Mode=OneWay, Source={x:Static s:ResourceService.Current}}">
<spp:OptionsDisplayItem Header="{ReflectionBinding Path=Res.Settings_Steam_AutoRunSteam, Mode=OneWay, Source={x:Static s:ResourceService.Current}}">
<spp:OptionsDisplayItem.Icon>
<ui:FontIcon FontFamily="{StaticResource SymbolThemeFontFamily}" Glyph="&#xE770;" />
</spp:OptionsDisplayItem.Icon>
@@ -38,8 +38,8 @@
</spp:OptionsDisplayItem.ActionButton>
</spp:OptionsDisplayItem>
<spp:OptionsDisplayItem
Description="Steam 默认不应该以管理员运行,但如果有特殊需求可以勾选此项"
<spp:OptionsDisplayItem
Description="{ReflectionBinding Path=Res.Settings_Steam_AdminRunPrompt, Mode=OneWay, Source={x:Static s:ResourceService.Current}}"
Header="{ReflectionBinding Path=Res.Settings_Steam_RuningAdmin,
Mode=OneWay,
Source={x:Static s:ResourceService.Current}}"
@@ -52,7 +52,7 @@
</spp:OptionsDisplayItem.ActionButton>
</spp:OptionsDisplayItem>
<spp:OptionsDisplayItem Description="设置后程序启动 Steam 时默认不弹出主窗口" Header="{ReflectionBinding Path=Res.Settings_Steam_RuningMinimize, Mode=OneWay, Source={x:Static s:ResourceService.Current}}">
<spp:OptionsDisplayItem Description="{ReflectionBinding Path=Res.Settings_Steam_SetUpDefaultNoShowMainWindow, Mode=OneWay, Source={x:Static s:ResourceService.Current}}" Header="{ReflectionBinding Path=Res.Settings_Steam_RuningMinimize, Mode=OneWay, Source={x:Static s:ResourceService.Current}}">
<spp:OptionsDisplayItem.Icon>
<ui:FontIcon FontFamily="{StaticResource SymbolThemeFontFamily}" Glyph="&#xE9E9;" />
</spp:OptionsDisplayItem.Icon>
@@ -61,7 +61,7 @@
</spp:OptionsDisplayItem.ActionButton>
</spp:OptionsDisplayItem>
<spp:OptionsDisplayItem Description="设置此参数后程序启动 Steam 将不会在自动检查更新" Header="{ReflectionBinding Path=Res.Settings_Steam_NotCheckUpdate, Mode=OneWay, Source={x:Static s:ResourceService.Current}}">
<spp:OptionsDisplayItem Description="{ReflectionBinding Path=Res.Settings_Steam_NoAutoUpdate, Mode=OneWay, Source={x:Static s:ResourceService.Current}}" Header="{ReflectionBinding Path=Res.Settings_Steam_NotCheckUpdate, Mode=OneWay, Source={x:Static s:ResourceService.Current}}">
<spp:OptionsDisplayItem.Icon>
<ui:FontIcon FontFamily="{StaticResource SymbolThemeFontFamily}" Glyph="&#xE895;" />
</spp:OptionsDisplayItem.Icon>
@@ -79,7 +79,7 @@
</spp:OptionsDisplayItem.ActionButton>
</spp:OptionsDisplayItem>
<spp:OptionsDisplayItem Description="程序检测到 Steam 启动后自动弹出相关信息通知" Header="{ReflectionBinding Path=Res.Settings_Steam_CheckSteamRuningNotification, Mode=OneWay, Source={x:Static s:ResourceService.Current}}">
<spp:OptionsDisplayItem Description="{ReflectionBinding Path=Res.Settings_Steam_AutoPopupMessage, Mode=OneWay, Source={x:Static s:ResourceService.Current}}" Header="{ReflectionBinding Path=Res.Settings_Steam_CheckSteamRuningNotification, Mode=OneWay, Source={x:Static s:ResourceService.Current}}">
<spp:OptionsDisplayItem.Icon>
<ui:FontIcon FontFamily="{StaticResource SymbolThemeFontFamily}" Glyph="&#xE7E7;" />
</spp:OptionsDisplayItem.Icon>
@@ -46,7 +46,7 @@
</Border>
<spp:OptionsDisplayItem
Description="设置程序的主题风格"
Description="{ReflectionBinding Path=Res.Settings_UI_ThemeStyle, Mode=OneWay, Source={x:Static s:ResourceService.Current}}"
Header="{ReflectionBinding Path=Res.Settings_Theme,
Mode=OneWay,
Source={x:Static s:ResourceService.Current}}"
@@ -66,7 +66,7 @@
</spp:OptionsDisplayItem.ActionButton>
</spp:OptionsDisplayItem>
<spp:OptionsDisplayItem
Description="设置程序中显示的强调色"
Description="{ReflectionBinding Path=Res.Settings_UI_AccentColor, Mode=OneWay, Source={x:Static s:ResourceService.Current}}"
Expands="True"
Header="{ReflectionBinding Path=Res.Settings_ThemeAccent,
Mode=OneWay,
@@ -92,7 +92,7 @@
<TextBlock
VerticalAlignment="Center"
DockPanel.Dock="Left"
Text="预览颜色" />
Text="{ReflectionBinding Path=Res.Settings_UI_PreviewColorr, Mode=OneWay, Source={x:Static s:ResourceService.Current}}" />
<Grid
HorizontalAlignment="Left"
@@ -271,7 +271,7 @@
<TextBlock
VerticalAlignment="Center"
DockPanel.Dock="Left"
Text="自定义颜色" />
Text="{ReflectionBinding Path=Res.Settings_UI_CustomColor, Mode=OneWay, Source={x:Static s:ResourceService.Current}}" />
<ui:ColorPickerButton
DockPanel.Dock="Right"
@@ -292,7 +292,7 @@
</spp:OptionsDisplayItem>
<spp:OptionsDisplayItem
Description="设置程序首选的显示语言"
Description="{ReflectionBinding Path=Res.Settings_UI_DefaultLanguage, Mode=OneWay, Source={x:Static s:ResourceService.Current}}"
Header="{ReflectionBinding Path=Res.Settings_Language,
Mode=OneWay,
Source={x:Static s:ResourceService.Current}}"
@@ -312,7 +312,7 @@
</spp:OptionsDisplayItem>
<spp:OptionsDisplayItem
Description="设置程序首选的字体"
Description="{ReflectionBinding Path=Res.Settings_UI_DefaultFonts, Mode=OneWay, Source={x:Static s:ResourceService.Current}}"
Header="{ReflectionBinding Path=Res.Settings_Fonts,
Mode=OneWay,
Source={x:Static s:ResourceService.Current}}"
@@ -335,7 +335,7 @@
</spp:OptionsDisplayItem>
<spp:OptionsDisplayItem
Description="设置窗口背景透明效果和透明材质"
Description="{ReflectionBinding Path=Res.Settings_UI_WindowBackgroundStyle, Mode=OneWay, Source={x:Static s:ResourceService.Current}}"
Header="{ReflectionBinding Path=Res.Settings_UI_WindowTransparencyMaterial,
Mode=OneWay,
Source={x:Static s:ResourceService.Current}}"
@@ -396,7 +396,7 @@
<TextBlock
VerticalAlignment="Center"
DockPanel.Dock="Left"
Text="预览图片" />
Text="{ReflectionBinding Path=Res.PreviewPictures, Mode=OneWay, Source={x:Static s:ResourceService.Current}}" />
<Image
Width="250"
@@ -448,7 +448,7 @@
<TextBlock
VerticalAlignment="Center"
DockPanel.Dock="Left"
Text="选择一张照片" />
Text="{ReflectionBinding Path=Res.SelectPicture, Mode=OneWay, Source={x:Static s:ResourceService.Current}}" />
<Button
MinWidth="150"
Command="{Binding SelectImage_Click}"
@@ -467,7 +467,7 @@
<TextBlock
VerticalAlignment="Center"
DockPanel.Dock="Left"
Text="选择图片缩放方式" />
Text="{ReflectionBinding Path=Res.PictureZoom, Mode=OneWay, Source={x:Static s:ResourceService.Current}}" />
<ComboBox
MinWidth="150"
DockPanel.Dock="Right"
@@ -186,7 +186,7 @@
<TextBlock Text="{ReflectionBinding Path=Res.User_WaitFastLoginTip, Mode=OneWay, Source={x:Static s:ResourceService.Current}}" TextWrapping="Wrap" />
<WrapPanel Margin="0,20" HorizontalAlignment="Center">
<TextBlock Text="如果登录过程出现意外,按照网页提示进行" Theme="{StaticResource CaptionTextBlockStyle}" />
<TextBlock Text="{ReflectionBinding Path=Res.User_LoginUnexpectedPrompt, Mode=OneWay, Source={x:Static s:ResourceService.Current}}" Theme="{StaticResource CaptionTextBlockStyle}" />
<ui:HyperlinkButton
Margin="5,0"
Padding="0"
@@ -50,7 +50,7 @@ public sealed class ScriptManager : GeneralHttpClientFactory, IScriptManager
}
else
{
var msg = AppResources.Script_NoFile.Format(filePath); // $"文件不存在:{filePath}";
var msg = AppResources.Script_NoFile_.Format(filePath); // $"文件不存在:{filePath}";
logger.LogError(msg);
return ApiRspHelper.Fail<ScriptDTO?>(msg);
}
@@ -102,7 +102,7 @@ public sealed class ScriptManager : GeneralHttpClientFactory, IScriptManager
var state = await DeleteScriptAsync(oldInfo, false);
if (!state.IsSuccess)
{
return ApiRspHelper.Fail<ScriptDTO?>(AppResources.Script_FileDeleteError.Format(oldInfo.FilePath));
return ApiRspHelper.Fail<ScriptDTO?>(AppResources.Script_FileDeleteError_.Format(oldInfo.FilePath));
}
}
}
@@ -150,7 +150,7 @@ public sealed class ScriptManager : GeneralHttpClientFactory, IScriptManager
}
else
{
var msg = AppResources.Script_BuildError.Format(fileInfo.FullName);
var msg = AppResources.Script_BuildError_.Format(fileInfo.FullName);
logger.LogError(msg);
toast.Show(msg);
return ApiRspHelper.Fail<ScriptDTO?>(msg);
@@ -158,7 +158,7 @@ public sealed class ScriptManager : GeneralHttpClientFactory, IScriptManager
}
else
{
var msg = AppResources.Script_ReadFileError.Format(fileInfo.FullName);
var msg = AppResources.Script_ReadFileError_.Format(fileInfo.FullName);
logger.LogError(msg);
toast.Show(msg);
return ApiRspHelper.Fail<ScriptDTO?>(msg);
@@ -166,14 +166,14 @@ public sealed class ScriptManager : GeneralHttpClientFactory, IScriptManager
}
catch (Exception e)
{
var msg = AppResources.Script_ReadFileError.Format(e.GetAllMessage());
var msg = AppResources.Script_ReadFileError_.Format(e.GetAllMessage());
logger.LogError(e, msg);
return ApiRspHelper.Code<ScriptDTO?>(ApiRspCode.Fail, msg, default, e);
}
}
else
{
var msg = string.Format(AppResources.Script_ReadFileError, fileInfo.FullName); //$"文件解析失败,请检查格式:{filePath}";
var msg = string.Format(AppResources.Script_ReadFileError_, fileInfo.FullName); //$"文件解析失败,请检查格式:{filePath}";
logger.LogError(msg);
return ApiRspHelper.Fail<ScriptDTO?>(msg);
}
@@ -198,7 +198,7 @@ public sealed class ScriptManager : GeneralHttpClientFactory, IScriptManager
}
catch (Exception e)
{
var errorMsg = AppResources.Script_BuildDownloadError.Format(model.Name, item);
var errorMsg = AppResources.Script_BuildDownloadError__.Format(model.Name, item);
logger.LogError(e, errorMsg);
toast.Show(errorMsg);
}
@@ -232,7 +232,7 @@ public sealed class ScriptManager : GeneralHttpClientFactory, IScriptManager
}
catch (Exception e)
{
var msg = AppResources.Script_BuildError.Format(e.GetAllMessage());
var msg = AppResources.Script_BuildError_.Format(e.GetAllMessage());
logger.LogError(e, msg);
toast.Show(msg);
}
@@ -257,7 +257,7 @@ public sealed class ScriptManager : GeneralHttpClientFactory, IScriptManager
}
catch (Exception e)
{
var msg = AppResources.Script_CacheDeleteError.Format(e.GetAllMessage());
var msg = AppResources.Script_CacheDeleteError_.Format(e.GetAllMessage());
logger.LogError(e, "cachePath: {cachePath}, msg: {msg}", cachePath, msg);
return ApiRspHelper.Fail(msg);
}
@@ -271,7 +271,7 @@ public sealed class ScriptManager : GeneralHttpClientFactory, IScriptManager
}
catch (Exception e)
{
var msg = AppResources.Script_FileDeleteError.Format(e.GetAllMessage());
var msg = AppResources.Script_FileDeleteError_.Format(e.GetAllMessage());
logger.LogError(e, "savePath: {savePath}, msg: {msg}", savePath, msg);
return ApiRspHelper.Fail(msg);
}
@@ -316,7 +316,7 @@ public sealed class ScriptManager : GeneralHttpClientFactory, IScriptManager
item.Content = File.ReadAllText(infoPath);
if (!await BuildScriptAsync(item, fileInfo, item.IsCompile))
{
toast.Show(AppResources.Script_ReadFileError.Format(item.Name));
toast.Show(AppResources.Script_ReadFileError_.Format(item.Name));
}
}
@@ -326,12 +326,12 @@ public sealed class ScriptManager : GeneralHttpClientFactory, IScriptManager
if (temp.IsSuccess)
{
//$"脚本:{item.Name}_文件丢失已删除"
toast.Show(AppResources.Script_NoFile.Format(item.Name));
toast.Show(AppResources.Script_NoFile_.Format(item.Name));
}
else
{
//toast.Show($"脚本:{item.Name}_文件丢失,删除失败去尝试手动删除");
toast.Show(AppResources.Script_NoFileDeleteError.Format(item.Name));
toast.Show(AppResources.Script_NoFileDeleteError_.Format(item.Name));
}
}
}
@@ -359,7 +359,7 @@ public sealed class ScriptManager : GeneralHttpClientFactory, IScriptManager
}
catch (Exception e)
{
var errorMsg = AppResources.Script_ReadFileError.Format(e.GetAllMessage()); //$"文件读取出错:[{e}]";
var errorMsg = AppResources.Script_ReadFileError_.Format(e.GetAllMessage()); //$"文件读取出错:[{e}]";
logger.LogError(e, errorMsg);
toast.Show(errorMsg);
}
@@ -398,7 +398,7 @@ public sealed class ScriptManager : GeneralHttpClientFactory, IScriptManager
"DownloadScriptDeleteCatch Error, url: {url}, cachePath: {cachePath}",
url, cachePath);
return ApiRspHelper.Fail<string>(
AppResources.Script_CacheDeleteError.Format(cachePath));
AppResources.Script_CacheDeleteError_.Format(cachePath));
}
}
using (var stream = fileInfo.CreateText())
@@ -448,7 +448,7 @@ public sealed partial class ProxyService
}
else
{
var msg = Strings.Script_FileError.Format(filename); // $"文件不存在:{filePath}";
var msg = Strings.Script_FileError_.Format(filename); // $"文件不存在:{filePath}";
Toast.Show(msg);
}
}
@@ -1,3 +1,5 @@
using AppResources = BD.WTTS.Client.Resources.Strings;
using BD.WTTS.Client.Resources;
using BD.WTTS.UI.Views.Pages;
@@ -22,7 +24,7 @@ public sealed partial class AcceleratorPageViewModel
if (ProxyService.Current.ProxyStatus == false)
await ProxyService.Current.InitializeAccelerateAsync();
else
Toast.Show(ToastIcon.Warning, "请先停止加速");
Toast.Show(ToastIcon.Warning, AppResources.Warning_PleaseStopAccelerate);
});
ProxySettingsCommand = ReactiveCommand.Create(() =>
@@ -144,7 +144,7 @@
Margin="28,4,0,4"
HorizontalAlignment="Left"
VerticalAlignment="Center"
Text="加速设置" />
Text="{ReflectionBinding Path=Res.CommunityFix_MenuName,Mode=OneWay,Source={x:Static s:ResourceService.Current}}" />
</Panel>
</ToggleButton>
@@ -165,7 +165,7 @@
</DataTemplate>
</ui:MenuFlyoutSubItem.ItemTemplate>
</ui:MenuFlyoutSubItem>-->
<ui:MenuFlyoutItem Text="插件设置" />
<ui:MenuFlyoutItem Text="{ReflectionBinding Path=Res.Settings_Plugin,Mode=OneWay,Source={x:Static s:ResourceService.Current}}" />
<ui:MenuFlyoutSeparator />
<!--<ui:MenuFlyoutItem Text="安装证书" />
<ui:MenuFlyoutItem Text="移除证书" />
@@ -189,9 +189,9 @@
</MultiBinding>
</ui:MenuFlyoutItem.Text>
</ui:MenuFlyoutItem>
<ui:MenuFlyoutItem Text="在 Steam++ 插件商店中查看" />
<ui:MenuFlyoutItem Text="使用帮助" />
<ui:MenuFlyoutItem Text="关于此插件" />
<ui:MenuFlyoutItem Text="{ReflectionBinding Path=Res.ViewInStore, Mode=OneWay,Source={x:Static s:ResourceService.Current}}" />
<ui:MenuFlyoutItem Text="{ReflectionBinding Path=Res.UseHelp, Mode=OneWay,Source={x:Static s:ResourceService.Current}}" />
<ui:MenuFlyoutItem Text="{ReflectionBinding Path=Res.AboutThisPlugin, Mode=OneWay,Source={x:Static s:ResourceService.Current}}" />
</ui:FAMenuFlyout>
</DropDownButton.Flyout>
</DropDownButton>
@@ -199,7 +199,7 @@
</spp:PageBase.ActionContent>
<spp:PageBase.PaneContent>
<StackPanel Margin="15,20" Spacing="10">
<TextBlock Text="加速模式" Theme="{StaticResource BodyStrongTextBlockStyle}" />
<TextBlock Text="{ReflectionBinding Path=Res.CommunityFix_ProxyMode, Mode=OneWay,Source={x:Static s:ResourceService.Current}}" Theme="{StaticResource BodyStrongTextBlockStyle}" />
<TabStrip
Background="{DynamicResource ControlOnImageFillColorDefaultBrush}"
@@ -219,7 +219,7 @@
</TabStrip.ItemTemplate>
</TabStrip>
<TextBlock Text="加速设置" Theme="{StaticResource BodyStrongTextBlockStyle}" />
<TextBlock Text="{ReflectionBinding Path=Res.CommunityFix_MenuName, Mode=OneWay,Source={x:Static s:ResourceService.Current}}" Theme="{StaticResource BodyStrongTextBlockStyle}" />
<ToggleSwitch
VerticalAlignment="Center"
@@ -1,21 +1,4 @@
<spp:PageBase
x:Class="BD.WTTS.UI.Views.Pages.ScriptPage"
xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:ms="https://steampp.net/settings"
xmlns:s="https://steampp.net/services"
xmlns:spp="https://steampp.net/ui"
xmlns:ui="using:FluentAvalonia.UI.Controls"
x:Name="u"
Title="{ReflectionBinding Path=Res.ScriptConfig,
Mode=OneWay,
Source={x:Static s:ResourceService.Current}}"
d:DesignHeight="450"
d:DesignWidth="800"
x:CompileBindings="True"
x:DataType="spp:ScriptPageViewModel"
Description="{ReflectionBinding Description,
Source={x:Static s:Plugin.Instance},
Mode=OneWay}"
@@ -24,92 +7,109 @@
Mode=OneWay,
Converter={StaticResource StringFormatConverter},
ConverterParameter=Plugin_Author}"
mc:Ignorable="d">
Title="{ReflectionBinding Path=Res.ScriptConfig,
Mode=OneWay,
Source={x:Static s:ResourceService.Current}}"
d:DesignHeight="450"
d:DesignWidth="800"
mc:Ignorable="d"
x:Class="BD.WTTS.UI.Views.Pages.ScriptPage"
x:CompileBindings="True"
x:DataType="spp:ScriptPageViewModel"
x:Name="u"
xmlns="https://github.com/avaloniaui"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:ms="https://steampp.net/settings"
xmlns:s="https://steampp.net/services"
xmlns:spp="https://steampp.net/ui"
xmlns:ui="using:FluentAvalonia.UI.Controls"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<spp:PageBase.PreviewImage>
<ui:ImageIconSource Source="avares://BD.WTTS.Client.Plugins.Accelerator/UI/Assets/script.ico" />
</spp:PageBase.PreviewImage>
<spp:PageBase.ActionContent>
<StackPanel Orientation="Horizontal" Spacing="2">
<Button
Padding="8,4"
Command="{Binding ScriptStoreCommand}"
DockPanel.Dock="Right"
Padding="8,4"
Theme="{StaticResource TransparentButton}">
<Panel>
<Viewbox
Width="16"
Height="16"
HorizontalAlignment="Left">
HorizontalAlignment="Left"
Width="16">
<ui:SymbolIcon Symbol="Globe" />
</Viewbox>
<TextBlock
Margin="28,4,0,4"
HorizontalAlignment="Left"
VerticalAlignment="Center"
Margin="28,4,0,4"
Text="{ReflectionBinding Path=Res.ScriptStore,
Mode=OneWay,
Source={x:Static s:ResourceService.Current}}" />
Source={x:Static s:ResourceService.Current}}"
VerticalAlignment="Center" />
</Panel>
</Button>
<Separator
Height="18"
Margin="0"
VerticalAlignment="Center"
Background="{DynamicResource ButtonBorderBrush}"
Classes="Vertical"
DockPanel.Dock="Right"
IsHitTestVisible="False" />
Height="18"
IsHitTestVisible="False"
Margin="0"
VerticalAlignment="Center" />
<Button
Padding="8,4"
DockPanel.Dock="Right"
Padding="8,4"
Theme="{StaticResource TransparentButton}">
<Panel>
<Viewbox
Width="16"
Height="16"
HorizontalAlignment="Left">
HorizontalAlignment="Left"
Width="16">
<ui:SymbolIcon Symbol="Add" />
</Viewbox>
<TextBlock
Margin="28,4,0,4"
HorizontalAlignment="Left"
VerticalAlignment="Center"
Margin="28,4,0,4"
Text="{ReflectionBinding Path=Res.Import,
Mode=OneWay,
Source={x:Static s:ResourceService.Current}}" />
Source={x:Static s:ResourceService.Current}}"
VerticalAlignment="Center" />
</Panel>
</Button>
<Button
Padding="8,4"
DockPanel.Dock="Right"
Padding="8,4"
Theme="{StaticResource TransparentButton}">
<Panel>
<Viewbox
Width="16"
Height="16"
HorizontalAlignment="Left">
HorizontalAlignment="Left"
Width="16">
<ui:SymbolIcon Symbol="Refresh" />
</Viewbox>
<TextBlock
Margin="28,4,0,4"
HorizontalAlignment="Left"
VerticalAlignment="Center"
Margin="28,4,0,4"
Text="{ReflectionBinding Path=Res.Refresh,
Mode=OneWay,
Source={x:Static s:ResourceService.Current}}" />
Source={x:Static s:ResourceService.Current}}"
VerticalAlignment="Center" />
</Panel>
</Button>
<DropDownButton
Padding="8"
HorizontalContentAlignment="Center"
VerticalContentAlignment="Center"
Content="{StaticResource More}"
FontFamily="{StaticResource SymbolThemeFontFamily}"
FontSize="20"
Theme="{StaticResource TransparentButton}">
HorizontalContentAlignment="Center"
Padding="8"
Theme="{StaticResource TransparentButton}"
VerticalContentAlignment="Center">
<DropDownButton.Flyout>
<ui:FAMenuFlyout Placement="BottomEdgeAlignedRight">
<ui:MenuFlyoutItem Text="脚本设置" />
<ui:MenuFlyoutItem Text="{ReflectionBinding Path=Res.Script_Settings, Mode=OneWay, Source={x:Static s:ResourceService.Current}}" />
<ui:MenuFlyoutSeparator />
<ui:MenuFlyoutItem Text="{ReflectionBinding Path=Res.Script_AutoUpdate, Mode=OneWay, Source={x:Static s:ResourceService.Current}}" />
<ui:MenuFlyoutItem Text="{ReflectionBinding Path=Res.CommunityFix_OnlySteamBrowser, Mode=OneWay, Source={x:Static s:ResourceService.Current}}" />
@@ -128,9 +128,9 @@
</MultiBinding>
</ui:MenuFlyoutItem.Text>
</ui:MenuFlyoutItem>
<ui:MenuFlyoutItem Text="在 Steam++ 插件商店中查看" />
<ui:MenuFlyoutItem Text="使用帮助" />
<ui:MenuFlyoutItem Text="关于此插件" />
<ui:MenuFlyoutItem Text="{ReflectionBinding Path=Res.ViewInStore, Mode=OneWay, Source={x:Static s:ResourceService.Current}}" />
<ui:MenuFlyoutItem Text="{ReflectionBinding Path=Res.UseHelp, Mode=OneWay, Source={x:Static s:ResourceService.Current}}" />
<ui:MenuFlyoutItem Text="{ReflectionBinding Path=Res.AboutThisPlugin, Mode=OneWay, Source={x:Static s:ResourceService.Current}}" />
</ui:FAMenuFlyout>
</DropDownButton.Flyout>
</DropDownButton>
@@ -147,10 +147,10 @@
<DataTemplate DataType="spp:ScriptDTO">
<Border Margin="5" spp:Animations.EnableAnimations="True">
<spp:AppItem
Title="{Binding Name}"
Width="400"
Description="{Binding Describe}"
ImageMargin="15,0">
ImageMargin="15,0"
Title="{Binding Name}"
Width="400">
<spp:AppItem.Status>
<ToggleSwitch Classes="LeftContent" IsChecked="{Binding !Disable, Mode=TwoWay}" />
</spp:AppItem.Status>
@@ -201,21 +201,21 @@
<spp:AppItem.Image>
<Panel>
<spp:Image2
Height="80"
FallbackSource="avares://BD.WTTS.Client.Plugins.Accelerator/UI/Assets/script.ico"
Height="80"
IsVisible="{Binding !IsLoading}"
RenderOptions.BitmapInterpolationMode="HighQuality"
Source="{Binding IconUrl}"
Stretch="Uniform" />
<ProgressBar
Width="80"
Height="80"
Classes="Circle"
Height="80"
IsIndeterminate="True"
IsVisible="{Binding IsLoading}"
ToolTip.Tip="{ReflectionBinding Path=Res.Script_ImportLoading,
Mode=OneWay,
Source={x:Static s:ResourceService.Current}}" />
Source={x:Static s:ResourceService.Current}}"
Width="80" />
</Panel>
</spp:AppItem.Image>
</spp:AppItem>
@@ -193,7 +193,7 @@ public sealed class ASFService : ReactiveObject
}
}
}
Toast.Show(string.Format(AppResources.LocalAuth_ImportSuccessTip, num));
Toast.Show(string.Format(AppResources.LocalAuth_ImportSuccessTip_, num));
}
}
#endif
@@ -1,4 +1,4 @@
using BD.WTTS.Client.Resources;
using AppResources = BD.WTTS.Client.Resources.Strings;
using WinAuth;
namespace BD.WTTS.Models;
@@ -129,6 +129,6 @@ public class SteamTradeConfirmationModel : ReactiveObject
return;
}
Log.Error(nameof(SteamTradePageViewModel), exception, nameof(ExceptionHandling));
Toast.Show(ToastIcon.Error, "异常:" + exception.Message);
Toast.Show(ToastIcon.Error, AppResources.Error_Exception_.Format(exception.Message));
}
}
@@ -1,3 +1,5 @@
using AppResources = BD.WTTS.Client.Resources.Strings;
using Avalonia.Media.Imaging;
using BD.WTTS.Client.Resources;
using WinAuth;
@@ -7,11 +9,11 @@ namespace BD.WTTS.Services;
public sealed partial class AuthenticatorService
{
static IAccountPlatformAuthenticatorRepository repository = Ioc.Get<IAccountPlatformAuthenticatorRepository>();
public static async Task ShowCaptchaUrl(string? url)
{
if (string.IsNullOrEmpty(url))
Toast.Show(ToastIcon.Warning, "验证码URL为空,请重新登录");
Toast.Show(ToastIcon.Warning, AppResources.Warning_CodeNullPleaseLogin);
else
{
if (await Browser2.OpenAsync(url)) return;
@@ -19,11 +21,11 @@ public sealed partial class AuthenticatorService
Toast.Show(ToastIcon.Success, Strings.CopyToClipboard);
}
}
public async Task<Bitmap> GetUrlImage(string url)
{
using var client = new HttpClient();
var imageBytes = await client.GetByteArrayAsync(
new Uri(url));
using var stream = new MemoryStream(imageBytes);
@@ -104,7 +106,7 @@ public sealed partial class AuthenticatorService
await repository.RenameAsync(authenticatorDto.Id, newName, isLocal);
}
public static async Task<(IAccountPlatformAuthenticatorRepository.ImportResultCode resultCode, IReadOnlyList<IAuthenticatorDTO> result, int sourcesCount)>
public static async Task<(IAccountPlatformAuthenticatorRepository.ImportResultCode resultCode, IReadOnlyList<IAuthenticatorDTO> result, int sourcesCount)>
ImportAsync(string? exportPassword, byte[] data)
{
return await repository.ImportAsync(exportPassword, data);
@@ -164,14 +166,15 @@ public sealed partial class AuthenticatorService
var valueDto = ConvertToAuthenticatorValueDto(exportDto);
AuthenticatorDTO dto = new AuthenticatorDTO()
{
ServerId = authenticatorResponse.Id, Value = valueDto,
ServerId = authenticatorResponse.Id,
Value = valueDto,
Name = exportDto.Name,
Index = (int)authenticatorResponse.Order,
//LastUpdate = DateTimeOffset.Now,
};
return dto;
}
static IAuthenticatorValueDTO? ConvertToAuthenticatorValueDto(AuthenticatorExportDTO authenticatorExportDto)
{
IAuthenticatorValueDTO? valueDto = null;
@@ -181,7 +184,7 @@ public sealed partial class AuthenticatorService
case AuthenticatorPlatform.Steam:
valueDto = new SteamAuthenticator()
{
DeviceId = authenticatorExportDto.DeviceId,
DeviceId = authenticatorExportDto.DeviceId,
SteamData = authenticatorExportDto.SteamData,
};
break;
@@ -199,7 +202,7 @@ public sealed partial class AuthenticatorService
break;
}
if (valueDto == null) return null;
valueDto.Issuer = authenticatorExportDto.Issuer;
valueDto.HMACType = authenticatorExportDto.HMACType;
valueDto.SecretKey = authenticatorExportDto.SecretKey;
@@ -227,7 +230,7 @@ public sealed partial class AuthenticatorService
auth.Enroll(privateKey);
if (auth.ServerTimeDiff == 0L)
Toast.Show(ToastIcon.Error, "无法连接到令牌验证服务器");
Toast.Show(ToastIcon.Error, AppResources.Error_CannotConnectTokenVerificationServer);
return auth;
}
@@ -249,7 +252,7 @@ public sealed partial class AuthenticatorService
//var code = auth.CurrentCode;
if (auth.ServerTimeDiff == 0L)
Toast.Show(ToastIcon.Error, "无法连接到Google服务器");
Toast.Show(ToastIcon.Error, AppResources.Error_CannotConnectGoogleServer);
return auth;
}
@@ -265,7 +268,7 @@ public sealed partial class AuthenticatorService
auth.Enroll(privateKey);
if (auth.ServerTimeDiff == 0L)
Toast.Show(ToastIcon.Error, "无法连接到令牌验证服务器");
Toast.Show(ToastIcon.Error, AppResources.Error_CannotConnectTokenVerificationServer);
return auth;
}
@@ -299,7 +302,7 @@ public sealed partial class AuthenticatorService
if (response.StatusCode == HttpStatusCode.OK)
{
//response.Content.Headers.ContentType.;
#if WINDOWS
#if WINDOWS
using (System.Drawing.Bitmap bitmap = (System.Drawing.Bitmap)System.Drawing.Image.FromStream(await response.Content.ReadAsStreamAsync()))
{
//二维码解析
@@ -310,29 +313,29 @@ public sealed partial class AuthenticatorService
// privatekey = HttpUtility.UrlDecode(result.Text);
// }
}
#endif
#endif
}
}
catch (Exception e)
{
Toast.Show(ToastIcon.Error, "扫描网页二维码失败:" + e.Message);
Toast.Show(ToastIcon.Error, AppResources.Error_ScanQRCodeFailed_.Format(e.Message));
Log.Error(nameof(AuthenticatorService), e, nameof(DecodePrivateKey));
}
}
else if (SecretCodeDataImageRegex().Match(secretCode) is { Success: true } dataImageMatch)
{
var imageData = Convert.FromBase64String(dataImageMatch.Groups[2].Value);
using (var ms = new MemoryStream(imageData))
{
#if WINDOWS
#if WINDOWS
using (var bitmap = (System.Drawing.Bitmap)System.Drawing.Image.FromStream(ms))
{
//二维码解析
}
#endif
#endif
}
}
// else if (SecretCodeOptAuthRegex().Match(secretCode) is { Success: true } optMatch)
@@ -373,7 +376,7 @@ public sealed partial class AuthenticatorService
return null;
}
[GeneratedRegex("https?://.*")]
private static partial Regex SecretCodeHttpRegex();
@@ -382,7 +385,7 @@ public sealed partial class AuthenticatorService
[GeneratedRegex(@"otpauth://([^/]+)/([^?]+)\?(.*)", RegexOptions.IgnoreCase)]
private static partial Regex SecretCodeOptAuthRegex();
[GeneratedRegex(@"[^0-9a-z]", RegexOptions.IgnoreCase)]
private static partial Regex SecretHexCodeAuthRegex();
}
@@ -1,6 +1,4 @@
using BD.WTTS.Client.Resources;
using WinAuth;
using System;
using AppResources = BD.WTTS.Client.Resources.Strings;
namespace BD.WTTS.UI.ViewModels;
@@ -55,7 +53,7 @@ public class AuthenticatorExportViewModel : ViewModelBase
this.RaisePropertyChanged();
}
}
/// <summary>
/// 默认导出文件名
/// </summary>
@@ -102,7 +100,7 @@ public class AuthenticatorExportViewModel : ViewModelBase
});
if (ExportFile == null) return;
}
if (HasPasswordProtection)
{
if (string.IsNullOrWhiteSpace(VerifyPassword) && VerifyPassword != Password)
@@ -111,7 +109,7 @@ public class AuthenticatorExportViewModel : ViewModelBase
return;
}
}
var filestream = ExportFile?.OpenWrite();
if (filestream == null)
{
@@ -133,12 +131,12 @@ public class AuthenticatorExportViewModel : ViewModelBase
var auths = await AuthenticatorService.GetAllAuthenticatorsAsync(sourceData, password);
await AuthenticatorService.ExportAsync(filestream, HasLocalProtection, auths, VerifyPassword);
await filestream.FlushAsync();
await filestream.DisposeAsync();
Toast.Show(ToastIcon.Success, Strings.ExportedToPath_.Format(ExportFile?.ToString()));
ExportFile = null;
}
@@ -148,13 +146,13 @@ public class AuthenticatorExportViewModel : ViewModelBase
{
InputType = TextBoxWindowViewModel.TextBoxInputType.Password,
};
if (await IWindowManager.Instance.ShowTaskDialogAsync(textViewmodel, "请输入原令牌保护密码", isDialog: false,
if (await IWindowManager.Instance.ShowTaskDialogAsync(textViewmodel, AppResources.Title_OldPasswordAuth, isDialog: false,
isCancelButton: true) &&
textViewmodel.Value != null)
{
if (!(await AuthenticatorService.ValidatePassword(sourceData[0], textViewmodel.Value)))
{
Toast.Show(ToastIcon.Warning, "密码错误,请重试");
Toast.Show(ToastIcon.Warning, AppResources.Warning_PasswordError);
await GetAuthenticators(sourceData);
}
return textViewmodel.Value;
@@ -1,7 +1,10 @@
using AppResources = BD.WTTS.Client.Resources.Strings;
using BD.SteamClient.Models;
using BD.SteamClient.Services;
using BD.WTTS.UI.Views.Pages;
using WinAuth;
using AngleSharp.Text;
namespace BD.WTTS.UI.ViewModels;
@@ -54,7 +57,7 @@ public sealed partial class AuthenticatorPageViewModel : ViewModelBase
//await AuthenticatorService.DeleteAllAuthenticatorsAsync();
if (_initializeTime > DateTime.Now.AddSeconds(-1))
{
Toast.Show(ToastIcon.Warning, "请勿频繁操作");
Toast.Show(ToastIcon.Warning, AppResources.Warning_DoNotOperateFrequently);
return;
}
@@ -90,7 +93,7 @@ public sealed partial class AuthenticatorPageViewModel : ViewModelBase
Auths.Add(new AuthenticatorItemModel(item));
}
Toast.Show(ToastIcon.Success, "令牌加载成功");
Toast.Show(ToastIcon.Success, AppResources.Success_AuthloadedSuccessfully);
}
public async Task<bool> EnterPassword(AccountPlatformAuthenticator sourceData)
@@ -99,7 +102,7 @@ public sealed partial class AuthenticatorPageViewModel : ViewModelBase
{
InputType = TextBoxWindowViewModel.TextBoxInputType.Password,
};
if (await IWindowManager.Instance.ShowTaskDialogAsync(textViewmodel, "请输入令牌保护密码", isDialog: false,
if (await IWindowManager.Instance.ShowTaskDialogAsync(textViewmodel, AppResources.Title_InputAuthPassword, isDialog: false,
isCancelButton: true) &&
textViewmodel.Value != null)
{
@@ -110,7 +113,7 @@ public sealed partial class AuthenticatorPageViewModel : ViewModelBase
IsVerificationPass = true;
return true;
}
else Toast.Show(ToastIcon.Warning, "密码错误,请刷新重试");
else Toast.Show(ToastIcon.Warning, AppResources.Warning_PasswordError);
}
IsVerificationPass = false;
@@ -121,7 +124,7 @@ public sealed partial class AuthenticatorPageViewModel : ViewModelBase
{
if (Auths.Count < 1 || IsVerificationPass == false)
{
Toast.Show(ToastIcon.Warning, "拒绝操作");
Toast.Show(ToastIcon.Warning, AppResources.Warning_RefuseOperate);
return;
}
@@ -130,13 +133,13 @@ public sealed partial class AuthenticatorPageViewModel : ViewModelBase
{
InputType = TextBoxWindowViewModel.TextBoxInputType.Password,
};
if (await IWindowManager.Instance.ShowTaskDialogAsync(textViewmodel, "请输入令牌保护密码", isDialog: false,
if (await IWindowManager.Instance.ShowTaskDialogAsync(textViewmodel, AppResources.Title_InputAuthPassword, isDialog: false,
isCancelButton: true) &&
textViewmodel.Value != null)
{
newPassword = textViewmodel.Value;
textViewmodel.Value = null;
if (!(await IWindowManager.Instance.ShowTaskDialogAsync(textViewmodel, "请再次输入密码以确认", isDialog: false) &&
if (!(await IWindowManager.Instance.ShowTaskDialogAsync(textViewmodel, AppResources.Title_PasswordConfirm, isDialog: false) &&
textViewmodel.Value == newPassword)) return;
}
else return;
@@ -144,11 +147,11 @@ public sealed partial class AuthenticatorPageViewModel : ViewModelBase
if (await AuthenticatorService.SwitchEncryptionAuthenticators(HasLocalPcEncrypt, Auths.Select(i => i.AuthData),
newPassword))
{
Toast.Show(ToastIcon.Success, "令牌密码保护设置成功。");
Toast.Show(ToastIcon.Success, AppResources.Success_AuthPasswordSetSuccessfully);
//_currentPassword = newPassword.Base64DecodeToByteArray_Nullable();
_currentPassword = newPassword;
}
else Toast.Show(ToastIcon.Error, "令牌密码保护设置失败。");
else Toast.Show(ToastIcon.Error, AppResources.Error_TokenPasswordSetFailed);
HasPasswordEncrypt = true;
}
@@ -157,16 +160,16 @@ public sealed partial class AuthenticatorPageViewModel : ViewModelBase
{
if (Auths.Count < 1 || IsVerificationPass == false)
{
Toast.Show(ToastIcon.Error, "拒绝操作");
Toast.Show(ToastIcon.Error, AppResources.Warning_RefuseOperate);
return;
}
if (await AuthenticatorService.SwitchEncryptionAuthenticators(HasLocalPcEncrypt, Auths.Select(i => i.AuthData)))
{
Toast.Show(ToastIcon.Success, "令牌密码保护移除成功。");
Toast.Show(ToastIcon.Success, AppResources.Success_AuthPasswordRemovedSuccessfully);
_currentPassword = null;
}
else Toast.Show(ToastIcon.Error, "令牌密码保护移除失败。");
else Toast.Show(ToastIcon.Error, AppResources.Error_TokenPasswordRemovedFailed);
HasPasswordEncrypt = false;
IsVerificationPass = true;
@@ -176,15 +179,15 @@ public sealed partial class AuthenticatorPageViewModel : ViewModelBase
{
if (Auths.Count < 1 || IsVerificationPass == false)
{
Toast.Show(ToastIcon.Error, "拒绝操作");
Toast.Show(ToastIcon.Error, AppResources.Warning_RefuseOperate);
return;
}
bool newStatus = HasLocalPcEncrypt == false;
if (await AuthenticatorService.SwitchEncryptionAuthenticators(newStatus, Auths.Select(i => i.AuthData),
_currentPassword)) Toast.Show(ToastIcon.Success, $"令牌本机电脑保护{(newStatus ? "开启" : "关闭")}成功");
else Toast.Show(ToastIcon.Error, $"令牌本机电脑保护{(newStatus ? "开启" : "关闭")}失败");
if (await AuthenticatorService.SwitchEncryptionAuthenticators(newStatus, Auths.Select(i => i.AuthData), _currentPassword))
Toast.Show(ToastIcon.Success, AppResources.Success_AuthProtectSuccessfully_.Format(newStatus ? "开启" : "关闭"));
else Toast.Show(ToastIcon.Error, AppResources.Error_AuthProtectFailed_.Format(newStatus ? "开启" : "关闭"));
HasLocalPcEncrypt = newStatus;
}
@@ -203,14 +206,14 @@ public sealed partial class AuthenticatorPageViewModel : ViewModelBase
{Strings.LocalAuth_ProtectionAuth_IsOnlyCurrentComputerEncryptTip}
""";
await IWindowManager.Instance.ShowTaskDialogAsync(messageViewmodel, "令牌加密帮助");
await IWindowManager.Instance.ShowTaskDialogAsync(messageViewmodel, AppResources.Title_AuthEncryption);
}
public void ReLockAuthenticator()
{
if (!HasPasswordEncrypt)
{
Toast.Show(ToastIcon.Warning, "没有加密令牌可供操作");
Toast.Show(ToastIcon.Warning, AppResources.Warning_NotAuthProvided);
return;
}
@@ -227,7 +230,7 @@ public sealed partial class AuthenticatorPageViewModel : ViewModelBase
switch (response.Code)
{
case ApiRspCode.Unauthorized:
Toast.Show(ToastIcon.Error, "请先登录 WattToolKit ");
Toast.Show(ToastIcon.Error, AppResources.Error_PleaseLoginWattToolKit);
break;
}
@@ -292,7 +295,7 @@ public sealed partial class AuthenticatorPageViewModel : ViewModelBase
{
changeMessage = "本地令牌已为最新数据";
}
Toast.Show(ToastIcon.Success, $"云同步成功:{changeMessage}");
Toast.Show(ToastIcon.Success, AppResources.Success_CloudSynchronizationSuccessful.Format(changeMessage));
Initialize();
return;
}
@@ -313,35 +316,33 @@ public sealed partial class AuthenticatorPageViewModel : ViewModelBase
if ((cloudAuths.Count + pushItems.Length) > MAX_SYNC_VALUE)
{
Toast.Show(ToastIcon.Error,
$"云令牌已达数量上限 {MAX_SYNC_VALUE},云端令牌数量 {cloudAuths.Count} ,正在上传数量 {pushItems.Length}");
Toast.Show(ToastIcon.Error, AppResources.Error_CloudAuthMaximumQuantity___.Format(MAX_SYNC_VALUE, cloudAuths.Count, pushItems.Length));
return;
}
var syncResponse = await IMicroServiceClient.Instance.AuthenticatorClient.SyncAuthenticatorsToCloud(new()
{
Difference = pushItems, Answer = _currentAnswer,
});
if (!syncResponse.IsSuccess) throw new Exception("同步至云令牌失败");
if (!syncResponse.IsSuccess) throw new Exception(AppResources.Error_FailedToSynchronizeAuth);
response = await IMicroServiceClient.Instance.AuthenticatorClient.GetAuthenticators();
if (response.Content?.Length != Auths.Count) throw new Exception("同步失败,数据未统一");
if (response.Content?.Length != Auths.Count) throw new Exception(AppResources.Error_DataNotUnified);
foreach (var item in response.Content)
{
var localAuth = Auths.FirstOrDefault(i => i.AuthData.Index == item.Order)?.AuthData;
// var localAuth = Auths
// .FirstOrDefault(i => item.Token!.SequenceEqual(MemoryPackSerializer.Serialize(i.AuthData.ToExport())))
// ?.AuthData;
localAuth.ThrowIsNull("localAuth不应为空");
localAuth.ThrowIsNull(AppResources.Error_localAuthNotEmpty);
localAuth.ServerId ??= item.Id;
localAuth.LastUpdate = DateTimeOffset.Now;
await AuthenticatorService.AddOrUpdateSaveAuthenticatorsAsync(localAuth, _currentPassword);
}
Initialize();
Toast.Show(ToastIcon.Success, $"{syncResponse.Content?.Message} 已上传 {pushItems.Length} 个令牌至云端");
Toast.Show(ToastIcon.Success, AppResources.Success_AuthUpload__.Format(syncResponse.Content?.Message, pushItems.Length));
}
/// <summary>
@@ -358,12 +359,11 @@ public sealed partial class AuthenticatorPageViewModel : ViewModelBase
if (passwordQuestionResponse.Content == null)
{
var textViewModel = new TextBoxWindowViewModel();
if (!await IWindowManager.Instance.ShowTaskDialogAsync(textViewModel, "设置安全问题",
subHeader: "首次同步,请为您的云令牌设置一个安全问题及密码。" +
"\r\n请先输入「安全问题」", isCancelButton: true)) return null;
if (!await IWindowManager.Instance.ShowTaskDialogAsync(textViewModel, AppResources.Error_SetSecurityIssuesFailed,
subHeader: AppResources.SubHeader_FirstSyncSetAuth, isCancelButton: true)) return null;
question = textViewModel.Value;
textViewModel = new TextBoxWindowViewModel();
if (!await IWindowManager.Instance.ShowTaskDialogAsync(textViewModel, "设置安全问题", subHeader: "请再输入「问题答案」",
if (!await IWindowManager.Instance.ShowTaskDialogAsync(textViewModel, AppResources.Error_SetSecurityIssuesFailed, subHeader: AppResources.SubHeader_PleaseEnterTheAnswerAgain,
isCancelButton: true)) return null;
answer = textViewModel.Value;
if (string.IsNullOrEmpty(question) || string.IsNullOrEmpty(answer)) return null;
@@ -372,18 +372,18 @@ public sealed partial class AuthenticatorPageViewModel : ViewModelBase
{
PwdQuestion = question, Answer = answer,
});
if (!setPassword.IsSuccess) throw new Exception("设置安全问题失败");
if (!setPassword.IsSuccess) throw new Exception(AppResources.Error_SetSecurityIssuesFailed);
}
question ??= passwordQuestionResponse.Content;
var answerTextViewModel = new TextBoxWindowViewModel();
if (string.IsNullOrEmpty(answer) && await IWindowManager.Instance.ShowTaskDialogAsync(answerTextViewModel,
"请输入问题答案", subHeader: $"安全问题:「{question}」", isCancelButton: true))
AppResources.Title_PleaseEnterTheAnswer, subHeader: AppResources.SubHeader_SecurityIssues_.Format(question), isCancelButton: true))
answer = answerTextViewModel.Value;
if (string.IsNullOrEmpty(answer))
{
Toast.Show(ToastIcon.Error, "请输入安全问题答案");
Toast.Show(ToastIcon.Error, AppResources.Error_PleaseEnterAnswer);
return null;
}
@@ -392,7 +392,7 @@ public sealed partial class AuthenticatorPageViewModel : ViewModelBase
.VerifyIndependentPassword(new() { Answer = answer, });
if (!verifyResponse.Content)
{
Toast.Show(ToastIcon.Error, "答案错误,请重试");
Toast.Show(ToastIcon.Error, AppResources.Error_AnswerIncorrect);
return null;
}
@@ -427,7 +427,7 @@ public sealed partial class AuthenticatorPageViewModel : ViewModelBase
if (CurrentSelectedAuth == null) return;
var messageViewmodel =
new MessageBoxWindowViewModel { Content = Strings.LocalAuth_DeleteAuthTip2 };
if (await IWindowManager.Instance.ShowTaskDialogAsync(messageViewmodel, "删除令牌", isDialog: false,
if (await IWindowManager.Instance.ShowTaskDialogAsync(messageViewmodel, AppResources.Title_DeleteAuth, isDialog: false,
isCancelButton: true))
{
if (CurrentSelectedAuth.AuthData.ServerId != null)
@@ -451,14 +451,14 @@ public sealed partial class AuthenticatorPageViewModel : ViewModelBase
Answer = _currentAnswer,
});
if (response.IsSuccess)
Toast.Show(ToastIcon.Success, "同步删除云端数据成功");
Toast.Show(ToastIcon.Success, AppResources.Success_DelCloudData);
else
Toast.Show(ToastIcon.Warning, "同步删除云端数据失败");
Toast.Show(ToastIcon.Warning, AppResources.Error_DelCloudData);
}
}
AuthenticatorService.DeleteAuth(CurrentSelectedAuth.AuthData);
Auths.Remove(CurrentSelectedAuth);
Toast.Show(ToastIcon.Success, "本地令牌数据删除成功");
Toast.Show(ToastIcon.Success, AppResources.Success_LocalAuthDelSuccessful);
}
}
@@ -471,7 +471,7 @@ public sealed partial class AuthenticatorPageViewModel : ViewModelBase
{
InputType = TextBoxWindowViewModel.TextBoxInputType.TextBox, Value = CurrentSelectedAuth.AuthName
};
if (await IWindowManager.Instance.ShowTaskDialogAsync(textViewmodel, "请输入新令牌名或取消", isDialog: false,
if (await IWindowManager.Instance.ShowTaskDialogAsync(textViewmodel, AppResources.Title_PleaseEnterNewAuthName, isDialog: false,
isCancelButton: true))
{
newName = textViewmodel.Value;
@@ -497,21 +497,21 @@ public sealed partial class AuthenticatorPageViewModel : ViewModelBase
Answer = _currentAnswer,
});
if (response.IsSuccess)
Toast.Show(ToastIcon.Success, "同步更新云端数据成功");
Toast.Show(ToastIcon.Success, AppResources.Success_UpdateCloudData);
else
Toast.Show(ToastIcon.Warning, "同步更新云端数据失败");
Toast.Show(ToastIcon.Warning, AppResources.Error_UpdateCloudData);
}
}
CurrentSelectedAuth.AuthName = newName;
await AuthenticatorService.SaveEditAuthNameAsync(CurrentSelectedAuth.AuthData, newName);
Toast.Show(ToastIcon.Success, "本地令牌名称修改成功");
Toast.Show(ToastIcon.Success, AppResources.Success_LocalAuthUpdateSuccessful);
}
public async Task OpenSteamLoginImportWindow()
{
if (VerifyMaxValue())
await IWindowManager.Instance.ShowTaskDialogAsync(new SteamLoginImportViewModel(_currentPassword),
"Steam登入导入",
AppResources.SteamLoginImport,
pageContent: new SteamLoginImportPage(), isOkButton: false);
Initialize();
}
@@ -520,7 +520,7 @@ public sealed partial class AuthenticatorPageViewModel : ViewModelBase
{
if (VerifyMaxValue())
await IWindowManager.Instance.ShowTaskDialogAsync(new GeneralAuthenticatorImportViewModel(_currentPassword),
"通用2FA令牌导入", pageContent: new GeneralAuthenticatorImportPage(), isOkButton: false);
AppResources.UniversalAuthImport, pageContent: new GeneralAuthenticatorImportPage(), isOkButton: false);
Initialize();
}
@@ -528,7 +528,7 @@ public sealed partial class AuthenticatorPageViewModel : ViewModelBase
{
if (Auths.Count >= IAccountPlatformAuthenticatorRepository.MaxValue)
{
Toast.Show(ToastIcon.Info, "已达到本地令牌数量上限");
Toast.Show(ToastIcon.Info, AppResources.Info_AuthMaximumQuantity);
return false;
}
@@ -537,7 +537,7 @@ public sealed partial class AuthenticatorPageViewModel : ViewModelBase
public async Task OpenExportWindow()
{
await IWindowManager.Instance.ShowTaskDialogAsync(new AuthenticatorExportViewModel(), "导出令牌",
await IWindowManager.Instance.ShowTaskDialogAsync(new AuthenticatorExportViewModel(), AppResources.ExportAuth,
pageContent: new AuthenticatorExportPage(), isOkButton: false);
}
@@ -568,13 +568,13 @@ public sealed partial class AuthenticatorPageViewModel : ViewModelBase
{
if (CurrentSelectedAuth == null || CurrentSelectedAuth.AuthData.Platform != AuthenticatorPlatform.Steam)
{
Toast.Show(ToastIcon.Warning, "确认交易功能仅限Steam令牌使用");
Toast.Show(ToastIcon.Warning, AppResources.Warning_TransactionOnlySteamAuth);
return;
}
var authData = CurrentSelectedAuth.AuthData;
await IWindowManager.Instance.ShowTaskDialogAsync(new SteamTradePageViewModel(ref authData),
"确认交易",
AppResources.ConfirmTransaction,
pageContent: new SteamTradePage(), isOkButton: false);
CurrentSelectedAuth.AuthData = authData;
}
@@ -584,7 +584,7 @@ public sealed partial class AuthenticatorPageViewModel : ViewModelBase
if (CurrentSelectedAuth == null) return;
if (CurrentSelectedAuth.AuthData.Platform == AuthenticatorPlatform.Steam)
await IWindowManager.Instance.ShowTaskDialogAsync(new ShowSteamDataViewModel(CurrentSelectedAuth.AuthData),
"查看令牌详细数据",
AppResources.LocalAuth_ShowAuthInfo,
pageContent: new ShowSteamDataPage(), isCancelButton: true);
else
{
@@ -594,7 +594,7 @@ public sealed partial class AuthenticatorPageViewModel : ViewModelBase
new TextBoxWindowViewModel()
{
InputType = TextBoxWindowViewModel.TextBoxInputType.TextBox, Value = temp,
}, $"{CurrentSelectedAuth.AuthName}\r\n令牌 SecretKey", isDialog: false, isOkButton: false);
}, AppResources.ModelContent_SecretKey_.Format(CurrentSelectedAuth.AuthName), isDialog: false, isOkButton: false);
}
}
@@ -673,7 +673,7 @@ public sealed partial class AuthenticatorPageViewModel : ViewModelBase
}
else
{
Toast.Show(ToastIcon.Warning, "Mafile格式仅支持Steam令牌");
Toast.Show(ToastIcon.Warning, AppResources.Auth_OnlyMafileFormat);
}
}
@@ -683,12 +683,12 @@ public sealed partial class AuthenticatorPageViewModel : ViewModelBase
if (authenticatorItemModel.AuthData.Platform != AuthenticatorPlatform.Steam)
{
Toast.Show(ToastIcon.Warning, "解绑功能目前仅支持 Steam 令牌");
Toast.Show(ToastIcon.Warning, AppResources.Warning_OnlySupportSteamAuth);
return;
}
if (await IWindowManager.Instance.ShowTaskDialogAsync(
new MessageBoxWindowViewModel() { Content = "您确定要从您的 Steam 账号中解绑此令牌吗,解绑后此令牌将失效,您可以在解绑后删除此令牌。" },
new MessageBoxWindowViewModel() { Content = AppResources.ModelContent_ConfirmUnbinding },
isDialog: false, isCancelButton: true))
{
if (authenticatorItemModel.AuthData.Value is SteamAuthenticator steamAuthenticator)
@@ -698,7 +698,7 @@ public sealed partial class AuthenticatorPageViewModel : ViewModelBase
{
InputType = TextBoxWindowViewModel.TextBoxInputType.Password,
};
if (await IWindowManager.Instance.ShowTaskDialogAsync(textViewmodel, "请输入该Steam账号登陆密码",
if (await IWindowManager.Instance.ShowTaskDialogAsync(textViewmodel, AppResources.ModelContent_ConfirmUnbinding ,
isDialog: false, isCancelButton: true))
{
password = textViewmodel.Value;
@@ -718,7 +718,7 @@ public sealed partial class AuthenticatorPageViewModel : ViewModelBase
if (string.IsNullOrEmpty(loginState.AccessToken))
{
Toast.Show(ToastIcon.Warning, "解绑令牌失败:登陆未成功");
Toast.Show(ToastIcon.Warning, AppResources.Warning_UnbindFailed);
return;
}
@@ -737,11 +737,11 @@ public sealed partial class AuthenticatorPageViewModel : ViewModelBase
// Toast.Show(ToastIcon.Warning, $"云令牌数据删除{(response.IsSuccess ? "成功" : "失败")}");
// AuthenticatorService.DeleteAuth(CurrentSelectedAuth.AuthData);
// Auths.Remove(CurrentSelectedAuth);
Toast.Show(ToastIcon.Success, "令牌解绑成功");
Toast.Show(ToastIcon.Success, AppResources.Success_AuthUnbindSuccessful);
return;
}
Toast.Show(ToastIcon.Error, "解绑令牌失败");
Toast.Show(ToastIcon.Error, AppResources.Error_AuthUnbindFailed);
}
}
}
@@ -1,3 +1,5 @@
using AppResources = BD.WTTS.Client.Resources.Strings;
namespace BD.WTTS.UI.ViewModels;
public partial class GeneralAuthenticatorImportViewModel : ViewModelBase
@@ -20,7 +22,7 @@ public partial class GeneralAuthenticatorImportViewModel : ViewModelBase
{
if (string.IsNullOrEmpty(SecretCode))
{
Toast.Show(ToastIcon.Info, "请输入「导入文本」。");
Toast.Show(ToastIcon.Info, AppResources.Info_PleaseEnterImportText);
return;
}
switch (ImportAuthenticatorType)
@@ -47,13 +49,13 @@ public partial class GeneralAuthenticatorImportViewModel : ViewModelBase
{
if (_importAuthenticatorValueDto == null)
{
Toast.Show(ToastIcon.Info, "请先验证令牌 Code 正确后,再点击导入");
Toast.Show(ToastIcon.Info, AppResources.Info_PleaseVerifyFirstAuthCode);
return;
}
if (string.IsNullOrEmpty(AuthenticatorName))
{
Toast.Show(ToastIcon.Warning, "请输入令牌名称");
Toast.Show(ToastIcon.Warning, AppResources.Warning_PleaseEnterAuthName);
return;
}
@@ -65,6 +67,6 @@ public partial class GeneralAuthenticatorImportViewModel : ViewModelBase
};
await AuthenticatorService.AddOrUpdateSaveAuthenticatorsAsync(iAuthenticatorDtoDto, _password);
await IWindowManager.Instance.ShowTaskDialogAsync(
new MessageBoxWindowViewModel { Content = $"{ImportAuthenticatorType}导入成功" });
new MessageBoxWindowViewModel { Content = AppResources.ModelContent_ImportSuccessful_.Format(ImportAuthenticatorType) });
}
}
@@ -1,3 +1,5 @@
using AppResources = BD.WTTS.Client.Resources.Strings;
using BD.SteamClient.Models;
using BD.SteamClient.Services;
using BD.WTTS.Exceptions;
@@ -59,7 +61,7 @@ public sealed partial class SteamLoginImportViewModel
{
if (string.IsNullOrWhiteSpace(UserNameText) || string.IsNullOrWhiteSpace(PasswordText))
{
throw new SteamLoginNullCatpchaCodeException("请输入用户名及密码。");
throw new SteamLoginNullCatpchaCodeException(AppResources.Error_PleaseEnterUsernamePassword);
}
_steamLoginState.Username = UserNameText;
_steamLoginState.Password = PasswordText;
@@ -74,7 +76,7 @@ public sealed partial class SteamLoginImportViewModel
{
if (string.IsNullOrEmpty(CaptchaCodeText))
{
throw new SteamLoginNullCatpchaCodeException("请输入验证码。");
throw new SteamLoginNullCatpchaCodeException(AppResources.Error_PleaseEnterCode);
}
else
_steamLoginState.CaptchaText = CaptchaCodeText;
@@ -88,7 +90,7 @@ public sealed partial class SteamLoginImportViewModel
{
if (string.IsNullOrEmpty(EmailAuthText))
{
throw new SteamLoginNullCatpchaCodeException("请输入邮箱验证码。");
throw new SteamLoginNullCatpchaCodeException(AppResources.Error_PleaseEnterEmailCode);
}
else
_steamLoginState.EmailCode = EmailAuthText;
@@ -108,7 +110,7 @@ public sealed partial class SteamLoginImportViewModel
{
if (string.IsNullOrEmpty(PhoneCodeText))
{
throw new SteamLoginNullCatpchaCodeException("请输入手机验证码。");
throw new SteamLoginNullCatpchaCodeException(AppResources.Error_PleaseEnterTelCode);
}
else
_enrollState.ActivationCode = PhoneCodeText;
@@ -196,7 +198,7 @@ public sealed partial class SteamLoginImportViewModel
{
if (_IsLogining)
{
Toast.Show(ToastIcon.Warning, "请勿频繁操作");
Toast.Show(ToastIcon.Warning, AppResources.Warning_DoNotOperateFrequently);
return;
}
_IsLogining = true;
@@ -257,7 +259,7 @@ public sealed partial class SteamLoginImportViewModel
{
if (string.IsNullOrEmpty(PhoneNumberText))
{
Toast.Show(ToastIcon.Warning, "请正确输入手机号。");
Toast.Show(ToastIcon.Warning, AppResources.Warning_PleaseEnterTel);
return;
}
@@ -1,4 +1,5 @@
using BD.WTTS.Client.Resources;
using AppResources = BD.WTTS.Client.Resources.Strings;
using WinAuth;
namespace BD.WTTS.UI.ViewModels;
@@ -97,7 +98,7 @@ public sealed partial class SteamTradePageViewModel
// return;
// }
Toast.Show(ToastIcon.Error, $"未知登陆错误:{_steamClient.Error}");
Toast.Show(ToastIcon.Error, AppResources.Error_UnknownLogin_.Format(_steamClient.Error));
IsLoading = false;
return;
}
@@ -214,7 +215,7 @@ public sealed partial class SteamTradePageViewModel
}
Log.Error(nameof(SteamTradePageViewModel), exception, nameof(ExceptionHandling));
Toast.Show(ToastIcon.Error, "异常:" + exception.Message);
Toast.Show(ToastIcon.Error, AppResources.Error_Exception_.Format(exception.Message));
}
// public async Task Logout()
@@ -243,12 +244,8 @@ public sealed partial class SteamTradePageViewModel
if (await IWindowManager.Instance.ShowTaskDialogAsync(
new MessageBoxWindowViewModel()
{
Content =
$"{trade.SendSummary}\r\n" +
$"{trade.ReceiveSummary}\r\n" +
$"{(trade.ReceiveNoItems ? $"您尚未让 {trade.Headline} 选择任何物品以交换您的物品。如果 {trade.Headline} 接受此交易,您将失去您提供的物品,但不会收到任何物品。" : string.Empty)}\r\n" +
$"如果您没有创建此交易,请立即取消该交易。您的帐户或电脑可能已遭盗用。",
}, "确认交易",
Content = AppResources.ModelContent_ConfirmTrade___.Format(trade.SendSummary, trade.ReceiveSummary, trade.ReceiveNoItems ? $"您尚未让 {trade.Headline} 选择任何物品以交换您的物品。如果 {trade.Headline} 接受此交易,您将失去您提供的物品,但不会收到任何物品。" : string.Empty)
}, AppResources.ConfirmTransaction,
isCancelButton: true, isDialog: false))
{
await OperationTrade(true, trade);
@@ -258,9 +255,7 @@ public sealed partial class SteamTradePageViewModel
public async Task ConfirmAllTrade()
{
if (await IWindowManager.Instance.ShowTaskDialogAsync(
new MessageBoxWindowViewModel() { Content = "您确认要通过所有交易报价吗\r\n" +
"您将同意列表内全部的报价请求。\r\n" +
"交易一经确认无法撤销,请谨慎选择。" },
new MessageBoxWindowViewModel() { Content = AppResources.ModelContent_ConfirmAllTrade },
isCancelButton: true, isDialog: false))
{
await OperationTrade(true);
@@ -271,9 +266,7 @@ public sealed partial class SteamTradePageViewModel
{
if (sender is not SteamTradeConfirmationModel trade) return;
if (await IWindowManager.Instance.ShowTaskDialogAsync(
new MessageBoxWindowViewModel() { Content = "您确认需要取消交易报价吗\r\n" +
"这将从以下列表中移除此条确认信息\r\n" +
"您可以在Steam库存查看交易报价记录。" },
new MessageBoxWindowViewModel() { Content = AppResources.ModelContent_CancelTrade },
isCancelButton: true, isDialog: false))
{
await OperationTrade(false, trade);
@@ -283,10 +276,7 @@ public sealed partial class SteamTradePageViewModel
public async Task CancelAllTrade()
{
if (await IWindowManager.Instance.ShowTaskDialogAsync(
new MessageBoxWindowViewModel() { Content = "您确认要取消所有交易报价吗\r\n" +
"您将拒绝列表内全部的报价请求。\r\n" +
"这将从以下列表中移除所有交易信息\r\n" +
"您可以在Steam库存查看交易报价记录。" },
new MessageBoxWindowViewModel() { Content = AppResources.ModelContent_CancelAllTrade },
isCancelButton: true, isDialog: false))
{
await OperationTrade(false);
@@ -316,7 +306,7 @@ public sealed partial class SteamTradePageViewModel
if (_operationTradeAllCancelToken != null)
{
Toast.Show(ToastIcon.Warning, "已有一项操作正在进行中,请等待执行结束");
Toast.Show(ToastIcon.Warning, AppResources.Warning_PleaseWaitExecuteFinish);
return;
}
@@ -325,11 +315,11 @@ public sealed partial class SteamTradePageViewModel
if (await IWindowManager.Instance.ShowTaskDialogAsync(
new MessageBoxWindowViewModel()
{
Content = Strings.LocalAuth_AuthTrade_MessageBoxTip.Format(statusText)
Content = Strings.LocalAuth_AuthTrade_MessageBoxTip_.Format(statusText)
}, isCancelButton: true, isDialog: false))
{
SetToastServiceStatus(
Strings.LocalAuth_AuthTrade_ConfirmTip.Format(statusText));
Strings.LocalAuth_AuthTrade_ConfirmTip_.Format(statusText));
_operationTradeAllCancelToken = new CancellationTokenSource();
ushort success = 0;
@@ -339,8 +329,7 @@ public sealed partial class SteamTradePageViewModel
{
if (_operationTradeAllCancelToken.IsCancellationRequested)
{
Toast.Show(ToastIcon.Warning,
$"已终止{statusText}全部令牌,已操作成功令牌数量{success},操作失败令牌数量{failed}");
Toast.Show(ToastIcon.Warning, AppResources.Warning_TerminationAllAuth___.Format(statusText, success, failed));
// Toast.Show(ToastIcon.None,
// $"已终止{statusText}全部令牌,已操作成功令牌数量{success},操作失败令牌数量{failed},剩余{executableNum - success - failed}令牌未操作");
}
@@ -370,8 +359,7 @@ public sealed partial class SteamTradePageViewModel
_operationTradeAllCancelToken = null;
//RefreshConfirmationsList();
Toast.Show(ToastIcon.Success,
$"{statusText}全部令牌执行结束,成功数量{success},失败数量{failed}");
Toast.Show(ToastIcon.Success, AppResources.Success_ExecuteAllAuthEnd___.Format(statusText, success, failed));
// Toast.Show(ToastIcon.None,
// $"{statusText}全部令牌执行结束,成功数量{success},失败数量{failed},剩余{executableNum - success - failed}令牌未操作");
SetToastServiceStatus();
@@ -22,7 +22,7 @@
TextAlignment="Center"
TextWrapping="Wrap" />
<CheckBox
Content="仅本机可解密"
Content="{ReflectionBinding Path=Res.Auth_OnlylocalCanDecrypt, Mode=OneWay,Source={x:Static s:ResourceService.Current}}"
HorizontalAlignment="Center"
IsChecked="{Binding HasLocalProtection}" />
</StackPanel>
@@ -52,7 +52,7 @@
Source={x:Static s:ResourceService.Current},
Mode=OneWay}" />
<CheckBox
Content="导出时携带密码"
Content="{ReflectionBinding Path=Res.Auth_ExportUsingPassword, Mode=OneWay,Source={x:Static s:ResourceService.Current}}"
HorizontalAlignment="Center"
IsChecked="{Binding HasPasswordProtection}" />
</StackPanel>
@@ -60,7 +60,7 @@
<Button
Command="{Binding Export}"
Content="导出全部令牌"
Content="{ReflectionBinding Path=Res.Auth_ExportAll, Mode=OneWay,Source={x:Static s:ResourceService.Current}}"
HorizontalAlignment="Center"
Margin="0,0,0,10"
VerticalAlignment="Bottom"
@@ -73,9 +73,9 @@
<Button.Flyout>
<Flyout Placement="BottomEdgeAlignedLeft">
<StackPanel Spacing="5">
<Button Command="{Binding OpenSteamLoginImportWindow}" Content="Steam登陆导入" />
<Button Command="{Binding OpenGeneralAuthenticatorImportWindow}" Content="2FA通用导入" />
<!-- <Button Command="{Binding OpenSteamOtherImportWindow}" Content="导入自文件" /> -->
<Button Command="{Binding OpenSteamLoginImportWindow}" Content="{ReflectionBinding Path=Res.Auth_SteamLoginImport, Mode=OneWay, Source={x:Static s:ResourceService.Current}}" />
<Button Command="{Binding OpenGeneralAuthenticatorImportWindow}" Content="{ReflectionBinding Path=Res.Auth_UniversalImport, Mode=OneWay, Source={x:Static s:ResourceService.Current}}" />
<Button Command="{Binding OpenSteamOtherImportWindow}" Content="{ReflectionBinding Path=Res.Auth_ImportCustomFile, Mode=OneWay, Source={x:Static s:ResourceService.Current}}" />
</StackPanel>
</Flyout>
</Button.Flyout>
@@ -104,21 +104,29 @@
<StackPanel Spacing="5">
<Button
Command="{Binding SetPasswordProtection}"
Content="添加密码保护"
Content="{ReflectionBinding Path=Res.Auth_AddPasswordProtect,
Mode=OneWay,
Source={x:Static s:ResourceService.Current}}"
IsEnabled="{Binding !HasPasswordEncrypt}" />
<Button
Command="{Binding RemovePasswordProtection}"
Content="移除密码保护"
Content="{ReflectionBinding Path=Res.Auth_RemovePasswordProtect,
Mode=OneWay,
Source={x:Static s:ResourceService.Current}}"
IsEnabled="{Binding HasPasswordEncrypt}" />
<Button
Command="{Binding ToggleLocalProtection}"
Content="添加机器验证"
Content="{ReflectionBinding Path=Res.Auth_AddMachineValidation,
Mode=OneWay,
Source={x:Static s:ResourceService.Current}}"
IsEnabled="{Binding !HasLocalPcEncrypt}" />
<Button
Command="{Binding ToggleLocalProtection}"
Content="移除机器验证"
Content="{ReflectionBinding Path=Res.Auth_RemoveMachineValidation,
Mode=OneWay,
Source={x:Static s:ResourceService.Current}}"
IsEnabled="{Binding HasLocalPcEncrypt}" />
<Button Command="{Binding EncryptHelp}" Content="加密帮助" />
<Button Command="{Binding EncryptHelp}" Content="{ReflectionBinding Path=Res.Auth_EncryptionHelp, Mode=OneWay, Source={x:Static s:ResourceService.Current}}" />
</StackPanel>
</Flyout>
</Button.Flyout>
@@ -209,17 +217,19 @@
<!-- Text="移除机器验证" /> -->
<!-- <ui:MenuFlyoutItem Command="{Binding EncryptHelp}" Text="加密帮助" /> -->
<!-- </ui:MenuFlyoutSubItem> -->
<ui:MenuFlyoutItem Command="{Binding OpenExportWindow}" Text="全部导出" />
<ui:MenuFlyoutItem Command="{Binding OpenExportWindow}" Text="{ReflectionBinding Path=Res.ExportAll, Mode=OneWay, Source={x:Static s:ResourceService.Current}}" />
<ui:MenuFlyoutItem
Command="{Binding ReLockAuthenticator}"
IsEnabled="{Binding IsVerificationPass}"
Text="锁定令牌" />
<ui:MenuFlyoutItem Text="插件设置" />
Text="{ReflectionBinding Path=Res.Auth_lock,
Mode=OneWay,
Source={x:Static s:ResourceService.Current}}" />
<ui:MenuFlyoutItem Text="{ReflectionBinding Path=Res.Settings_Plugin, Mode=OneWay, Source={x:Static s:ResourceService.Current}}" />
<ui:MenuFlyoutSeparator />
<ui:MenuFlyoutItem IsEnabled="False" Text="版本号: 0.1" />
<ui:MenuFlyoutItem Text="在 Steam++ 插件商店中查看" />
<ui:MenuFlyoutItem Text="使用帮助" />
<ui:MenuFlyoutItem Text="关于此插件" />
<ui:MenuFlyoutItem IsEnabled="False" Text="{ReflectionBinding Path=Res.Auth_Version, Mode=OneWay, Source={x:Static s:ResourceService.Current}}" />
<ui:MenuFlyoutItem Text="{ReflectionBinding Path=Res.ViewInStore, Mode=OneWay, Source={x:Static s:ResourceService.Current}}" />
<ui:MenuFlyoutItem Text="{ReflectionBinding Path=Res.UseHelp, Mode=OneWay, Source={x:Static s:ResourceService.Current}}" />
<ui:MenuFlyoutItem Text="{ReflectionBinding Path=Res.AboutThisPlugin, Mode=OneWay, Source={x:Static s:ResourceService.Current}}" />
</ui:FAMenuFlyout>
</DropDownButton.Flyout>
</DropDownButton>
@@ -239,7 +249,7 @@
DockPanel.Dock="Left"
HorizontalAlignment="Center">
<ui:CommandBar.PrimaryCommands>
<ui:CommandBarButton Command="{Binding KeepDisplay}" Label="固定展示">
<ui:CommandBarButton Command="{Binding KeepDisplay}" Label="{ReflectionBinding Path=Res.Auth_FixedDisplay, Mode=OneWay, Source={x:Static s:ResourceService.Current}}">
<ui:CommandBarButton.IconSource>
<ui:FontIconSource FontFamily="{StaticResource SymbolThemeFontFamily}" Glyph="{StaticResource FavoriteStar}" />
</ui:CommandBarButton.IconSource>
@@ -249,10 +259,12 @@
<ui:CommandBarButton
Command="{Binding EditAuthNameAsync}"
IconSource="Edit"
Label="编辑令牌名字" />
Label="{ReflectionBinding Path=Res.Auth_EditName,
Mode=OneWay,
Source={x:Static s:ResourceService.Current}}" />
</ui:CommandBar.PrimaryCommands>
<ui:CommandBar.PrimaryCommands>
<ui:CommandBarButton Command="{Binding ShowReplyWindow}" Label="确认交易">
<ui:CommandBarButton Command="{Binding ShowReplyWindow}" Label="{ReflectionBinding Path=Res.LocalAuth_AuthTrade, Mode=OneWay, Source={x:Static s:ResourceService.Current}}">
<ui:CommandBarButton.IconSource>
<ui:FontIconSource FontFamily="{StaticResource SymbolThemeFontFamily}" Glyph="{StaticResource Reply}" />
</ui:CommandBarButton.IconSource>
@@ -263,10 +275,12 @@
<ui:CommandBarButton
Command="{Binding ShowAuthJsonData}"
IconSource="ZoomIn"
Label="查看详细数据" />
Label="{ReflectionBinding Path=Res.ViewDetailedData,
Mode=OneWay,
Source={x:Static s:ResourceService.Current}}" />
</ui:CommandBar.PrimaryCommands>
<ui:CommandBar.PrimaryCommands>
<ui:CommandBarButton Command="{Binding ShowQrCode}" Label="展示二维码">
<ui:CommandBarButton Command="{Binding ShowQrCode}" Label="{ReflectionBinding Path=Res.DisplayQRCode, Mode=OneWay, Source={x:Static s:ResourceService.Current}}">
<ui:CommandBarButton.IconSource>
<ui:FontIconSource FontFamily="{StaticResource SymbolThemeFontFamily}" Glyph="{StaticResource QrCode}" />
</ui:CommandBarButton.IconSource>
@@ -284,7 +298,9 @@
<ui:CommandBarButton
Command="{Binding DeleteAuthAsync}"
IconSource="Delete"
Label="删除令牌" />
Label="{ReflectionBinding Path=Res.LocalAuth_Delete,
Mode=OneWay,
Source={x:Static s:ResourceService.Current}}" />
</ui:CommandBar.PrimaryCommands>
</ui:CommandBar>
</DockPanel>
@@ -323,12 +339,16 @@
</StackPanel.IsVisible>
<TextBlock
HorizontalAlignment="Center"
Text="您的令牌具有密码保护,请先进行密码验证"
Text="{ReflectionBinding Path=Res.Auth_PasswordProtectedVerifyFirst,
Mode=OneWay,
Source={x:Static s:ResourceService.Current}}"
TextWrapping="WrapWithOverflow"
VerticalAlignment="Center" />
<Button
Command="{Binding Initialize}"
Content="验证"
Content="{ReflectionBinding Path=Res.Verify,
Mode=OneWay,
Source={x:Static s:ResourceService.Current}}"
HorizontalAlignment="Center"
IsEnabled="True"
VerticalAlignment="Center" />
@@ -356,17 +376,17 @@
<spp:AuthenticatorItem>
<spp:AuthenticatorItem.ContextFlyout>
<MenuFlyout>
<MenuItem Header="上移">
<MenuItem Header="{ReflectionBinding Path=Res.Up, Mode=OneWay, Source={x:Static s:ResourceService.Current}}">
<MenuItem.Icon>
<ui:SymbolIcon Symbol="ChevronUp" />
</MenuItem.Icon>
</MenuItem>
<MenuItem Header="下移">
<MenuItem Header="{ReflectionBinding Path=Res.MoveDown, Mode=OneWay, Source={x:Static s:ResourceService.Current}}">
<MenuItem.Icon>
<ui:SymbolIcon Symbol="ChevronDown" />
</MenuItem.Icon>
</MenuItem>
<MenuItem Header="固定首位">
<MenuItem Header="{ReflectionBinding Path=Res.FixedTop, Mode=OneWay, Source={x:Static s:ResourceService.Current}}">
<MenuItem.Icon>
<ui:SymbolIcon Symbol="Pin" />
</MenuItem.Icon>
@@ -374,12 +394,14 @@
<MenuItem
Command="{ReflectionBinding $parent[spp:PageBase].DataContext.UnbindingSteamAuthAsync}"
CommandParameter="{Binding}"
Header="解绑令牌">
Header="{ReflectionBinding Path=Res.LocalAuth_RemoveAuth,
Mode=OneWay,
Source={x:Static s:ResourceService.Current}}">
<MenuItem.Icon>
<ui:FontIcon FontFamily="{StaticResource SymbolThemeFontFamily}" Glyph="&#xECC9;" />
</MenuItem.Icon>
</MenuItem>
<MenuItem Header="默认导出">
<MenuItem Header="{ReflectionBinding Path=Res.DefaultExport, Mode=OneWay, Source={x:Static s:ResourceService.Current}}">
<MenuItem.Icon>
<ui:FontIcon FontFamily="{StaticResource SymbolThemeFontFamily}" Glyph="&#xEDE1;" />
</MenuItem.Icon>
@@ -387,7 +409,9 @@
<MenuItem
Command="{ReflectionBinding $parent[spp:PageBase].DataContext.ExportAuthWithSdaFile}"
CommandParameter="{Binding}"
Header="导出为Mafile"
Header="{ReflectionBinding Path=Res.Auth_ExportmaFile,
Mode=OneWay,
Source={x:Static s:ResourceService.Current}}"
IsEnabled="True">
<MenuItem.Icon>
<ui:FontIcon FontFamily="{StaticResource SymbolThemeFontFamily}" Glyph="&#xEDE1;" />
@@ -1,20 +1,21 @@
<UserControl
d:DesignHeight="450"
d:DesignWidth="800"
mc:Ignorable="d"
x:Class="BD.WTTS.UI.Views.Pages.GeneralAuthenticatorImportPage"
x:CompileBindings="True"
x:DataType="spp:GeneralAuthenticatorImportViewModel"
xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:s="https://steampp.net/services"
xmlns:spp="https://steampp.net/ui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
d:DesignHeight="450"
d:DesignWidth="800"
x:CompileBindings="True"
x:DataType="spp:GeneralAuthenticatorImportViewModel"
mc:Ignorable="d">
<StackPanel
HorizontalAlignment="Center"
Margin="10"
Spacing="30"
VerticalAlignment="Center">
HorizontalAlignment="Center"
VerticalAlignment="Center"
Spacing="30">
<StackPanel.Styles>
<Style Selector="Border">
<Setter Property="Background" Value="{DynamicResource ControlFillColorDefaultBrush}" />
@@ -30,11 +31,13 @@
Margin="5"
Orientation="Horizontal"
Spacing="5">
<TextBlock Text="令牌名称:" VerticalAlignment="Center" />
<TextBlock VerticalAlignment="Center" Text="{ReflectionBinding Path=Res.GeneralAuth_Name, Mode=OneWay, Source={x:Static s:ResourceService.Current}}" />
<TextBox
HorizontalContentAlignment="Center"
Text="{Binding AuthenticatorName}"
Watermark="输入您的令牌名称" />
Watermark="{ReflectionBinding Path=Res.Warning_PleaseEnterAuthName,
Mode=OneWay,
Source={x:Static s:ResourceService.Current}}" />
</StackPanel>
</Border>
</StackPanel>
@@ -52,32 +55,38 @@
Margin="5"
Orientation="Horizontal"
Spacing="5">
<TextBlock Text="导入文本:" VerticalAlignment="Center" />
<TextBlock VerticalAlignment="Center" Text="{ReflectionBinding Path=Res.GeneralAuth_ImportText, Mode=OneWay, Source={x:Static s:ResourceService.Current}}" />
<TextBox
HorizontalContentAlignment="Center"
Text="{Binding SecretCode}"
Watermark="输入您的令牌Key或二维码图片url链接" />
Watermark="{ReflectionBinding Path=Res.GeneralAuth_EnterkeyOrLink,
Mode=OneWay,
Source={x:Static s:ResourceService.Current}}" />
</StackPanel>
</Border>
</StackPanel>
<StackPanel Orientation="Horizontal">
<Label VerticalAlignment="Center">4.</Label>
<Button
Command="{Binding GenerateCode}"
Content="生成 Code "
MinWidth="300"
HorizontalAlignment="Center"
MinWidth="300" />
Command="{Binding GenerateCode}"
Content="{ReflectionBinding Path=Res.GeneralAuth_Code,
Mode=OneWay,
Source={x:Static s:ResourceService.Current}}" />
</StackPanel>
<StackPanel Orientation="Horizontal">
<Label VerticalAlignment="Center">5.</Label>
<Border HorizontalAlignment="Center">
<StackPanel Margin="10" Spacing="5">
<TextBlock HorizontalAlignment="Center" Text="请验证下列Code是否正确,在其正确的情况下再进行导入" />
<TextBlock HorizontalAlignment="Center" Text="{ReflectionBinding Path=Res.GeneralAuth_VerifySuccessfulImport, Mode=OneWay, Source={x:Static s:ResourceService.Current}}" />
<TextBox IsReadOnly="True" Text="{Binding CurrentCode}" />
<Button
HorizontalAlignment="Center"
Command="{Binding Import}"
Content="确认导入"
HorizontalAlignment="Center" />
Content="{ReflectionBinding Path=Res.ConfirmImport,
Mode=OneWay,
Source={x:Static s:ResourceService.Current}}" />
</StackPanel>
</Border>
</StackPanel>
@@ -17,7 +17,7 @@
</Style>
</UserControl.Styles>
<spp:Stepper SelectedIndex="{Binding SelectIndex}">
<spp:StepperItem Index="0" Title="Steam登录">
<spp:StepperItem Index="0" Title="{ReflectionBinding Path=Res.Steam_Login, Mode=OneWay, Source={x:Static s:ResourceService.Current}}">
<Grid
Margin="10"
MinHeight="300"
@@ -90,7 +90,7 @@
<!-- MinWidth="280" /> -->
<!-- </StackPanel> -->
<!-- </spp:StepperItem> -->
<spp:StepperItem Index="1" Title="邮箱验证码">
<spp:StepperItem Index="1" Title="{ReflectionBinding Path=Res.Steam_EmailCode, Mode=OneWay, Source={x:Static s:ResourceService.Current}}">
<Grid
Margin="10"
MinHeight="300"
@@ -129,7 +129,7 @@
</StackPanel>
</Grid>
</spp:StepperItem>
<spp:StepperItem Index="2" Title="绑定手机号">
<spp:StepperItem Index="2" Title="{ReflectionBinding Path=Res.Steam_BindTel, Mode=OneWay, Source={x:Static s:ResourceService.Current}}">
<Grid
Margin="10"
MinHeight="300"
@@ -151,7 +151,9 @@
<TextBlock
HorizontalAlignment="Center"
Margin="0,0,0,10"
Text="请在收到邮件后,点击邮件内的「添加手机号码」进行确认后,再点击继续按钮。"
Text="{ReflectionBinding Path=Res.Steam_EmailConfirmation,
Mode=OneWay,
Source={x:Static s:ResourceService.Current}}"
VerticalAlignment="Bottom" />
<Button
Command="{ReflectionBinding LoginSteamImport}"
@@ -164,7 +166,7 @@
</StackPanel>
</Grid>
</spp:StepperItem>
<spp:StepperItem Index="3" Title="手机验证码">
<spp:StepperItem Index="3" Title="{ReflectionBinding Path=Res.TelCode, Mode=OneWay, Source={x:Static s:ResourceService.Current}}">
<Grid
Margin="10"
MinHeight="300"
@@ -211,7 +213,7 @@
</StackPanel>
</Grid>
</spp:StepperItem>
<spp:StepperItem Index="4" Title="完成">
<spp:StepperItem Index="4" Title="{ReflectionBinding Path=Res.Btn_Text_Complete, Mode=OneWay, Source={x:Static s:ResourceService.Current}}">
<Grid
Margin="10"
MinHeight="300"
@@ -54,7 +54,7 @@
</StackPanel.IsVisible>
<ui:CommandBar DefaultLabelPosition="Right" HorizontalAlignment="Right">
<ui:CommandBar.PrimaryCommands>
<ui:CommandBarButton Command="{Binding ConfirmAllTrade}" Label="全部通过">
<ui:CommandBarButton Command="{Binding ConfirmAllTrade}" Label="{ReflectionBinding Path=Res.AllPassed, Mode=OneWay,Source={x:Static s:ResourceService.Current}}">
<ui:CommandBarButton.IconSource>
<ui:FontIconSource FontFamily="{StaticResource SymbolThemeFontFamily}" Glyph="{StaticResource CheckMark}" />
</ui:CommandBarButton.IconSource>
@@ -64,14 +64,14 @@
<ui:CommandBarButton
Command="{Binding CancelAllTrade}"
IconSource="Cancel"
Label="全部取消" />
Label="{ReflectionBinding Path=Res.CancelAll, Mode=OneWay,Source={x:Static s:ResourceService.Current}}" />
</ui:CommandBar.PrimaryCommands>
<ui:CommandBarSeparator />
<ui:CommandBar.PrimaryCommands>
<ui:CommandBarButton
Command="{Binding Refresh}"
IconSource="Refresh"
Label="刷新" />
Label="{ReflectionBinding Path=Res.Refresh, Mode=OneWay,Source={x:Static s:ResourceService.Current}}" />
</ui:CommandBar.PrimaryCommands>
</ui:CommandBar>
<ScrollViewer
@@ -163,7 +163,7 @@
<TextBlock
HorizontalAlignment="Right"
MaxLines="3"
Text="您的报价"
Text="{ReflectionBinding Path=Res.SteamTrade_YourOffer, Mode=OneWay,Source={x:Static s:ResourceService.Current}}"
TextWrapping="Wrap"
VerticalAlignment="Top" />
<ui:FontIcon
@@ -1,6 +1,7 @@
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using Formatting = Newtonsoft.Json.Formatting;
using AppResources = BD.WTTS.Client.Resources.Strings;
namespace BD.WTTS;
@@ -67,7 +68,7 @@ public static class JTokenHelper
{
if (isBasic && !PathHelper.PathIsDirectoryEmpty(Path.GetDirectoryName(dictPath)!))
{
Toast.Show("查找或读取已保存的注册表文件失败!");
Toast.Show(ToastIcon.Error, AppResources.Error_OperateRegistryFilesFailed);
}
return JsonConvert.DeserializeObject<Dictionary<string, string>>(s) ?? new Dictionary<string, string>();
}
@@ -1,3 +1,5 @@
using AppResources = BD.WTTS.Client.Resources.Strings;
namespace BD.WTTS;
public static partial class PathHelper
@@ -237,7 +239,7 @@ public static partial class PathHelper
if (!Directory.Exists(Path.GetDirectoryName(fromPath))) return false;
if (CopyFilesRecursive(Path.GetDirectoryName(fromPath), toFullPath)) return true;
Toast.Show("复制文件失败!");
Toast.Show(ToastIcon.Error, AppResources.Error_CopyFileFailed);
return false;
}
@@ -267,7 +269,7 @@ public static partial class PathHelper
_ = Directory.CreateDirectory(toFullPath);
if (CopyFilesRecursive(fullPath, toFullPath)) return true;
Toast.Show("复制文件失败!");
Toast.Show(ToastIcon.Error, AppResources.Error_CopyFileFailed);
return false;
}
@@ -1,4 +1,5 @@
using System.Linq;
using AppResources = BD.WTTS.Client.Resources.Strings;
namespace BD.WTTS.Models;
@@ -25,7 +26,7 @@ public sealed partial class PlatformAccount
SwapToAccountCommand = ReactiveCommand.Create<IAccount>(acc =>
{
platformSwitcher.SwapToAccount(acc, this);
Toast.Show(ToastIcon.Success, $"{FullName} 已经切换到账号 {acc.DisplayName}");
Toast.Show(ToastIcon.Success, AppResources.Success_SwitchAccount__.Format(FullName, acc.DisplayName));
});
OpenUrlToBrowserCommand = ReactiveCommand.Create<IAccount>(acc =>
@@ -1,3 +1,5 @@
using AppResources = BD.WTTS.Client.Resources.Strings;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
@@ -39,7 +41,7 @@ public sealed class BasicPlatformSwitcher : IPlatformSwitcher
if (!string.IsNullOrEmpty(uniqueId) && !RegistryKeyHelper.SetRegistryKey(platform.UniqueIdPath, uniqueId)) // Remove "REG:" and read data
{
Toast.Show(ToastIcon.Info, "已经使用此账号登录");
Toast.Show(ToastIcon.Info, AppResources.Info_AccountAlreadyLogin);
return false;
}
}
@@ -53,7 +55,7 @@ public sealed class BasicPlatformSwitcher : IPlatformSwitcher
{
if (!regJson.ContainsKey(accFile))
{
Toast.Show(ToastIcon.Error, "读取已保存的注册表项失败。如果不成功,请尝试删除并重新添加帐户。");
Toast.Show(ToastIcon.Error, AppResources.Error_ReadRegistryFailed);
continue;
}
@@ -61,7 +63,7 @@ public sealed class BasicPlatformSwitcher : IPlatformSwitcher
if (!RegistryKeyHelper.SetRegistryKey(accFile[4..], regValue)) // Remove "REG:" and read data
{
Toast.Show(ToastIcon.Error, "写入 Windows 注册表失败");
Toast.Show(ToastIcon.Error, AppResources.Error_WriteRegistryFailed);
return false;
}
continue;
@@ -77,7 +79,7 @@ public sealed class BasicPlatformSwitcher : IPlatformSwitcher
var selector = accFile.Split("::")[2];
if (!JTokenHelper.ReplaceVarInJsonFile(path, selector, jToken))
{
Toast.Show(ToastIcon.Error, "修改JSON文件失败");
Toast.Show(ToastIcon.Error, AppResources.Error_ModifyJsonFileFailed);
return false;
}
continue;
@@ -111,7 +113,7 @@ public sealed class BasicPlatformSwitcher : IPlatformSwitcher
if (account?.AccountId == uniqueId)
{
RunPlatformProcess(platform, true);
Toast.Show("已经是当前登录的账号(没有执行操作)");
Toast.Show(ToastIcon.Info, AppResources.Info_AlreadyTheCurrentAccount);
return;
}
CurrnetUserAdd(platform.Accounts.First(acc => acc.AccountId == uniqueId).DisplayName ?? "Unknown", platform);
@@ -187,7 +189,7 @@ public sealed class BasicPlatformSwitcher : IPlatformSwitcher
{
if (RegistryKeyHelper.SetRegistryKey(accFile[4..])) return true;
}
Toast.Show("写入 Windows 注册表失败");
Toast.Show(ToastIcon.Error, AppResources.Error_WriteRegistryFailed);
return false;
}
@@ -214,7 +216,7 @@ public sealed class BasicPlatformSwitcher : IPlatformSwitcher
if (!Directory.Exists(Path.GetDirectoryName(folder)))
return true;
if (!PathHelper.RecursiveDelete(folder, false))
Toast.Show("无法删除某些文件(程序可能正在运行?)");
Toast.Show(ToastIcon.Warning, AppResources.Error_DelFileFailedRunning);
return true;
}
@@ -232,7 +234,7 @@ public sealed class BasicPlatformSwitcher : IPlatformSwitcher
if (Directory.Exists(fullPath))
{
if (!PathHelper.RecursiveDelete(fullPath, true))
Toast.Show("无法删除某些文件(程序可能正在运行?)");
Toast.Show(ToastIcon.Warning, AppResources.Error_DelFileFailedRunning);
return true;
}
@@ -243,8 +245,8 @@ public sealed class BasicPlatformSwitcher : IPlatformSwitcher
}
catch (UnauthorizedAccessException e)
{
Log.Error(nameof(DeleteFileOrFolder), e, "无法删除某些文件(程序可能正在运行?)");
Toast.Show("无法删除某些文件(程序可能正在运行?)");
Log.Error(nameof(DeleteFileOrFolder), e, AppResources.Error_DelFileFailedRunning);
Toast.Show(ToastIcon.Warning, AppResources.Error_DelFileFailedRunning);
}
return true;
}
@@ -271,7 +273,7 @@ public sealed class BasicPlatformSwitcher : IPlatformSwitcher
catch (Exception ex)
{
Log.Error(nameof(BasicPlatformSwitcher), ex, nameof(KillPlatformProcess));
Toast.Show($"结束 {platform.FullName} 进程失败");
Toast.Show(ToastIcon.Error, AppResources.Error_EndProcessFailed_.Format(platform.FullName));
return false;
}
@@ -288,7 +290,7 @@ public sealed class BasicPlatformSwitcher : IPlatformSwitcher
catch (Exception ex)
{
Log.Error(nameof(BasicPlatformSwitcher), ex, nameof(RunPlatformProcess));
Toast.Show($"启动 {platform.FullName} 进程失败");
Toast.Show(ToastIcon.Error, AppResources.Error_StartProcessFailed_.Format(platform.FullName));
return false;
}
return true;
@@ -422,7 +424,7 @@ public sealed class BasicPlatformSwitcher : IPlatformSwitcher
if (PathHelper.HandleFileOrFolder(accFile, savedFile, localCachePath, false, platform.FolderPath)) continue;
// Could not find file/folder
Toast.Show($"无法找到 {accFile} 的账号文件,添加失败");
Toast.Show(ToastIcon.Error, AppResources.Error_CannotFindAccountFile_.Format(accFile));
return false;
@@ -1,3 +1,4 @@
using AppResources = BD.WTTS.Client.Resources.Strings;
using Avalonia.Platform;
using BD.WTTS.UI.Views.Pages;
@@ -47,7 +48,7 @@ public sealed partial class GameAccountPageViewModel
{
if (platform.FullName == "Steam")
{
Toast.Show(string.Format("不允许删除 {0} 平台", platform.FullName));
Toast.Show(ToastIcon.Warning, AppResources.Warning_PlatformDeletionNotAllowed_.Format(platform.FullName));
return;
}
AddGamePlatforms?.Add(platform);
@@ -119,17 +120,17 @@ public sealed partial class GameAccountPageViewModel
{
if (SelectedPlatform == null) return;
var textModel = new TextBoxWindowViewModel();
var result = await IWindowManager.Instance.ShowTaskDialogAsync(textModel, $"添加新的 {SelectedPlatform.FullName} 账号", subHeader: $"请输入您当前登录的 {SelectedPlatform.FullName} 账号的名称", isCancelButton: true);
var result = await IWindowManager.Instance.ShowTaskDialogAsync(textModel, AppResources.Title_AddAccount_.Format(SelectedPlatform.FullName), subHeader: AppResources.Title_PleaseInputCurrentAccountName_.Format(SelectedPlatform.FullName), isCancelButton: true);
if (result)
{
if (string.IsNullOrEmpty(textModel.Value))
{
Toast.Show("请输入账号名称");
Toast.Show(ToastIcon.Warning, AppResources.Warning_PleaseInputAccountName);
return;
}
if (SelectedPlatform.CurrnetUserAdd(textModel.Value))
{
Toast.Show($"保存成功 {textModel.Value}");
Toast.Show(ToastIcon.Success, AppResources.Success_SavedSuccessfully_.Format(textModel.Value));
SelectedPlatform.LoadUsers();
}
}
@@ -140,9 +141,9 @@ public sealed partial class GameAccountPageViewModel
if (SelectedPlatform == null) return;
var textModel = new MessageBoxWindowViewModel
{
Content = "此操作会结束当前平台进程并移除当前账号登录状态跳转至新账号登录,确定要继续吗?"
Content = AppResources.ModelContent_LoginNewUser
};
var result = await IWindowManager.Instance.ShowTaskDialogAsync(textModel, $"登录 {SelectedPlatform.FullName} 账号", isCancelButton: true);
var result = await IWindowManager.Instance.ShowTaskDialogAsync(textModel, AppResources.Title_LoginAccount_.Format(SelectedPlatform.FullName), isCancelButton: true);
if (result)
SelectedPlatform?.CurrnetUserAdd(null);
}
@@ -1,20 +1,4 @@
<spp:PageBase
x:Class="BD.WTTS.UI.Views.Pages.GameAccountPage"
xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:s="https://steampp.net/services"
xmlns:spp="https://steampp.net/ui"
xmlns:ui="using:FluentAvalonia.UI.Controls"
x:Name="u"
Title="{ReflectionBinding Name,
Source={x:Static s:Plugin.Instance},
Mode=OneWay}"
d:DesignHeight="450"
d:DesignWidth="800"
x:CompileBindings="True"
x:DataType="spp:GameAccountPageViewModel"
Description="{ReflectionBinding Description,
Source={x:Static s:Plugin.Instance},
Mode=OneWay}"
@@ -23,7 +7,23 @@
Mode=OneWay,
Converter={StaticResource StringFormatConverter},
ConverterParameter=Plugin_Author}"
mc:Ignorable="d">
Title="{ReflectionBinding Name,
Source={x:Static s:Plugin.Instance},
Mode=OneWay}"
d:DesignHeight="450"
d:DesignWidth="800"
mc:Ignorable="d"
x:Class="BD.WTTS.UI.Views.Pages.GameAccountPage"
x:CompileBindings="True"
x:DataType="spp:GameAccountPageViewModel"
x:Name="u"
xmlns="https://github.com/avaloniaui"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:s="https://steampp.net/services"
xmlns:spp="https://steampp.net/ui"
xmlns:ui="using:FluentAvalonia.UI.Controls"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<spp:PageBase.PreviewImage>
<ui:ImageIconSource Source="{ReflectionBinding Icon, Source={x:Static s:Plugin.Instance}, Mode=OneWay, Converter={StaticResource BitmapAssetValueConverter}}" />
</spp:PageBase.PreviewImage>
@@ -42,102 +42,104 @@
<spp:PageBase.ActionContent>
<StackPanel Orientation="Horizontal" Spacing="2">
<Button
Padding="8,4"
Command="{Binding LoginNewCommand}"
DockPanel.Dock="Right"
Padding="8,4"
Theme="{StaticResource TransparentButton}">
<Panel>
<Viewbox
Width="16"
Height="16"
HorizontalAlignment="Left">
HorizontalAlignment="Left"
Width="16">
<ui:SymbolIcon Symbol="Add" />
</Viewbox>
<TextBlock
Margin="28,4,0,4"
HorizontalAlignment="Left"
VerticalAlignment="Center"
Margin="28,4,0,4"
Text="{ReflectionBinding Path=Res.UserChange_LoginNewAccount,
Mode=OneWay,
Source={x:Static s:ResourceService.Current}}" />
Source={x:Static s:ResourceService.Current}}"
VerticalAlignment="Center" />
</Panel>
</Button>
<Button
Padding="8,4"
Command="{Binding SaveCurrentUserCommand}"
DockPanel.Dock="Right"
IsVisible="{Binding !IsSelectedSteam}"
Padding="8,4"
Theme="{StaticResource TransparentButton}">
<Panel>
<Viewbox
Width="16"
Height="16"
HorizontalAlignment="Left">
HorizontalAlignment="Left"
Width="16">
<ui:SymbolIcon Symbol="Save" />
</Viewbox>
<TextBlock
Margin="28,4,0,4"
HorizontalAlignment="Left"
VerticalAlignment="Center"
Text="保存当前登录账号" />
Margin="28,4,0,4"
Text="{ReflectionBinding Path=Res.GameAccount_SaveCurrentAccount,
Mode=OneWay,
Source={x:Static s:ResourceService.Current}}"
VerticalAlignment="Center" />
</Panel>
</Button>
<Button
Padding="8,4"
Command="{Binding ShareManageCommand}"
DockPanel.Dock="Right"
IsVisible="{Binding IsSelectedSteam}"
Padding="8,4"
Theme="{StaticResource TransparentButton}">
<Panel>
<Viewbox
Width="16"
Height="16"
HorizontalAlignment="Left">
HorizontalAlignment="Left"
Width="16">
<ui:SymbolIcon Symbol="ShareAndroid" />
</Viewbox>
<TextBlock
Margin="28,4,0,4"
HorizontalAlignment="Left"
VerticalAlignment="Center"
Margin="28,4,0,4"
Text="{ReflectionBinding Path=Res.AccountChange_Title,
Mode=OneWay,
Source={x:Static s:ResourceService.Current}}" />
Source={x:Static s:ResourceService.Current}}"
VerticalAlignment="Center" />
</Panel>
</Button>
<Button
Padding="8,4"
Command="{Binding RefreshCommand}"
DockPanel.Dock="Right"
Padding="8,4"
Theme="{StaticResource TransparentButton}">
<Panel>
<Viewbox
Width="16"
Height="16"
HorizontalAlignment="Left">
HorizontalAlignment="Left"
Width="16">
<ui:SymbolIcon Symbol="Refresh" />
</Viewbox>
<TextBlock
Margin="28,4,0,4"
HorizontalAlignment="Left"
VerticalAlignment="Center"
Margin="28,4,0,4"
Text="{ReflectionBinding Path=Res.Refresh,
Mode=OneWay,
Source={x:Static s:ResourceService.Current}}" />
Source={x:Static s:ResourceService.Current}}"
VerticalAlignment="Center" />
</Panel>
</Button>
<DropDownButton
Padding="8"
HorizontalContentAlignment="Center"
VerticalContentAlignment="Center"
Content="{StaticResource More}"
FontFamily="{StaticResource SymbolThemeFontFamily}"
FontSize="20"
Theme="{StaticResource TransparentButton}">
HorizontalContentAlignment="Center"
Padding="8"
Theme="{StaticResource TransparentButton}"
VerticalContentAlignment="Center">
<DropDownButton.Flyout>
<ui:FAMenuFlyout Placement="BottomEdgeAlignedRight">
<ui:MenuFlyoutItem x:Name="PlatformSettingButton" Text="平台设置" />
<!-- <ui:MenuFlyoutItem x:Name="PluginSettingButton" Text="{ReflectionBinding Path=Res.Settings_Plugin, Mode=OneWay,Source={x:Static s:ResourceService.Current}}" /> -->
<ui:MenuFlyoutItem Text="平台设置" x:Name="PlatformSettingButton" />
<ui:MenuFlyoutSeparator />
<!--<ui:MenuFlyoutItem x:Name="PluginSettingButton" Text="插件设置" />-->
<ui:MenuFlyoutItem IsEnabled="False">
<ui:MenuFlyoutItem.Text>
<MultiBinding StringFormat="{}{0}{1}">
@@ -152,38 +154,40 @@
</MultiBinding>
</ui:MenuFlyoutItem.Text>
</ui:MenuFlyoutItem>
<ui:MenuFlyoutItem Text="在 Steam++ 插件商店中查看" />
<ui:MenuFlyoutItem Text="使用帮助" />
<ui:MenuFlyoutItem Text="关于此插件" />
<ui:MenuFlyoutItem Text="{ReflectionBinding Path=Res.ViewInStore, Mode=OneWay, Source={x:Static s:ResourceService.Current}}" />
<ui:MenuFlyoutItem Text="{ReflectionBinding Path=Res.UseHelp, Mode=OneWay, Source={x:Static s:ResourceService.Current}}" />
<ui:MenuFlyoutItem Text="{ReflectionBinding Path=Res.AboutThisPlugin, Mode=OneWay, Source={x:Static s:ResourceService.Current}}" />
</ui:FAMenuFlyout>
</DropDownButton.Flyout>
</DropDownButton>
</StackPanel>
</spp:PageBase.ActionContent>
<ui:TabView
Padding="0"
VerticalAlignment="Stretch"
Background="Transparent"
CloseButtonOverlayMode="OnPointerOver"
IsAddTabButtonVisible="False"
Padding="0"
SelectedItem="{Binding SelectedPlatform}"
SelectionChanged="TabView_SelectedItemChanged"
TabCloseRequested="TabView_TabCloseRequested"
TabItems="{Binding GamePlatforms}"
TabWidthMode="Equal">
TabWidthMode="Equal"
VerticalAlignment="Stretch">
<ui:TabView.TabStripFooter>
<Button
HorizontalAlignment="Left"
VerticalAlignment="Center"
Content="&#xE710;"
FontFamily="{StaticResource SymbolThemeFontFamily}"
Theme="{StaticResource TabViewButtonStyle}">
HorizontalAlignment="Left"
Theme="{StaticResource TabViewButtonStyle}"
VerticalAlignment="Center">
<Button.Flyout>
<ui:FAMenuFlyout Placement="BottomEdgeAlignedLeft">
<ui:MenuFlyoutSubItem
IsVisible="{Binding !!AddGamePlatforms.Count}"
ItemsSource="{Binding AddGamePlatforms}"
Text="添加平台">
Text="{ReflectionBinding Path=Res.AddPlatform,
Mode=OneWay,
Source={x:Static s:ResourceService.Current}}">
<ui:MenuFlyoutSubItem.DataTemplates>
<DataTemplate DataType="{x:Type spp:PlatformAccount}">
<ui:MenuFlyoutItem
@@ -205,7 +209,7 @@
Mode=OneWay,
Source={x:Static s:ResourceService.Current}}" />
<ui:MenuFlyoutSeparator />
<ui:MenuFlyoutSubItem Text="结束进程方式">
<ui:MenuFlyoutSubItem Text="{ReflectionBinding Path=Res.GameAccount_EndProcessWay, Mode=OneWay, Source={x:Static s:ResourceService.Current}}">
<ui:RadioMenuFlyoutItem
GroupName="KillMethond"
IconSource="Games"
@@ -215,7 +219,7 @@
IconSource="Icons"
Text="Direct" />
</ui:MenuFlyoutSubItem>
<ui:MenuFlyoutSubItem Text="启动进程方式">
<ui:MenuFlyoutSubItem Text="{ReflectionBinding Path=Res.GameAccount_StartProcessWay, Mode=OneWay, Source={x:Static s:ResourceService.Current}}">
<ui:RadioMenuFlyoutItem
GroupName="StartMethond"
IconSource="Games"
@@ -226,13 +230,13 @@
Text="Direct" />
</ui:MenuFlyoutSubItem>
<ui:MenuFlyoutSeparator />
<ui:ToggleMenuFlyoutItem IconSource="Safe" Text="以管理员权限启动" />
<ui:ToggleMenuFlyoutItem IconSource="Safe" Text="{ReflectionBinding Path=Res.AdministratorStartup, Mode=OneWay, Source={x:Static s:ResourceService.Current}}" />
</ui:FAMenuFlyout>
</Button.Flyout>
</Button>
</ui:TabView.TabStripFooter>
<ui:TabView.Styles>
<Style x:DataType="spp:PlatformAccount" Selector="ui|TabViewItem">
<Style Selector="ui|TabViewItem" x:DataType="spp:PlatformAccount">
<!--<Setter Property="IconSource">
<ui:FontIconSource Glyph="{Binding Icon}" />
</Setter>-->
@@ -248,11 +252,11 @@
<DataTemplate DataType="spp:PlatformAccount">
<DockPanel>
<PathIcon
Width="16"
Data="{Binding Icon, Converter={StaticResource ResourceKeyValueConverter}}"
DockPanel.Dock="Left"
Height="16"
Margin="0,0,8,0"
Data="{Binding Icon, Converter={StaticResource ResourceKeyValueConverter}}"
DockPanel.Dock="Left" />
Width="16" />
<TextBlock DockPanel.Dock="Right" Text="{Binding FullName}" />
</DockPanel>
</DataTemplate>
@@ -1,7 +1,10 @@
using AppResources = BD.WTTS.Client.Resources.Strings;
using FluentAvalonia.UI.Controls;
using BD.WTTS.Client.Resources;
using Avalonia.Controls;
using BD.WTTS.UI.Views.Controls;
using AngleSharp.Text;
namespace BD.WTTS.UI.Views.Pages;
@@ -22,8 +25,7 @@ public partial class GameAccountPage : PageBase<GameAccountPageViewModel>
if (ViewModel?.SelectedPlatform != null)
{
var model = new PlatformSettingsPageViewModel(ViewModel.SelectedPlatform);
await IWindowManager.Instance.ShowTaskDialogAsync(model,
$"{ViewModel.SelectedPlatform.FullName} 设置",
await IWindowManager.Instance.ShowTaskDialogAsync(model, AppResources.Title_SetUp_.Format(ViewModel.SelectedPlatform.FullName),
pageContent: new PlatformSettingsPage(),
isCancelButton: true,
cancelCloseAction: () =>
@@ -31,7 +33,7 @@ public partial class GameAccountPage : PageBase<GameAccountPageViewModel>
var cancel = !File.Exists(ViewModel.SelectedPlatform.PlatformSetting?.PlatformPath);
if (cancel)
{
Toast.Show(ToastIcon.Error, $"{ViewModel.SelectedPlatform.FullName} 平台路径没有正确选择");
Toast.Show(ToastIcon.Error, AppResources.Error_IncorrectPlatformPathSelection_.Format(ViewModel.SelectedPlatform.FullName));
}
return cancel;
});
@@ -46,9 +48,8 @@ public partial class GameAccountPage : PageBase<GameAccountPageViewModel>
if (item is PlatformAccount platform && !File.Exists(platform.ExePath))
{
var model = new PlatformSettingsPageViewModel(platform);
if (!await IWindowManager.Instance.ShowTaskDialogAsync(model,
$"{platform.FullName} 设置",
subHeader: $"第一次使用需要先设置 {platform.FullName} 平台路径",
if (!await IWindowManager.Instance.ShowTaskDialogAsync(model, AppResources.Title_SetUp_.Format(platform.FullName),
subHeader: AppResources.SubHeader_FirstNeedToSetPlatformPath_.Format(platform.FullName),
pageContent: new PlatformSettingsPage(),
isCancelButton: true,
cancelCloseAction: () =>
@@ -56,14 +57,14 @@ public partial class GameAccountPage : PageBase<GameAccountPageViewModel>
var cancel = !File.Exists(platform.PlatformSetting?.PlatformPath);
if (cancel)
{
Toast.Show(ToastIcon.Error, $"{platform.FullName} 平台路径没有正确选择");
Toast.Show(ToastIcon.Error, AppResources.Error_IncorrectPlatformPathSelection_.Format(platform.FullName));
}
return cancel;
}))
{
if (!File.Exists(platform.PlatformSetting?.PlatformPath))
{
Toast.Show(ToastIcon.Error, $"路径没有正确选择,{platform.FullName} 平台账号切换功能无法使用");
Toast.Show(ToastIcon.Error, AppResources.Error_PathFailedUnableSwitchAccount_.Format(platform.FullName));
}
}
}
@@ -37,10 +37,10 @@
CornerRadius="{StaticResource ControlCornerRadius}"
ItemContainerTheme="{StaticResource TabItemStyle}"
Theme="{StaticResource TabStripStyle}">
<TabStripItem Content="库" />
<TabStripItem Content="下载" />
<TabStripItem Content="挂机" />
<TabStripItem Content="编辑" />
<TabStripItem Content="{ReflectionBinding Path=Res.Depot, Mode=OneWay,Source={x:Static s:ResourceService.Current}}" />
<TabStripItem Content="{ReflectionBinding Path=Res.Download, Mode=OneWay,Source={x:Static s:ResourceService.Current}}" />
<TabStripItem Content="{ReflectionBinding Path=Res.OnHook, Mode=OneWay,Source={x:Static s:ResourceService.Current}}" />
<TabStripItem Content="{ReflectionBinding Path=Res.Edit, Mode=OneWay,Source={x:Static s:ResourceService.Current}}" />
</TabStrip>
</spp:PageBase.TabContent>-->
<spp:PageBase.ActionContent>
@@ -75,7 +75,7 @@
Margin="28,4,0,4"
HorizontalAlignment="Left"
VerticalAlignment="Center"
Text="筛选" />
Text="{ReflectionBinding Path=Res.Filter, Mode=OneWay,Source={x:Static s:ResourceService.Current}}" />
</Panel>
</ToggleButton>
<!--<Button
@@ -128,8 +128,8 @@
Theme="{StaticResource TransparentButton}">
<DropDownButton.Flyout>
<ui:FAMenuFlyout Placement="BottomEdgeAlignedRight">
<ui:MenuFlyoutItem Text="隐藏的游戏" />
<ui:MenuFlyoutItem x:Name="PluginSettingButton" Text="插件设置" />
<ui:MenuFlyoutItem Text="{ReflectionBinding Path=Res.Game_Hidden, Mode=OneWay,Source={x:Static s:ResourceService.Current}}" />
<ui:MenuFlyoutItem x:Name="PluginSettingButton" Text="{ReflectionBinding Path=Res.Settings_Plugin, Mode=OneWay,Source={x:Static s:ResourceService.Current}}" />
<ui:MenuFlyoutSeparator />
<ui:MenuFlyoutItem IsEnabled="False">
<ui:MenuFlyoutItem.Text>
@@ -145,9 +145,9 @@
</MultiBinding>
</ui:MenuFlyoutItem.Text>
</ui:MenuFlyoutItem>
<ui:MenuFlyoutItem Text="在 Steam++ 插件商店中查看" />
<ui:MenuFlyoutItem Text="使用帮助" />
<ui:MenuFlyoutItem Text="关于此插件" />
<ui:MenuFlyoutItem Text="{ReflectionBinding Path=Res.ViewInStore, Mode=OneWay,Source={x:Static s:ResourceService.Current}}" />
<ui:MenuFlyoutItem Text="{ReflectionBinding Path=Res.UseHelp, Mode=OneWay,Source={x:Static s:ResourceService.Current}}" />
<ui:MenuFlyoutItem Text="{ReflectionBinding Path=Res.AboutThisPlugin, Mode=OneWay,Source={x:Static s:ResourceService.Current}}" />
</ui:FAMenuFlyout>
</DropDownButton.Flyout>
</DropDownButton>
@@ -167,7 +167,7 @@
Classes="Search"
Text="{Binding SearchText}" />
<TextBlock Text="布局方式" Theme="{StaticResource BodyStrongTextBlockStyle}" />
<TextBlock Text="{ReflectionBinding Path=Res.Game_LayoutWay, Mode=OneWay,Source={x:Static s:ResourceService.Current}}" Theme="{StaticResource BodyStrongTextBlockStyle}" />
<TabStrip
Background="{DynamicResource ControlOnImageFillColorDefaultBrush}"
@@ -179,7 +179,7 @@
<TabStripItem Content="&#xE80A;" FontFamily="{StaticResource SymbolThemeFontFamily}" />
</TabStrip>
<TextBlock Text="筛选条件" Theme="{StaticResource BodyStrongTextBlockStyle}" />
<TextBlock Text="{ReflectionBinding Path=Res.FilterRequirement, Mode=OneWay,Source={x:Static s:ResourceService.Current}}" Theme="{StaticResource BodyStrongTextBlockStyle}" />
<DockPanel>
@@ -49,7 +49,7 @@ public static class SendSmsUIHelper
else
{
i.TimeLimit = timeLimit;
i.BtnSendSmsCodeText = AppResources.User_LoginCodeTimeLimitTip.Format(i.TimeLimit);
i.BtnSendSmsCodeText = AppResources.User_LoginCodeTimeLimitTip_.Format(i.TimeLimit);
return true;
}
}
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
@@ -89,7 +89,7 @@ public abstract class AppUpdateServiceBaseImpl : ReactiveObject, IAppUpdateServi
}
}
public string NewVersionInfoTitle => AppResources.NewVersionUpdateTitle_.Format(NewVersionInfo?.Version, AssemblyInfo.Trademark);
public string NewVersionInfoTitle => AppResources.NewVersionUpdateTitle__.Format(NewVersionInfo?.Version, AssemblyInfo.Trademark);
/// <summary>
/// 当存在新的版本时,重写此方法实现弹窗提示用户
@@ -192,9 +192,9 @@ public abstract class AppUpdateServiceBaseImpl : ReactiveObject, IAppUpdateServi
protected set => this.RaiseAndSetIfChanged(ref _ProgressString, value);
}
protected void OnReportDownloading3(float value, int current, int count) => OnReport(value, AppResources.Downloading3_.Format(MathF.Round(value, 2), current, count));
protected void OnReportDownloading3(float value, int current, int count) => OnReport(value, AppResources.Downloading3__.Format(MathF.Round(value, 2), current, count));
protected void OnReportCalcHashing3(float value, int current, int count) => OnReport(value, AppResources.CalcHashing3_.Format(MathF.Round(value, 2), current, count));
protected void OnReportCalcHashing3(float value, int current, int count) => OnReport(value, AppResources.CalcHashing3__.Format(MathF.Round(value, 2), current, count));
protected void OnReportDownloading(float value) => OnReport(value, AppResources.Downloading_.Format(MathF.Round(value, 2)));
@@ -45,7 +45,7 @@ public sealed class NotificationService : ReactiveObject
// INotificationService.Instance.Notify(new NotificationBuilder()
// {
// Title = AppResources.Notice_Tray_Title,
// Content = AppResources.Notice_Tray_Content.Format(result.Content.Length),
// Content = AppResources.Notice_Tray_Content_.Format(result.Content.Length),
// AutoCancel = NotificationBuilder.DefaultAutoCancel,
// Type = NotificationType.Announcement,
//#pragma warning disable CS0618 // 类型或成员已过时