Merge branch 'dev' into dev

This commit is contained in:
peter1997546
2023-05-28 02:49:31 +08:00
committed by GitHub
12 changed files with 281 additions and 170 deletions

View File

@@ -55,6 +55,7 @@ namespace MaaWpfGui.Constants
public const string AdbPath = "Connect.AdbPath";
public const string ConnectConfig = "Connect.ConnectConfig";
public const string RetryOnAdbDisconnected = "Connect.RetryOnDisconnected";
public const string AllowADBRestart = "Connect.AllowADBRestart";
public const string AdbLiteEnabled = "Connect.AdbLiteEnabled";
public const string KillAdbOnExit = "Connect.KillAdbOnExit";
public const string TouchMode = "Connect.TouchMode";

View File

@@ -443,7 +443,7 @@ namespace MaaWpfGui.Main
if (Instances.SettingsViewModel.RetryOnDisconnected)
{
Instances.TaskQueueViewModel.AddLog(LocalizationHelper.GetString("TryToStartEmulator"), UiLogColor.Error);
Instances.TaskQueueViewModel.KillEmulator();
Instances.TaskQueueViewModel.KillEmulatorModeSwitcher();
await Task.Delay(3000);
await Instances.TaskQueueViewModel.Stop();
Instances.TaskQueueViewModel.SetStopped();

View File

@@ -90,11 +90,11 @@
<system:String x:Key="StartingRoles">Starting Roles</system:String>
<system:String x:Key="StartingCoreChar">Starting Oper (single, CN name only)</system:String>
<system:String x:Key="StartingCoreCharTip">Only supports the CN name of a single oper, default if not filled.</system:String>
<system:String x:Key="RoguelikeUseSupportUnit">Select "Starting Oper" from support unit list</system:String>
<system:String x:Key="RoguelikeUseSupportUnit">Select &quot;Starting Oper&quot; from support unit list</system:String>
<system:String x:Key="RoguelikeUseNonFriendSupport">Enable nonfirend support</system:String>
<system:String x:Key="DeploymentWithPause" xml:space="preserve">Deployment with Pause, Works for IS, Copilot and SSS,\nBeta function, Not recommended yet</system:String>
<system:String x:Key="AdbLiteEnabled">Use Adb Lite (Experimental)</system:String>
<system:String x:Key="KillAdbOnExit">Kill Adb On Exit</system:String>
<system:String x:Key="AdbLiteEnabled">Use ADB Lite (Experimental)</system:String>
<system:String x:Key="KillAdbOnExit">Kill ADB On Exit</system:String>
<system:String x:Key="DefaultSquad">Default</system:String>
<system:String x:Key="IS2NewSquad1">Mind over matter (to be updated)</system:String>
@@ -222,7 +222,7 @@
<system:String x:Key="TouchMode">Touch Mode</system:String>
<system:String x:Key="MiniTouchMode">Minitouch (Default)</system:String>
<system:String x:Key="MaaTouchMode">MaaTouch (Experimental)</system:String>
<system:String x:Key="AdbTouchMode">Adb Input (Compatibility)</system:String>
<system:String x:Key="AdbTouchMode">ADB Input (Compatibility)</system:String>
<system:String x:Key="AdditionCommand">Addiction Command arguments</system:String>
<system:String x:Key="StartsWithScript">Starts with Script</system:String>
<system:String x:Key="EndsWithScript">Ends with Script</system:String>
@@ -265,7 +265,7 @@
<system:String x:Key="CustomInfrastPlanShowInFightSettings">Show Base Plan</system:String>
<system:String x:Key="MainViewButtonFeature">Variable function button</system:String>
<system:String x:Key="CustomStageCode">Manual entry of level names</system:String>
<system:String x:Key="CustomStageCodeTip" xml:space="preserve">Support most main stage names + stage names from the original list (e.g. 4-10, AP-5, H10-1-Hard, etc.)&#x0a;At the end of the level, enter "Normal/Hard" to switch between Normal and Tough difficulty</system:String>
<system:String x:Key="CustomStageCodeTip" xml:space="preserve">Support most main stage names + stage names from the original list (e.g. 4-10, AP-5, H10-1-Hard, etc.)&#x0a;At the end of the level, enter &quot;Normal/Hard&quot; to switch between Normal and Tough difficulty</system:String>
<system:String x:Key="AutoDetectConnection">Auto detect connection</system:String>
<system:String x:Key="AutoDetectConnectionTip">The checkbox will be automatically unchecked after each detect is completed, and can be checked again if you need to re-detect</system:String>
@@ -274,8 +274,9 @@
<system:String x:Key="ConnectionAddress">Connection address</system:String>
<system:String x:Key="ConnectionAddressTip">It will be filled in automatically when you use it for the first time. If you encounter any problems, you can try to manually modify it</system:String>
<system:String x:Key="ConnectionPreset">Connection Preset</system:String>
<system:String x:Key="RetryOnDisconnected">Auto restart emulator when adb reconnection fails</system:String>
<system:String x:Key="RetryOnDisconnected">Auto restart emulator when ADB reconnection fails</system:String>
<system:String x:Key="RetryOnDisconnectedTip">Try restarting the emulator after 20 failed reconnect attempts, Must be checked when using a background timed task and setting the task to close the emulator when finished</system:String>
<system:String x:Key="AllowADBRestart">Attempt to restart ADB after connection failure</system:String>
<!-- Settings -->
<!-- Farming -->
@@ -391,7 +392,7 @@
<system:String x:Key="RecruitmentRecognitionTip">Tip: This recognition is independent from main tab (Farming); need open up in game recruit tag selection screen then begin ~</system:String>
<system:String x:Key="AutoSettingTime">Auto setting time</system:String>
<system:String x:Key="RecruitmentShowPotential">Show Potential</system:String>
<system:String x:Key="RecruitmentShowPotentialTips">Please use the "Operator" to get information</system:String>
<system:String x:Key="RecruitmentShowPotentialTips">Please use the &quot;Operator&quot; to get information</system:String>
<system:String x:Key="AutoSelectLevel3Tags">Auto select 3 ★ Tags</system:String>
<system:String x:Key="AutoSelectLevel4Tags">Auto select 4 ★ Tags</system:String>
<system:String x:Key="AutoSelectLevel5Tags">Auto select 5 ★ Tags</system:String>
@@ -420,7 +421,7 @@
<system:String x:Key="VideoRecognition">Video</system:String>
<system:String x:Key="StartToVideoRecognition">Start to identify</system:String>
<system:String x:Key="OpenVideoRecognitionResult">Open Directory</system:String>
<system:String x:Key="VideoRecognitionTips" xml:space="preserve">For video recognition, please open the "Copilot" page and drag the strategy video into it.
<system:String x:Key="VideoRecognitionTips" xml:space="preserve">For video recognition, please open the &quot;Copilot&quot; page and drag the strategy video into it.
The video resolution is required to be 16:9, and there are no interference factors such as black borders, emulator borders, and special-shaped screen corrections.</system:String>
<!-- Video Recognition -->
@@ -465,7 +466,7 @@ The video resolution is required to be 16:9, and there are no interference facto
<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="LoopTimes">LoopTimes</system:String>
<system:String x:Key="AutoSquadTip">The operator of "special focus" cannot be identified at this time</system:String>
<system:String x:Key="AutoSquadTip">The operator of &quot;special focus&quot; cannot be identified at this time</system:String>
<system:String x:Key="Start">Start</system:String>
@@ -474,11 +475,11 @@ The video resolution is required to be 16:9, and there are no interference facto
<!-- Logs -->
<system:String x:Key="CopilotTip">
Tips\n\n
1. Please use this function only when "Start" is visible in game.\n\n
2. You need turn off the "Auto squad" if using friend support unit, then start with your support unit selected.\n\n
3. For Paradox Simulation, you need to turn off "Auto squad" and select the skill before, then start in game "start" screen.\n\n
1. Please use this function only when &quot;Start&quot; is visible in game.\n\n
2. You need turn off the &quot;Auto squad&quot; if using friend support unit, then start with your support unit selected.\n\n
3. For Paradox Simulation, you need to turn off &quot;Auto squad&quot; and select the skill before, then start in game &quot;start&quot; screen.\n\n
4. For SSS, There are multiple built-in files under the resource/copilot folder.\n
Please start on the "Start Deployment" screen after manual formation (can be used with "Loop times")\n\n
Please start on the &quot;Start Deployment&quot; screen after manual formation (can be used with &quot;Loop times&quot;)\n\n
5. Video recognition is now supported, please drag the guide video to use. \n
The video resolution is required to be 16:9, and there are no distracting elements such as black borders, emulator borders, and special-shaped screen corrections.\n\n
</system:String>
@@ -508,7 +509,7 @@ The video resolution is required to be 16:9, and there are no interference facto
<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 exists</system:String>
<system:String x:Key="AdbDownloadFailedTitle">ADB Download Failed</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="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>
<system:String x:Key="FailedToReplaceAdbAndUseLocalDesc">Temporarily connected using local ADB.</system:String>
@@ -584,6 +585,7 @@ The video resolution is required to be 16:9, and there are no interference facto
<system:String x:Key="RecruitTagsDetected" xml:space="preserve">Identify results: </system:String>
<system:String x:Key="ConnectFailed">Connection Failed</system:String>
<system:String x:Key="TryToStartEmulator">Trying to start the emulator</system:String>
<system:String x:Key="RestartADB">Trying to restart the ADB</system:String>
<system:String x:Key="CheckSettings">Please check your connection settings or try restarting the emulator and ADB, or restart your computer</system:String>
<!-- AsstProxy -->
@@ -620,7 +622,7 @@ The video resolution is required to be 16:9, and there are no interference facto
<!-- AutoRecruitSettings -->
<!-- EasterEggs -->
<system:String x:Key="BuyWineOnAprilFoolsDay">Dear doctor, ever heard of the new listings of "isopropyl alcohol" in Ms. Closure's store? let's check it out?</system:String>
<system:String x:Key="BuyWineOnAprilFoolsDay">Dear doctor, ever heard of the new listings of &quot;isopropyl alcohol&quot; in Ms. Closure's store? let's check it out?</system:String>
<system:String x:Key="Burping">Ugh... Ehem</system:String>
<system:String x:Key="DrunkAndStaggering">Ah, doctor. Why do you sway, so much in your movement today?</system:String>
<system:String x:Key="Hangover">I must not drink, drink so much next time...</system:String>

View File

@@ -90,11 +90,11 @@
<system:String x:Key="StartingRoles">最初の職業</system:String>
<system:String x:Key="StartingCoreChar">最初のオペレーター(一人だけ、中国名のみを入力可能)</system:String>
<system:String x:Key="StartingCoreCharTip">一人のオペレーターの中国名のみをサポートします。入力されていない場合はデフォルトになります。</system:String>
<system:String x:Key="RoguelikeUseSupportUnit">"最初のオペレーター"をサポートから選択</system:String>
<system:String x:Key="RoguelikeUseSupportUnit">&quot;最初のオペレーター&quot;をサポートから選択</system:String>
<system:String x:Key="RoguelikeUseNonFriendSupport">フレンド以外のサポートの使用を許可</system:String>
<system:String x:Key="DeploymentWithPause">統合戦略/保全駐在でポーズトリックを使用します(ベータ機能のため非推奨です)</system:String>
<system:String x:Key="AdbLiteEnabled">軽量Adbを使用(実験機能)</system:String>
<system:String x:Key="KillAdbOnExit">終了時にAdbを終了する</system:String>
<system:String x:Key="AdbLiteEnabled">軽量ADBを使用(実験機能)</system:String>
<system:String x:Key="KillAdbOnExit">終了時にADBを終了する</system:String>
<system:String x:Key="DefaultSquad">デフォルト</system:String>
<system:String x:Key="IS2NewSquad1">(ミヅキ)心胜于物分队</system:String>
@@ -216,7 +216,7 @@
<system:String x:Key="TouchMode">タッチモード</system:String>
<system:String x:Key="MiniTouchMode">Minitouch (標準)</system:String>
<system:String x:Key="MaaTouchMode">MaaTouch (実験機能)</system:String>
<system:String x:Key="AdbTouchMode">Adb Input (互換性)</system:String>
<system:String x:Key="AdbTouchMode">ADB Input (互換性)</system:String>
<system:String x:Key="AdditionCommand">追加コマンド</system:String>
<system:String x:Key="StartsWithScript">スクリプトを使用して始めます</system:String>
<system:String x:Key="EndsWithScript">終了時にスクリプトを使用します</system:String>
@@ -259,17 +259,18 @@
<system:String x:Key="CustomInfrastPlanShowInFightSettings">基地計画を表示する</system:String>
<system:String x:Key="MainViewButtonFeature">スタート画面に表示する便利ボタン</system:String>
<system:String x:Key="CustomStageCode">ステージ名を入力する</system:String>
<system:String x:Key="CustomStageCodeTip" xml:space="preserve">(テスト機能)ステージ名と番号4-10、AP-5、H10-1-Hardなど&#x0a;の両方がサポートされています。レベルの最後に"Normal/Hard"を入力することで、標準から強襲/厄難に難易度を切り替えることができます。</system:String>
<system:String x:Key="CustomStageCodeTip" xml:space="preserve">(テスト機能)ステージ名と番号4-10、AP-5、H10-1-Hardなど&#x0a;の両方がサポートされています。レベルの最後に&quot;Normal/Hard&quot;を入力することで、標準から強襲/厄難に難易度を切り替えることができます。</system:String>
<system:String x:Key="AutoDetectConnection">接続自動認識</system:String>
<system:String x:Key="AutoDetectConnectionTip">このチェックボックスは、検出が完了するたびに自動的にチェックが外れますが、再検出が必要な場合は再度チェックを入れることができます</system:String>
<system:String x:Key="AlwaysAutoDetectConnection">毎回再検出する</system:String>
<system:String x:Key="ADBPath">adbパス(相対/絶対)</system:String>
<system:String x:Key="ADBPath">ADBパス(相対/絶対)</system:String>
<system:String x:Key="ConnectionAddress">接続先アドレス</system:String>
<system:String x:Key="ConnectionAddressTip">問題があれば手動で修正してください。</system:String>
<system:String x:Key="ConnectionPreset">接続構成</system:String>
<system:String x:Key="RetryOnDisconnected">adb再接続失敗時にエミュレータを自動で再起動</system:String>
<system:String x:Key="RetryOnDisconnected">ADB再接続失敗時にエミュレータを自動で再起動</system:String>
<system:String x:Key="RetryOnDisconnectedTip">再接続に20回失敗した後、エミュレータを再起動してみてくださいバックグラウンドのタイムドタスクを使用し、終了時にエミュレータを終了させるタスクを設定する場合は、必ずチェックを入れること</system:String>
<system:String x:Key="AllowADBRestart">接続失敗後にADBの再起動を試みる</system:String>
<!-- 設定 -->
<!-- スタート -->
@@ -498,7 +499,7 @@
<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="AdbDownloadFailedDesc">手動で行ってくださいadb.exeの名前を変更し、エミュレーター内の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>
<system:String x:Key="FailedToReplaceAdbAndUseLocalDesc">一時的にローカルADBを使用して接続されました。</system:String>
@@ -574,6 +575,7 @@
<system:String x:Key="RecruitTagsDetected">認識結果:</system:String>
<system:String x:Key="ConnectFailed">接続失敗</system:String>
<system:String x:Key="TryToStartEmulator">エミュレータを起動しようとしています</system:String>
<system:String x:Key="RestartADB">ADBの再起動を試みています</system:String>
<system:String x:Key="CheckSettings">接続設定を確認するか、エミュレータとADBを再起動するか、コンピューターを再起動してください</system:String>
<!-- Recruitment Results: -->

View File

@@ -93,8 +93,8 @@
<system:String x:Key="RoguelikeUseSupportUnit">시작 오퍼레이터로 지원 유닛 사용</system:String>
<system:String x:Key="RoguelikeUseNonFriendSupport">친구가 아니어도 지원 유닛 사용</system:String>
<system:String x:Key="DeploymentWithPause" xml:space="preserve">일시정지 상태로 배치하기 - 통합전략, 자동 작전, 보안 파견에 적용\n(베타 기능, 현재 비권장)</system:String>
<system:String x:Key="AdbLiteEnabled">adb Lite 사용 (실험적)</system:String>
<system:String x:Key="KillAdbOnExit">종료 시 adb도 종료</system:String>
<system:String x:Key="AdbLiteEnabled">ADB Lite 사용 (실험적)</system:String>
<system:String x:Key="KillAdbOnExit">종료 시 ADB도 종료</system:String>
<system:String x:Key="DefaultSquad">기본값</system:String>
<system:String x:Key="IS2NewSquad1">마음가짐 분대</system:String>
@@ -133,10 +133,10 @@
<system:String x:Key="Switchable">전환 가능</system:String>
<system:String x:Key="Executable">실행 파일</system:String>
<system:String x:Key="ADBProgram">adb 프로그램</system:String>
<system:String x:Key="ADBProgram">ADB 프로그램</system:String>
<system:String x:Key="EmulatorException">에뮬레이터를 검색하는 중에 오류가 발생했습니다.\n이 소프트웨어를 관리자로 실행하거나\n수동으로 연결을 설정해 주세요.</system:String>
<system:String x:Key="AdbException">adb를 찾을 수 없었습니다.\n관리자 권한으로 실행하거나\n수동으로 연결 설정해 주세요.</system:String>
<system:String x:Key="AdbException">ADB를 찾을 수 없었습니다.\n관리자 권한으로 실행하거나\n수동으로 연결 설정해 주세요.</system:String>
<system:String x:Key="EmulatorNotFound">에뮬레이터를 찾을 수 없습니다.\n이 소프트웨어를 관리자로 실행하거나\n수동으로 연결을 설정해 주세요.</system:String>
<system:String x:Key="EmulatorTooMany">여러 에뮬레이터가 실행 중입니다.\n사용하지 않는 에뮬레이터를 종료하거나\n수동으로 연결을 설정해 주세요.</system:String>
@@ -216,7 +216,7 @@
<system:String x:Key="TouchMode">터치 수행 방식</system:String>
<system:String x:Key="MiniTouchMode">Minitouch (기본값)</system:String>
<system:String x:Key="MaaTouchMode">MaaTouch (실험적)</system:String>
<system:String x:Key="AdbTouchMode">Adb Input (호환 모드)</system:String>
<system:String x:Key="AdbTouchMode">ADB Input (호환 모드)</system:String>
<system:String x:Key="AdditionCommand">추가 변수</system:String>
<system:String x:Key="StartsWithScript">시작 시 추가 스크립트</system:String>
<system:String x:Key="EndsWithScript">종료 시 추가 스크립트</system:String>
@@ -259,17 +259,18 @@
<system:String x:Key="CustomInfrastPlanShowInFightSettings">기반시설 계획 표시</system:String>
<system:String x:Key="MainViewButtonFeature">메인 화면 버튼의 기능</system:String>
<system:String x:Key="CustomStageCode">스테이지 코드 수동 입력</system:String>
<system:String x:Key="CustomStageCodeTip" xml:space="preserve">대부분의 메인 스테이지와 원래 목록(예: 4-10, AP-5, H10-1-Hard)에 있는 스테이지 이름을 지원합니다.&#x0a; 레벨 끝에서 "Normal / Hard"를 입력하여 일반 및 터프 난이도 간 전환</system:String>
<system:String x:Key="CustomStageCodeTip" xml:space="preserve">대부분의 메인 스테이지와 원래 목록(예: 4-10, AP-5, H10-1-Hard)에 있는 스테이지 이름을 지원합니다.&#x0a; 레벨 끝에서 &quot;Normal / Hard&quot;를 입력하여 일반 및 터프 난이도 간 전환</system:String>
<system:String x:Key="AutoDetectConnection">연결 자동 감지</system:String>
<system:String x:Key="AutoDetectConnectionTip">이 체크박스는 감지가 끝나면 자동으로 체크가 해제됩니다. 다시 감지하려면 다시 체크해주세요.</system:String>
<system:String x:Key="AlwaysAutoDetectConnection">매번 재감지</system:String>
<system:String x:Key="ADBPath">adb 경로 (상대/절대)</system:String>
<system:String x:Key="ADBPath">ADB 경로 (상대/절대)</system:String>
<system:String x:Key="ConnectionAddress">연결 주소</system:String>
<system:String x:Key="ConnectionAddressTip">문제 발생 시 직접 수정해 주세요</system:String>
<system:String x:Key="ConnectionPreset">연결 프리셋</system:String>
<system:String x:Key="RetryOnDisconnected">adb 재연결이 실패하면 자동으로 에뮬레이터를 다시 시작합니다</system:String>
<system:String x:Key="RetryOnDisconnected">ADB 재연결이 실패하면 자동으로 에뮬레이터를 다시 시작합니다</system:String>
<system:String x:Key="RetryOnDisconnectedTip">재연결을 20회 시도해도 실패하면 에뮬레이터를 다시 시작합니다. 백그라운드 예약을 사용하고 작업이 완료되면 에뮬레이터가 종료되도록 설정하려면 반드시 선택해야 합니다.</system:String>
<system:String x:Key="AllowADBRestart">연결 실패 후 ADB 재시작 시도</system:String>
<!-- 설정 -->
<!-- 자동화 -->
@@ -490,7 +491,7 @@
<system:String x:Key="ErrorDetails">세부 정보</system:String>
<system:String x:Key="ErrorSolution">해결 방법</system:String>
<system:String x:Key="ErrorSolutionCrash">FAQ 문서의 크래시 관련 문단을 참고하세요.</system:String>
<system:String x:Key="ErrorSolutionReplaceADB">에뮬레이터와 adb를 종료하거나 컴퓨터를 재시작하고 관리자 권한으로 MAA를 실행해 주세요.</system:String>
<system:String x:Key="ErrorSolutionReplaceADB">에뮬레이터와 ADB를 종료하거나 컴퓨터를 재시작하고 관리자 권한으로 MAA를 실행해 주세요.</system:String>
<system:String x:Key="ErrorFeedbackLinkText">GitHub에 issue 생성</system:String>
<system:String x:Key="ErrorQqGroupLinkText">QQ 그룹 가입</system:String>
<system:String x:Key="CopyErrorMessage">오류 메시지 복사</system:String>
@@ -499,10 +500,10 @@
<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="AdbDownloadFailedDesc">수동으로 진행해 주세요. (adb.exe의 이름을 바꾸고 에뮬레이터의 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>
<system:String x:Key="FailedToReplaceAdbAndUseLocalDesc">로컬 adb 파일로 임시적으로 연결했습니다.</system:String>
<system:String x:Key="FailedToReplaceAdbAndUseLocalDesc">로컬 ADB 파일로 임시적으로 연결했습니다.</system:String>
<system:String x:Key="InitializationError">초기화 오류!</system:String>
<system:String x:Key="ResolutionNotSupported">에뮬레이터 해상도가 지원되지 않습니다. 16:9 비율로 설정하시고 해상도를 720p 이상으로 설정해주세요.</system:String>
<system:String x:Key="ResolutionAcquisitionFailure">시뮬레이터 해상도를 가져올 수 없습니다. 시뮬레이터와 ADB를 재시작하거나 컴퓨터를 재부팅하거나 시뮬레이터를 교체한 후 다시 시도하십시오.</system:String>
@@ -575,6 +576,7 @@
<system:String x:Key="RecruitTagsDetected">인식 결과:</system:String>
<system:String x:Key="ConnectFailed">연결 실패</system:String>
<system:String x:Key="TryToStartEmulator">에뮬레이터를 시작하는 중입니다</system:String>
<system:String x:Key="RestartADB">ADB 재시작을 시도 중입니다</system:String>
<system:String x:Key="CheckSettings">연결 설정을 확인하거나 에뮬레이터와 ADB를 다시 시작하거나 컴퓨터를 재시작해주세요.</system:String>
<!-- Current step: {0} {1} -->

View File

@@ -93,8 +93,8 @@
<system:String x:Key="RoguelikeUseSupportUnit">“开局干员”使用助战</system:String>
<system:String x:Key="RoguelikeUseNonFriendSupport">可以使用非好友助战</system:String>
<system:String x:Key="DeploymentWithPause">暂停下干员(同时影响肉鸽、自动战斗、保全)(不稳定,暂不推荐开启)</system:String>
<system:String x:Key="AdbLiteEnabled">使用 Adb Lite实验性功能</system:String>
<system:String x:Key="KillAdbOnExit">退出时释放 Adb</system:String>
<system:String x:Key="AdbLiteEnabled">使用 ADB Lite实验性功能</system:String>
<system:String x:Key="KillAdbOnExit">退出时释放 ADB</system:String>
<system:String x:Key="DefaultSquad">默认分队</system:String>
<system:String x:Key="IS2NewSquad1">心胜于物分队</system:String>
@@ -133,7 +133,7 @@
<system:String x:Key="Switchable">可切换</system:String>
<system:String x:Key="Executable">可执行文件</system:String>
<system:String x:Key="ADBProgram">adb程序</system:String>
<system:String x:Key="ADBProgram">ADB程序</system:String>
<system:String x:Key="EmulatorException">检测模拟器出错\n请使用管理员权限打开本软件\n或手动设置连接</system:String>
<system:String x:Key="AdbException">检测ADB出错\n请使用管理员权限打开本软件\n或手动设置连接</system:String>
@@ -222,7 +222,7 @@
<system:String x:Key="TouchMode">触控模式</system:String>
<system:String x:Key="MiniTouchMode">Minitouch默认</system:String>
<system:String x:Key="MaaTouchMode">MaaTouch实验功能</system:String>
<system:String x:Key="AdbTouchMode">Adb Input兼容模式</system:String>
<system:String x:Key="AdbTouchMode">ADB Input兼容模式</system:String>
<system:String x:Key="AdditionCommand">附加命令</system:String>
<system:String x:Key="StartsWithScript">开始前脚本</system:String>
<system:String x:Key="EndsWithScript">结束后脚本</system:String>
@@ -265,17 +265,18 @@
<system:String x:Key="CustomInfrastPlanShowInFightSettings">显示基建计划</system:String>
<system:String x:Key="MainViewButtonFeature">主界面可选择按钮功能</system:String>
<system:String x:Key="CustomStageCode">手动输入关卡名</system:String>
<system:String x:Key="CustomStageCodeTip" xml:space="preserve">支持大部分主线关卡名与原列表的关卡名如4-10、AP-5、H10-1-Hard&#x0a;可在关卡结尾输入"Normal/Hard"表示需要切换标准与磨难难度</system:String>
<system:String x:Key="CustomStageCodeTip" xml:space="preserve">支持大部分主线关卡名与原列表的关卡名如4-10、AP-5、H10-1-Hard&#x0a;可在关卡结尾输入&quot;Normal/Hard&quot;表示需要切换标准与磨难难度</system:String>
<system:String x:Key="AutoDetectConnection">自动检测连接</system:String>
<system:String x:Key="AutoDetectConnectionTip">每次检测完成后会自动取消勾选,若需要重新检测可再次勾选,若反复连接失败可勾选始终自动检测连接</system:String>
<system:String x:Key="AlwaysAutoDetectConnection">每次重新检测</system:String>
<system:String x:Key="ADBPath">adb 路径 (相对/绝对)</system:String>
<system:String x:Key="ADBPath">ADB 路径 (相对/绝对)</system:String>
<system:String x:Key="ConnectionAddress">连接地址</system:String>
<system:String x:Key="ConnectionAddressTip">若遇到问题可尝试手动修改</system:String>
<system:String x:Key="ConnectionPreset">连接配置</system:String>
<system:String x:Key="RetryOnDisconnected">adb 重连失败时自动重启模拟器</system:String>
<system:String x:Key="RetryOnDisconnected">ADB 重连失败时自动重启模拟器</system:String>
<system:String x:Key="RetryOnDisconnectedTip">重连失败 20 次后尝试重启模拟器,使用后台定时任务且设置任务完成关闭模拟器时请勾选</system:String>
<system:String x:Key="AllowADBRestart">连接失败后尝试重启 ADB</system:String>
<!-- 设置 -->
<!-- 一键长草 -->
@@ -508,7 +509,7 @@
<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="AdbDownloadFailedDesc">请手动进行操作(将 adb.exe 重命名后替换上方模拟器自带 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>
<system:String x:Key="FailedToReplaceAdbAndUseLocalDesc">已临时使用本地 ADB 进行连接</system:String>
@@ -584,6 +585,7 @@
<system:String x:Key="RecruitTagsDetected">识别结果:</system:String>
<system:String x:Key="ConnectFailed">连接失败</system:String>
<system:String x:Key="TryToStartEmulator">正在尝试启动模拟器</system:String>
<system:String x:Key="RestartADB">正在尝试重启 ADB</system:String>
<system:String x:Key="CheckSettings">请检查连接设置或尝试重启模拟器与 ADB 或重启电脑</system:String>
<!-- AsstProxy -->

View File

@@ -93,8 +93,8 @@
<system:String x:Key="RoguelikeUseSupportUnit">開局幹員使用助戰</system:String>
<system:String x:Key="RoguelikeUseNonFriendSupport">可以使用非好友助戰</system:String>
<system:String x:Key="DeploymentWithPause">暫停下幹員(同時影響肉鴿、自動戰鬥、保全)(不穩定,暫不推薦開啟)</system:String>
<system:String x:Key="AdbLiteEnabled">使用 Adb Lite實驗性功能</system:String>
<system:String x:Key="KillAdbOnExit">退出時釋放 Adb</system:String>
<system:String x:Key="AdbLiteEnabled">使用 ADB Lite實驗性功能</system:String>
<system:String x:Key="KillAdbOnExit">退出時釋放 ADB</system:String>
<system:String x:Key="DefaultSquad">默認分隊</system:String>
<system:String x:Key="IS2NewSquad1">心勝於物分隊</system:String>
@@ -133,7 +133,7 @@
<system:String x:Key="Switchable">可切換</system:String>
<system:String x:Key="Executable">可執行檔</system:String>
<system:String x:Key="ADBProgram">adb程式</system:String>
<system:String x:Key="ADBProgram">ADB程式</system:String>
<system:String x:Key="EmulatorException">檢測模擬器出錯\n請使用管理員許可權打開本軟體\n或手動設定連接</system:String>
<system:String x:Key="AdbException">檢測ADB出錯\n請使用管理員權限打開本軟件\n或手動設置連接</system:String>
@@ -216,7 +216,7 @@
<system:String x:Key="TouchMode">觸控模式</system:String>
<system:String x:Key="MiniTouchMode">Minitouch默認</system:String>
<system:String x:Key="MaaTouchMode">MaaTouch實驗功能</system:String>
<system:String x:Key="AdbTouchMode">Adb Input兼容模式</system:String>
<system:String x:Key="AdbTouchMode">ADB Input兼容模式</system:String>
<system:String x:Key="AdditionCommand">附加命令</system:String>
<system:String x:Key="StartsWithScript">開始前腳本</system:String>
<system:String x:Key="EndsWithScript">結束後腳本</system:String>
@@ -259,17 +259,18 @@
<system:String x:Key="CustomInfrastPlanShowInFightSettings">顯示基建計劃</system:String>
<system:String x:Key="MainViewButtonFeature">主介面可選擇按鈕功能</system:String>
<system:String x:Key="CustomStageCode">手動輸入關卡代名</system:String>
<system:String x:Key="CustomStageCodeTip" xml:space="preserve">支持大部分主線關卡名與原列表的關卡名如4-10、AP-5、H10-1-Hard&#x0a;可在關卡結尾輸入"Normal/Hard"表示需要切換標準與磨難難度</system:String>
<system:String x:Key="CustomStageCodeTip" xml:space="preserve">支持大部分主線關卡名與原列表的關卡名如4-10、AP-5、H10-1-Hard&#x0a;可在關卡結尾輸入&quot;Normal/Hard&quot;表示需要切換標準與磨難難度</system:String>
<system:String x:Key="AutoDetectConnection">自動檢測連接</system:String>
<system:String x:Key="AutoDetectConnectionTip">每次檢測完成後會自動取消勾選,若需要重新檢測可再次勾選</system:String>
<system:String x:Key="AlwaysAutoDetectConnection">每次重新檢測</system:String>
<system:String x:Key="ADBPath">adb 路徑 (相對/絕對)</system:String>
<system:String x:Key="ADBPath">ADB 路徑 (相對/絕對)</system:String>
<system:String x:Key="ConnectionAddress">連接地址</system:String>
<system:String x:Key="ConnectionAddressTip">若遇到問題可嘗試手動修改</system:String>
<system:String x:Key="ConnectionPreset">連接配置</system:String>
<system:String x:Key="RetryOnDisconnected">adb 重連失敗時自動重啟模擬器</system:String>
<system:String x:Key="RetryOnDisconnected">ADB 重連失敗時自動重啟模擬器</system:String>
<system:String x:Key="RetryOnDisconnectedTip">重連失敗 20 次後嘗試重啟模擬器,使用後台定時任務且設置任務完成關閉模擬器時必須勾選</system:String>
<system:String x:Key="AllowADBRestart">連接失敗後嘗試重啟 ADB</system:String>
<!-- 設定 -->
<!-- 一鍵長草 -->
@@ -501,7 +502,7 @@
<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="AdbDownloadFailedDesc">請手動進行操作(將 adb.exe 重命名後替換上方模擬器自帶 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>
<system:String x:Key="FailedToReplaceAdbAndUseLocalDesc">已臨時使用本地 ADB 進行連接</system:String>
@@ -577,6 +578,7 @@
<system:String x:Key="RecruitTagsDetected">辨識結果:</system:String>
<system:String x:Key="ConnectFailed">連接失敗</system:String>
<system:String x:Key="TryToStartEmulator">正在嘗試啟動模擬器</system:String>
<system:String x:Key="RestartADB">正在嘗試重啟 ADB</system:String>
<system:String x:Key="CheckSettings">請檢查連接設置或嘗試重啟模擬器與 ADB 或重啟電腦</system:String>
<!-- About -->

View File

@@ -730,6 +730,44 @@ namespace MaaWpfGui.ViewModels.UI
Instances.TaskQueueViewModel.Idle = idle;
}
/// <summary>
/// Restarts the ADB (Android Debug Bridge).
/// </summary>
public void RestartADB()
{
if (!AllowADBRestart)
{
return;
}
string adbPath = AdbPath;
if (string.IsNullOrEmpty(adbPath))
{
return;
}
ProcessStartInfo processStartInfo = new ProcessStartInfo
{
FileName = "cmd.exe",
RedirectStandardInput = true,
RedirectStandardOutput = true,
CreateNoWindow = true,
UseShellExecute = false,
};
Process process = new Process
{
StartInfo = processStartInfo,
};
process.Start();
process.StandardInput.WriteLine($"{adbPath} kill-server");
process.StandardInput.WriteLine($"{adbPath} start-server");
process.StandardInput.WriteLine("exit");
process.WaitForExit();
}
/// <summary>
/// Selects the emulator to execute.
/// </summary>
@@ -2140,6 +2178,21 @@ namespace MaaWpfGui.ViewModels.UI
}
}
private bool _allowADBRestart = Convert.ToBoolean(ConfigurationHelper.GetValue(ConfigurationKeys.AllowADBRestart, bool.TrueString));
/// <summary>
/// Gets or sets a value indicating whether to retry task after adb disconnected.
/// </summary>
public bool AllowADBRestart
{
get => _allowADBRestart;
set
{
SetAndNotify(ref _allowADBRestart, value);
ConfigurationHelper.SetValue(ConfigurationKeys.AllowADBRestart, value.ToString());
}
}
private bool _deploymentWithPause = bool.Parse(ConfigurationHelper.GetValue(ConfigurationKeys.RoguelikeDeploymentWithPause, false.ToString()));
public bool DeploymentWithPause

View File

@@ -205,7 +205,7 @@ namespace MaaWpfGui.ViewModels.UI
UpdateStageList(false);
// 随机延迟,防止同时更新
var delayTime = new Random().Next(0, 10 * 60 * 1000);
var delayTime = new Random().Next(10, 10 * 60 * 1000);
_ = Task.Run(async () =>
{
await Task.Delay(delayTime);
@@ -367,6 +367,7 @@ namespace MaaWpfGui.ViewModels.UI
var stage1 = Stage1 ??= string.Empty;
var stage2 = Stage2 ??= string.Empty;
var stage3 = Stage3 ??= string.Empty;
var rss = RemainingSanityStage ??= string.Empty;
EnableSetFightParams = false;
@@ -381,32 +382,29 @@ namespace MaaWpfGui.ViewModels.UI
AlternateStageList = new ObservableCollection<CombinedData>(_stageManager.GetStageList());
RemainingSanityStageList = new ObservableCollection<CombinedData>(_stageManager.GetStageList())
{
[0] = new CombinedData { Display = LocalizationHelper.GetString("NoUse"), Value = string.Empty },
};
// reset closed stages to "Last/Current"
if (!CustomStageCode)
{
Stage1 = StageList.Any(x => x.Value == stage1) ? stage1 : string.Empty;
Stage2 = AlternateStageList.Any(x => x.Value == stage2) ? stage2 : string.Empty;
Stage3 = AlternateStageList.Any(x => x.Value == stage3) ? stage3 : string.Empty;
RemainingSanityStage = RemainingSanityStageList.Any(x => x.Value == rss) ? rss : string.Empty;
}
else
{
Stage1 = stage1;
Stage2 = stage2;
Stage3 = stage3;
RemainingSanityStage = rss;
}
EnableSetFightParams = true;
}
var rss = RemainingSanityStage ??= string.Empty;
RemainingSanityStageList = new ObservableCollection<CombinedData>(_stageManager.GetStageList())
{
[0] = new CombinedData { Display = LocalizationHelper.GetString("NoUse"), Value = string.Empty },
};
if (!CustomStageCode)
{
RemainingSanityStage = RemainingSanityStageList.Any(x => x.Value == rss) ? rss : string.Empty;
}
}
private bool NeedToUpdateDatePrompt()
@@ -693,7 +691,6 @@ namespace MaaWpfGui.ViewModels.UI
if (!connected)
{
AddLog(errMsg, UiLogColor.Error);
AddLog(LocalizationHelper.GetString("ConnectFailed") + "\n" + LocalizationHelper.GetString("TryToStartEmulator"));
await Task.Run(() => Instances.SettingsViewModel.TryToStartEmulator(true));
@@ -704,13 +701,28 @@ namespace MaaWpfGui.ViewModels.UI
}
connected = await Task.Run(() => Instances.AsstProxy.AsstConnect(ref errMsg));
if (!connected)
}
if (!connected)
{
AddLog(LocalizationHelper.GetString("ConnectFailed") + "\n" + LocalizationHelper.GetString("RestartADB"));
await Task.Run(() => Instances.SettingsViewModel.RestartADB());
if (Stopping)
{
AddLog(errMsg, UiLogColor.Error);
Idle = true;
SetStopped();
return;
}
connected = await Task.Run(() => Instances.AsstProxy.AsstConnect(ref errMsg));
}
if (!connected)
{
AddLog(errMsg, UiLogColor.Error);
Idle = true;
SetStopped();
return;
}
// 一般是点了“停止”按钮了
@@ -1837,7 +1849,7 @@ namespace MaaWpfGui.ViewModels.UI
if (CustomStageCode)
{
// 从后往前删
if (_stage1.Length != 3)
if (_stage1?.Length != 3 && value != null)
{
value = ToUpperAndCheckStage(value);
}
@@ -1867,7 +1879,7 @@ namespace MaaWpfGui.ViewModels.UI
if (CustomStageCode)
{
if (_stage2.Length != 3)
if (_stage2?.Length != 3 && value != null)
{
value = ToUpperAndCheckStage(value);
}
@@ -1897,7 +1909,7 @@ namespace MaaWpfGui.ViewModels.UI
if (CustomStageCode)
{
if (_stage3.Length != 3)
if (_stage3?.Length != 3 && value != null)
{
value = ToUpperAndCheckStage(value);
}
@@ -1961,7 +1973,7 @@ namespace MaaWpfGui.ViewModels.UI
if (CustomStageCode)
{
if (_remainingSanityStage.Length != 3)
if (_remainingSanityStage?.Length != 3 && value != null)
{
value = ToUpperAndCheckStage(value);
}

View File

@@ -151,6 +151,10 @@
Content="{DynamicResource RetryOnDisconnected}"
IsChecked="{Binding RetryOnDisconnected}"
ToolTip="{DynamicResource RetryOnDisconnectedTip}" />
<CheckBox
Margin="20,10"
Content="{DynamicResource AllowADBRestart}"
IsChecked="{Binding AllowADBRestart}" />
<CheckBox
Margin="20,10"
Content="{DynamicResource AutoRestartOption}"

View File

@@ -17,72 +17,89 @@ server_list = [
"txwy"
]
# Get the server name from argument
try:
# server_name = "YoStarJP"
server_name = sys.argv[1]
if server_name not in server_list:
raise
except Exception:
server_name = None
while (not server_name):
print("Enter one and only one server name:",
", ".join(server_list))
t = input()
server_name = t if t in server_list else None
output_file = "missing_translate-" + server_name + ".txt"
cur_dir = os.path.dirname(os.path.abspath(__file__))
proj_dir = os.path.join(cur_dir, "../../")
output_file = os.path.join(cur_dir, output_file)
# File name of the json
# NOTE: You may change this to e.g. recruitment.json
# This is hardcoded because tasks.json is the most likely modified one
json_name = "tasks.json"
def find_missing_translations(server_name):
zh_json_file = os.path.join(proj_dir, "resource/", json_name)
gl_json_file = os.path.join(proj_dir, "resource/global/",
server_name, "resource/", json_name)
output_file = "missing_translate-" + server_name + ".txt"
output_file = os.path.join(cur_dir, output_file)
# For test purpose
# gl_json_file = os.path.join(cur_dir, "test.json")
# File name of the json
# NOTE: You may change this to e.g. recruitment.json
# This is hardcoded because tasks.json is the most likely modified one
json_name = "tasks.json"
with open(zh_json_file, 'r', encoding='utf-8') as zh_fh:
zh_json: dict = json.load(zh_fh)
zh_json_file = os.path.join(proj_dir, "resource/", json_name)
gl_json_file = os.path.join(proj_dir, "resource/global/",
server_name, "resource/", json_name)
with open(gl_json_file, 'r', encoding='utf-8') as gl_fh:
gl_json: dict = json.load(gl_fh)
# For test purpose
# gl_json_file = os.path.join(cur_dir, "test.json")
# def getBaseTask(task: dict) -> dict:
# try:
# base_task = zh_json[task["base_task"]]
# return getBaseTask(base_task)
# except:
# return task
with open(zh_json_file, 'r', encoding='utf-8') as zh_fh:
zh_json: dict = json.load(zh_fh)
res_keys = []
for key, value in zh_json.items():
value: dict
# check if it has a "text" and if the text is empty
if value.get("text"):
# and then check if gl_json has a corresponding one
try:
_ = gl_json[key]["text"][0]
except:
if any(map(lambda x: re.search(x, key), regex_ignore_list)):
continue
# NOTE
# It is likely that Ascii texts do not need a translation but there is no guarantee.
# You may want to comment this out in some cases.
# if getBaseTask(value).get("isAscii", False) is True:
if all(map(str.isascii, value["text"])):
continue
with open(gl_json_file, 'r', encoding='utf-8') as gl_fh:
gl_json: dict = json.load(gl_fh)
res_keys.append(key + ': ' + ', '.join(value["text"]))
# def getBaseTask(task: dict) -> dict:
# try:
# base_task = zh_json[task["base_task"]]
# return getBaseTask(base_task)
# except:
# return task
print(key, value["text"])
res_keys = []
for key, value in zh_json.items():
value: dict
# check if it has a "text" and if the text is empty
if value.get("text"):
# and then check if gl_json has a corresponding one
try:
_ = gl_json[key]["text"][0]
except:
if any(map(lambda x: re.search(x, key), regex_ignore_list)):
continue
# NOTE
# It is likely that Ascii texts do not need a translation but there is no guarantee.
# You may want to comment this out in some cases.
# if getBaseTask(value).get("isAscii", False) is True:
if all(map(str.isascii, value["text"])):
continue
with open(output_file, 'w', encoding='utf-8') as f:
f.write('\n'.join(res_keys))
res_keys.append(key + ': ' + ', '.join(value["text"]))
print(key, value["text"])
with open(output_file, 'w', encoding='utf-8') as f:
f.write('\n'.join(res_keys))
print("Missing translations written to", output_file)
def main():
# Get the server name from argument
# try:
# # server_name = "YoStarJP"
# server_names = sys.argv[1:]
# for server_name in server_names:
# if server_name not in server_list:
# raise Exception(f"{server_name} is not a valid server name.")
# except Exception as e:
# print(e)
# server_names = None
# while (not server_names):
# print("Enter one or more server names separated by space:",
# ", ".join(server_list))
# t = input()
# server_names = t.split() if all(name in server_list for name in t.split()) else None
server_names = sys.argv[1:]
if not server_names:
server_names = server_list
for server_name in server_names:
find_missing_translations(server_name)
if __name__ == "__main__":
main()

View File

@@ -45,54 +45,68 @@ server_list = [
"txwy"
]
# Get the server name from argument
try:
# server_name = YoStarJP
server_name = sys.argv[1]
if server_name not in server_list:
raise
except Exception:
server_name = None
while (not server_name):
print("Enter one and only one server name:",
", ".join(server_list))
t = input()
server_name = t if t in server_list else None
# Get current directory so script is run at the correct dir
cur_dir = os.path.dirname(os.path.abspath(__file__))
proj_dir = os.path.join(cur_dir, "../../")
zh_dir = os.path.join(cur_dir, "../../resource/template/")
gl_dir = os.path.join(cur_dir, "../../resource/global/",
server_name, "resource/template/")
def find_missing_templates(server_name):
zh_files = [f for f in os.listdir(
zh_dir) if os.path.isfile(os.path.join(zh_dir, f))]
gl_files = [f for f in os.listdir(
gl_dir) if os.path.isfile(os.path.join(gl_dir, f))]
zh_dir = os.path.join(proj_dir, "resource/template/")
gl_dir = os.path.join(proj_dir, "resource/global/",
server_name, "resource/template/")
with open(os.path.join(cur_dir, ignore_list_file_name)) as f:
ignore_files = [line.rstrip('\n') for line in f]
zh_files = [f for f in os.listdir(
zh_dir) if os.path.isfile(os.path.join(zh_dir, f))]
gl_files = [f for f in os.listdir(
gl_dir) if os.path.isfile(os.path.join(gl_dir, f))]
# ZH server pics not found in global server nor ignored will be filtered here
diff_files = [f for f in zh_files if
not any(map(lambda x: re.search(x, f), regex_ignore_list)) and
f not in gl_files and
f not in ignore_files
]
with open(os.path.join(cur_dir, ignore_list_file_name)) as f:
ignore_files = [line.rstrip('\n') for line in f]
# These pictures will be copied to the missing_templates folder for reference.
# Contributors of global servers may screenshot the corresponding files.
# Note this folder is in .gitignore so it will not be uploaded.
out_dir = os.path.join(cur_dir, "missing_templates/", server_name)
if os.path.exists(out_dir):
shutil.rmtree(out_dir)
os.makedirs(out_dir)
# ZH server pics not found in global server nor ignored will be filtered here
diff_files = [f for f in zh_files if
not any(map(lambda x: re.search(x, f), regex_ignore_list)) and
f not in gl_files and
f not in ignore_files
]
for f in diff_files:
# print(f)
shutil.copyfile(os.path.join(zh_dir, f), os.path.join(out_dir, f))
# These pictures will be copied to the missing_templates folder for reference.
# Contributors of global servers may screenshot the corresponding files.
# Note this folder is in .gitignore so it will not be uploaded.
out_dir = os.path.join(cur_dir, "missing_templates/", server_name)
if os.path.exists(out_dir):
shutil.rmtree(out_dir)
os.makedirs(out_dir)
print("Pictures not included in", server_name,
"server resources is copied to missing_templates/" + server_name)
for f in diff_files:
# print(f)
shutil.copyfile(os.path.join(zh_dir, f), os.path.join(out_dir, f))
print("Pictures not included in", server_name,
"server resources is copied to missing_templates/" + server_name)
def main():
# Get the server name from argument
# try:
# # server_name = "YoStarJP"
# server_names = sys.argv[1:]
# for server_name in server_names:
# if server_name not in server_list:
# raise Exception(f"{server_name} is not a valid server name.")
# except Exception as e:
# print(e)
# server_names = None
# while (not server_names):
# print("Enter one or more server names separated by space:",
# ", ".join(server_list))
# t = input()
# server_names = t.split() if all(name in server_list for name in t.split()) else None
server_names = sys.argv[1:]
if not server_names:
server_names = server_list
for server_name in server_names:
find_missing_templates(server_name)
if __name__ == "__main__":
main()