mirror of
https://github.com/MaaAssistantArknights/MaaAssistantArknights.git
synced 2026-07-20 10:57:45 +08:00
chore: 加解密失败时通知
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Security.Cryptography;
|
||||
using System.Text;
|
||||
using Serilog;
|
||||
@@ -9,7 +10,7 @@ public static class SimpleEncryptionHelper
|
||||
{
|
||||
private static readonly ILogger _logger = Log.ForContext("SourceContext", "SimpleEncryptionHelper");
|
||||
|
||||
public static string Encrypt(string plainText, DataProtectionScope dataProtectionScope = DataProtectionScope.CurrentUser)
|
||||
public static string Encrypt(string plainText, DataProtectionScope dataProtectionScope = DataProtectionScope.CurrentUser, [CallerMemberName] string caller = "")
|
||||
{
|
||||
if (string.IsNullOrEmpty(plainText))
|
||||
{
|
||||
@@ -24,12 +25,13 @@ public static class SimpleEncryptionHelper
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
ToastNotification.ShowDirect(caller + LocalizationHelper.GetString("EncryptionError"));
|
||||
_logger.Error("Failed to encrypt text: " + e.Message);
|
||||
return plainText;
|
||||
}
|
||||
}
|
||||
|
||||
public static string Decrypt(string encryptedText, DataProtectionScope dataProtectionScope = DataProtectionScope.CurrentUser)
|
||||
public static string Decrypt(string encryptedText, DataProtectionScope dataProtectionScope = DataProtectionScope.CurrentUser, [CallerMemberName] string caller = "")
|
||||
{
|
||||
if (string.IsNullOrEmpty(encryptedText))
|
||||
{
|
||||
@@ -44,6 +46,7 @@ public static class SimpleEncryptionHelper
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
ToastNotification.ShowDirect(caller + LocalizationHelper.GetString("EncryptionError"));
|
||||
_logger.Error("Failed to decrypt text: " + e.Message);
|
||||
return encryptedText;
|
||||
}
|
||||
|
||||
@@ -516,13 +516,21 @@ namespace MaaWpfGui.Helper
|
||||
/// <returns>是否成功</returns>
|
||||
public static bool FlashWindowEx(IntPtr hWnd = default, FlashType type = FlashType.FLASHW_TIMERNOFG, uint count = 5)
|
||||
{
|
||||
var fInfo = default(FLASHWINFO);
|
||||
fInfo.cbSize = Convert.ToUInt32(Marshal.SizeOf(fInfo));
|
||||
fInfo.hwnd = hWnd != default ? hWnd : new WindowInteropHelper(System.Windows.Application.Current.MainWindow!).Handle;
|
||||
fInfo.dwFlags = (uint)type;
|
||||
fInfo.uCount = count;
|
||||
fInfo.dwTimeout = 0;
|
||||
return FlashWindowEx(ref fInfo);
|
||||
try
|
||||
{
|
||||
var fInfo = default(FLASHWINFO);
|
||||
fInfo.cbSize = Convert.ToUInt32(Marshal.SizeOf(fInfo));
|
||||
fInfo.hwnd = hWnd != default ? hWnd : new WindowInteropHelper(System.Windows.Application.Current.MainWindow!).Handle;
|
||||
fInfo.dwFlags = (uint)type;
|
||||
fInfo.uCount = count;
|
||||
fInfo.dwTimeout = 0;
|
||||
return FlashWindowEx(ref fInfo);
|
||||
}
|
||||
catch
|
||||
{
|
||||
_logger.Warning("FlashWindowEx error");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion 任务栏闪烁
|
||||
|
||||
@@ -166,10 +166,10 @@
|
||||
<system:String x:Key="IS4NewSquad2">博闻广记分队 (Wait global)</system:String>
|
||||
<system:String x:Key="IS4NewSquad3">蓝图测绘分队 (Wait global)</system:String>
|
||||
<system:String x:Key="IS4NewSquad4">因地制宜分队 (Wait global)</system:String>
|
||||
<system:String x:Key="IS4NewSquad5">异想天开分队 (Wait global) </system:String>
|
||||
<system:String x:Key="IS4NewSquad6">点刺成锭分队 (Wait global) </system:String>
|
||||
<system:String x:Key="IS4NewSquad5">异想天开分队 (Wait global)</system:String>
|
||||
<system:String x:Key="IS4NewSquad6">点刺成锭分队 (Wait global)</system:String>
|
||||
<system:String x:Key="IS4NewSquad7">拟态学者分队 (Wait global)</system:String>
|
||||
<system:String x:Key="IS4NewSquad8">专业人士分队(Wait global)</system:String>
|
||||
<system:String x:Key="IS4NewSquad8">专业人士分队 (Wait global)</system:String>
|
||||
<system:String x:Key="LeaderSquad">Leader Squad</system:String>
|
||||
<system:String x:Key="GatheringSquad">Gathering Squad</system:String>
|
||||
<system:String x:Key="SupportSquad">Support Squad</system:String>
|
||||
@@ -574,7 +574,7 @@ The primary instance is 0, and other instances are the numbers after the version
|
||||
<system:String x:Key="Toolbox">Toolbox</system:String>
|
||||
<!-- Recruitment Recognition -->
|
||||
<system:String x:Key="RecruitmentRecognition">Recruitment</system:String>
|
||||
<system:String x:Key="RecruitmentRecognitionTip">This recruit recognition is independent from the 「Farming」 tab. Please open the in game recruit tag selection screen before pressing 「Begin to Recruit」 </system:String>
|
||||
<system:String x:Key="RecruitmentRecognitionTip">This recruit recognition is independent from the 「Farming」 tab. Please open the in game recruit tag selection screen before pressing 「Begin to Recruit」</system:String>
|
||||
<system:String x:Key="AutoSettingTime">Auto set time</system:String>
|
||||
<system:String x:Key="RecruitmentShowPotential">Show Potential</system:String>
|
||||
<system:String x:Key="RecruitmentShowPotentialTips">Please use the 「Operator」 task to get the 「Potential」 information.</system:String>
|
||||
@@ -655,7 +655,7 @@ The video aspect ratio needs to be 16:9 without interference factors such as bla
|
||||
<system:String x:Key="FailedToLikeWebJson">An error occurred, the like failed. : <</system:String>
|
||||
<system:String x:Key="ThanksForLikeWebJson">Thanks for the likes!\nThe comment section is already open on the web page, please feel free to leave your comment!</system:String>
|
||||
<system:String x:Key="AutoSquad">Auto Squad</system:String>
|
||||
<system:String x:Key="AutoSquadTip"> 「Favourite」 marked operators cannot be recognized at this time</system:String>
|
||||
<system:String x:Key="AutoSquadTip">「Favourite」 marked operators cannot be recognized at this time</system:String>
|
||||
<system:String x:Key="AddTrust">Add low-trust operators</system:String>
|
||||
<system:String x:Key="AddUserAdditional">Add custom operators</system:String>
|
||||
<system:String x:Key="AddUserAdditionalTip">Use 「;」 as the separator, 「,」 to separate the operator name and skills, for example: W, 3; Ash, 2</system:String>
|
||||
@@ -956,4 +956,7 @@ Only one instance can be launched under the same path!
|
||||
If you want to run multiple MAA at the same time, please copy the whole MAA and start under different path with the same adb and different connect address.
|
||||
</system:String>
|
||||
<!-- !SingleInstance -->
|
||||
<!-- SimpleEncryptionHelper -->
|
||||
<system:String x:Key="EncryptionError">Encryption and decryption failed, please reconfigure the relevant settings, otherwise the encrypted content will be stored in plain text in the configuration file.</system:String>
|
||||
<!-- !SimpleEncryptionHelper -->
|
||||
</ResourceDictionary>
|
||||
|
||||
@@ -959,4 +959,7 @@ C:\\leidian\\LDPlayer9
|
||||
MAA を複数開くには、新しい MAA を他のフォルダにコピーし、異なる MAA、同じ adb、異なるシミュレータアドレスを使用して複数の操作を行うように設定します。
|
||||
</system:String>
|
||||
<!-- !SingleInstance -->
|
||||
<!-- SimpleEncryptionHelper -->
|
||||
<system:String x:Key="EncryptionError">暗号化と復号化に失敗しました。関連設定を再設定してください。そうでないと、暗号化された内容は設定ファイルに平文で保存されます。</system:String>
|
||||
<!-- !SimpleEncryptionHelper -->
|
||||
</ResourceDictionary>
|
||||
|
||||
@@ -957,4 +957,7 @@ C:\\leidian\\LDPlayer9
|
||||
MAA 를 더 열려면 새 MAA를 다른 폴더로 복사하고 다른 MAA, 같은 adb 및 다른 에뮬레이터 주소를 사용하여 다중 열 수 있도록 설정합니다.
|
||||
</system:String>
|
||||
<!-- !SingleInstance -->
|
||||
<!-- SimpleEncryptionHelper -->
|
||||
<system:String x:Key="EncryptionError">암호화 및 복호화에 실패했습니다. 관련 설정을 다시 구성하십시오. 그렇지 않으면 암호화된 내용이 설정 파일에 평문으로 저장됩니다.</system:String>
|
||||
<!-- !SimpleEncryptionHelper -->
|
||||
</ResourceDictionary>
|
||||
|
||||
@@ -958,4 +958,7 @@ C:\\leidian\\LDPlayer9。\n
|
||||
如需多开 MAA,请复制一份新的 MAA 到其他文件夹下,并设置使用不同的 MAA,相同的 adb 和不同的模拟器地址进行多开操作。
|
||||
</system:String>
|
||||
<!-- !SingleInstance -->
|
||||
<!-- SimpleEncryptionHelper -->
|
||||
<system:String x:Key="EncryptionError">加解密失败,请重新配置相关设置,否则加密内容将以明文形式存储在配置文件中。</system:String>
|
||||
<!-- !SimpleEncryptionHelper -->
|
||||
</ResourceDictionary>
|
||||
|
||||
@@ -960,4 +960,7 @@ C:\\leidian\\LDPlayer9。\n
|
||||
如需多開MAA,請複製一份新的MAA到其他資料夾下,並設定使用不同的 MAA,相同的 adb 和不同的模擬器地址進行多開操作。
|
||||
</system:String>
|
||||
<!-- !SingleInstance -->
|
||||
<!-- SimpleEncryptionHelper -->
|
||||
<system:String x:Key="EncryptionError">加解密失敗,請重新配置相關設置,否則加密內容將以明文形式存儲在配置文件中。</system:String>
|
||||
<!-- !SimpleEncryptionHelper -->
|
||||
</ResourceDictionary>
|
||||
|
||||
Reference in New Issue
Block a user