mirror of
https://github.com/MaaAssistantArknights/MaaAssistantArknights.git
synced 2026-07-19 02:23:01 +08:00
feat: 增加强制替换adb的信息提示,增加异常处理
This commit is contained in:
@@ -1,4 +1,7 @@
|
||||
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:system="clr-namespace:System;assembly=mscorlib">
|
||||
<ResourceDictionary
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:system="clr-namespace:System;assembly=mscorlib">
|
||||
<!-- Settings -->
|
||||
<system:String x:Key="Settings">Settings</system:String>
|
||||
<system:String x:Key="GeneralSettings">General</system:String>
|
||||
@@ -462,6 +465,9 @@ The video aspect ratio needs to be 16:9 without interference factors such as bla
|
||||
<system:String x:Key="ResourceBroken">The resource is damaged, please download the full package again</system:String>
|
||||
<system:String x:Key="ReplaceADBNotExists">ADB File NOT existing</system:String>
|
||||
<system:String x:Key="AdbDownloadFailedTitle">ADB Download Failed</system:String>
|
||||
<system:String x:Key="AdbDeletionFailedMessage">Unable to delete directory, it may have been replaced or encountered other issues. Please check the logs for more information.</system:String>
|
||||
<system:String x:Key="UnzipFailedMessage">Unable to unzip the file, an unexpected error occurred. Please check the logs for more information.</system:String>
|
||||
<system:String x:Key="NoAdbPathSpecifiedMessage">No adb path specified</system:String>
|
||||
<system:String x:Key="AdbDownloadFailedDesc">Please do it manually (rename adb.exe and replace the ADB file in the emulator)</system:String>
|
||||
<system:String x:Key="SuccessfullyReplacedADB">Successfully replaced ADB File</system:String>
|
||||
<system:String x:Key="FailedToReplaceAdbAndUseLocal">Falied to replace ADB file</system:String>
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:system="clr-namespace:System;assembly=mscorlib">
|
||||
<ResourceDictionary
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:system="clr-namespace:System;assembly=mscorlib">
|
||||
<!-- 設定 -->
|
||||
<system:String x:Key="Settings">設定</system:String>
|
||||
<system:String x:Key="GeneralSettings">一般設定</system:String>
|
||||
@@ -460,6 +463,9 @@
|
||||
<system:String x:Key="ResourceBroken">リソースファイルが破損しています。完全なパッケージを再度ダウンロードしてください</system:String>
|
||||
<system:String x:Key="ReplaceADBNotExists">ADBファイルが存在しません</system:String>
|
||||
<system:String x:Key="AdbDownloadFailedTitle">ADBのダウンロードに失敗しました</system:String>
|
||||
<system:String x:Key="AdbDeletionFailedMessage">ディレクトリを削除できません。既に置換されたか、他の問題が発生している可能性があります。詳細な情報はログをご確認ください。</system:String>
|
||||
<system:String x:Key="UnzipFailedMessage">ファイルの解凍に失敗しました。予期せぬエラーが発生しました。詳細な情報はログをご確認ください。</system:String>
|
||||
<system:String x:Key="NoAdbPathSpecifiedMessage">adb パスが指定されていません</system:String>
|
||||
<system:String x:Key="AdbDownloadFailedDesc">手動で行ってください(adb.exeの名前を変更し、エミュレーター内のADBファイルを置き換えます)</system:String>
|
||||
<system:String x:Key="SuccessfullyReplacedADB">ADBファイルが正常に置き換えられました</system:String>
|
||||
<system:String x:Key="FailedToReplaceAdbAndUseLocal">ADBファイルの置換に失敗しました</system:String>
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:system="clr-namespace:System;assembly=mscorlib">
|
||||
<ResourceDictionary
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:system="clr-namespace:System;assembly=mscorlib">
|
||||
<!-- 설정 -->
|
||||
<system:String x:Key="Settings">설정</system:String>
|
||||
<system:String x:Key="GeneralSettings">일반 설정</system:String>
|
||||
@@ -461,6 +464,9 @@ OF-1을 해금하지 않았다면 선택하지 말아 주세요.</system:String>
|
||||
<system:String x:Key="ResourceBroken">리소스가 손상되었습니다. 전체 패키지를 다시 다운로드하세요</system:String>
|
||||
<system:String x:Key="ReplaceADBNotExists">ADB 파일이 존재하지 않습니다</system:String>
|
||||
<system:String x:Key="AdbDownloadFailedTitle">ADB 다운로드 실패</system:String>
|
||||
<system:String x:Key="AdbDeletionFailedMessage">디렉터리 삭제를 실패했습니다. 이미 대체되었거나 다른 문제가 발생했을 수 있습니다. 자세한 내용은 로그를 확인하세요.</system:String>
|
||||
<system:String x:Key="UnzipFailedMessage">파일 압축 해제에 실패했습니다. 예기치 않은 오류가 발생했습니다. 자세한 내용은 로그를 확인하세요.</system:String>
|
||||
<system:String x:Key="NoAdbPathSpecifiedMessage">adb 경로가 지정되지 않았습니다</system:String>
|
||||
<system:String x:Key="AdbDownloadFailedDesc">수동으로 진행해 주세요. (adb.exe의 이름을 바꾸고 에뮬레이터의 ADB 파일을 교체해 주세요)</system:String>
|
||||
<system:String x:Key="SuccessfullyReplacedADB">성공적으로 ADB 파일을 교체했습니다</system:String>
|
||||
<system:String x:Key="FailedToReplaceAdbAndUseLocal">ADB 교체 실패</system:String>
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:system="clr-namespace:System;assembly=mscorlib">
|
||||
<ResourceDictionary
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:system="clr-namespace:System;assembly=mscorlib">
|
||||
<!-- 设置 -->
|
||||
<system:String x:Key="Settings">设置</system:String>
|
||||
<system:String x:Key="GeneralSettings">常规设置</system:String>
|
||||
@@ -466,6 +469,9 @@
|
||||
<system:String x:Key="ResourceBroken">资源损坏,请重新下载完整安装包</system:String>
|
||||
<system:String x:Key="ReplaceADBNotExists">ADB 路径不存在</system:String>
|
||||
<system:String x:Key="AdbDownloadFailedTitle">ADB 下载失败</system:String>
|
||||
<system:String x:Key="AdbDeletionFailedMessage">无法删除目录,可能已被替换或发生了其他问题。请检查日志获取更多信息。</system:String>
|
||||
<system:String x:Key="UnzipFailedMessage">无法解压文件,可能发生了意外错误。请检查日志获取更多信息。</system:String>
|
||||
<system:String x:Key="NoAdbPathSpecifiedMessage">未指定 adb 路径</system:String>
|
||||
<system:String x:Key="AdbDownloadFailedDesc">请手动进行操作(将 adb.exe 重命名后替换上方模拟器自带 ADB 即可)</system:String>
|
||||
<system:String x:Key="SuccessfullyReplacedADB">成功替换 ADB 文件</system:String>
|
||||
<system:String x:Key="FailedToReplaceAdbAndUseLocal">替换 ADB 失败</system:String>
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:system="clr-namespace:System;assembly=mscorlib">
|
||||
<ResourceDictionary
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:system="clr-namespace:System;assembly=mscorlib">
|
||||
<!-- 設定 -->
|
||||
<system:String x:Key="Settings">設定</system:String>
|
||||
<system:String x:Key="GeneralSettings">常規設定</system:String>
|
||||
@@ -461,6 +464,9 @@
|
||||
<system:String x:Key="ResourceBroken">資源損毀,請重新下載完整安裝包</system:String>
|
||||
<system:String x:Key="ReplaceADBNotExists">ADB 路徑不存在</system:String>
|
||||
<system:String x:Key="AdbDownloadFailedTitle">ADB 下載失敗</system:String>
|
||||
<system:String x:Key="AdbDeletionFailedMessage">無法刪除目錄,可能已被替換或發生其他問題。請檢查日誌獲取更多信息。</system:String>
|
||||
<system:String x:Key="UnzipFailedMessage">無法解壓文件,可能發生意外錯誤。請檢查日誌獲取更多信息。</system:String>
|
||||
<system:String x:Key="NoAdbPathSpecifiedMessage">未指定 adb 路徑</system:String>
|
||||
<system:String x:Key="AdbDownloadFailedDesc">請手動進行操作(將 adb.exe 重新命名後替換上方模擬器自帶 ADB 即可)</system:String>
|
||||
<system:String x:Key="SuccessfullyReplacedADB">成功替換 ADB 文件</system:String>
|
||||
<system:String x:Key="FailedToReplaceAdbAndUseLocal">替換 ADB 失敗</system:String>
|
||||
|
||||
@@ -2651,6 +2651,16 @@ namespace MaaWpfGui.ViewModels.UI
|
||||
|
||||
public async void ReplaceADB()
|
||||
{
|
||||
if (string.IsNullOrEmpty(AdbPath))
|
||||
{
|
||||
_ = Execute.OnUIThreadAsync(() =>
|
||||
{
|
||||
using var toast = new ToastNotification(LocalizationHelper.GetString("NoAdbPathSpecifiedMessage"));
|
||||
toast.Show();
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
if (!File.Exists(GoogleAdbFilename))
|
||||
{
|
||||
var downloadResult = await Instances.HttpService.DownloadFileAsync(new Uri(GoogleAdbDownloadUrl), GoogleAdbFilename);
|
||||
@@ -2662,7 +2672,7 @@ namespace MaaWpfGui.ViewModels.UI
|
||||
|
||||
if (!downloadResult)
|
||||
{
|
||||
await Execute.OnUIThreadAsync(() =>
|
||||
_ = Execute.OnUIThreadAsync(() =>
|
||||
{
|
||||
using var toast = new ToastNotification(LocalizationHelper.GetString("AdbDownloadFailedTitle"));
|
||||
toast.AppendContentText(LocalizationHelper.GetString("AdbDownloadFailedDesc")).Show();
|
||||
@@ -2683,7 +2693,12 @@ namespace MaaWpfGui.ViewModels.UI
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.Error(ex.ToString() + "; already replace");
|
||||
_logger.Error($"An error occurred while deleting directory: {ex.GetType()}: {ex.Message}");
|
||||
_ = Execute.OnUIThreadAsync(() =>
|
||||
{
|
||||
using var toast = new ToastNotification(LocalizationHelper.GetString("AdbDeletionFailedMessage"));
|
||||
toast.Show();
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -2694,6 +2709,11 @@ namespace MaaWpfGui.ViewModels.UI
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.Error(ex.ToString());
|
||||
_ = Execute.OnUIThreadAsync(() =>
|
||||
{
|
||||
using var toast = new ToastNotification(LocalizationHelper.GetString("UnzipFailedMessage"));
|
||||
toast.Show();
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -2730,7 +2750,7 @@ namespace MaaWpfGui.ViewModels.UI
|
||||
|
||||
ConfigurationHelper.SetValue(ConfigurationKeys.AdbReplaced, true.ToString());
|
||||
|
||||
await Execute.OnUIThreadAsync(() =>
|
||||
_ = Execute.OnUIThreadAsync(() =>
|
||||
{
|
||||
using var toast = new ToastNotification(LocalizationHelper.GetString("SuccessfullyReplacedADB"));
|
||||
toast.Show();
|
||||
@@ -2740,7 +2760,7 @@ namespace MaaWpfGui.ViewModels.UI
|
||||
{
|
||||
AdbPath = NewAdb;
|
||||
|
||||
await Execute.OnUIThreadAsync(() =>
|
||||
_ = Execute.OnUIThreadAsync(() =>
|
||||
{
|
||||
using var toast = new ToastNotification(LocalizationHelper.GetString("FailedToReplaceAdbAndUseLocal"));
|
||||
toast.AppendContentText(LocalizationHelper.GetString("FailedToReplaceAdbAndUseLocalDesc")).Show();
|
||||
|
||||
Reference in New Issue
Block a user