mirror of
https://github.com/an-anime-team/an-anime-game-launcher.git
synced 2024-12-29 21:18:17 +03:00
Add Downloading of mismatched files
Add Locales
This commit is contained in:
parent
e47dd445a5
commit
7327231c04
11 changed files with 79 additions and 6 deletions
|
@ -25,6 +25,8 @@ launcher:
|
|||
unpacking: Spiel wird entpackt...
|
||||
applying_changes: Änderungen werden angewandt...
|
||||
deleting_outdated: Lösche veraltete dateien...
|
||||
integrity_check: Verifiziere Dateien...
|
||||
download_mismatch_files: Lade nicht übereinstimmenden Dateien herunter...
|
||||
|
||||
# Voice packages installation
|
||||
voice:
|
||||
|
@ -70,6 +72,7 @@ launcher:
|
|||
ready:
|
||||
launch: Starten
|
||||
predownload: Update vorinstallieren
|
||||
integrity: Dateien verifizieren und reparieren
|
||||
|
||||
# Einstellungs Fenster
|
||||
settings:
|
||||
|
|
|
@ -25,6 +25,8 @@ launcher:
|
|||
unpacking: Unpacking game...
|
||||
applying_changes: Applying changes...
|
||||
deleting_outdated: Deleting outdated files...
|
||||
integrity_check: Verifying Files...
|
||||
download_mismatch_files: Downloading mismatched files...
|
||||
|
||||
# Voice packages installation
|
||||
voice:
|
||||
|
@ -70,6 +72,7 @@ launcher:
|
|||
ready:
|
||||
launch: Launch
|
||||
predownload: Pre-download update
|
||||
integrity: Verify Files & Repair
|
||||
|
||||
# Settings window
|
||||
settings:
|
||||
|
|
|
@ -25,6 +25,8 @@ launcher:
|
|||
unpacking: Descomprimiendo el juego...
|
||||
applying_changes: Applying changes...
|
||||
deleting_outdated: Borrando archivos viejos...
|
||||
integrity_check: Verifying Files...
|
||||
download_mismatch_files: Downloading mismatched files...
|
||||
|
||||
# Instalación de paquetes de voz
|
||||
voice:
|
||||
|
@ -70,6 +72,7 @@ launcher:
|
|||
ready:
|
||||
launch: Jugar
|
||||
predownload: Pre-descargar actualización
|
||||
integrity: Verify Files & Repair
|
||||
|
||||
# Ventana de opciones
|
||||
settings:
|
||||
|
|
|
@ -25,6 +25,8 @@ launcher:
|
|||
unpacking: Décompression du jeu...
|
||||
applying_changes: Application des changements...
|
||||
deleting_outdated: Suppression des fichiers non à jour...
|
||||
integrity_check: Verifying Files...
|
||||
download_mismatch_files: Downloading mismatched files...
|
||||
|
||||
# Voice packages installation
|
||||
voice:
|
||||
|
@ -73,6 +75,7 @@ launcher:
|
|||
ready:
|
||||
launch: Lancer
|
||||
predownload: Pre-téléchargement de mise à jour
|
||||
integrity: Verify Files & Repair
|
||||
|
||||
# Settings window
|
||||
settings:
|
||||
|
|
|
@ -25,6 +25,8 @@ launcher:
|
|||
unpacking: Játék kibontása folyamatban...
|
||||
applying_changes: Változások alkalmazása...
|
||||
deleting_outdated: Lejárt fájlok kitörlése...
|
||||
integrity_check: Verifying Files...
|
||||
download_mismatch_files: Downloading mismatched files...
|
||||
|
||||
# Voice packages installation
|
||||
voice:
|
||||
|
@ -70,6 +72,7 @@ launcher:
|
|||
ready:
|
||||
launch: Indítás
|
||||
predownload: Frissítés előtöltése
|
||||
integrity: Verify Files & Repair
|
||||
|
||||
# Settings window
|
||||
settings:
|
||||
|
|
|
@ -25,6 +25,8 @@ launcher:
|
|||
unpacking: Membongkar game...
|
||||
applying_changes: Applying changes...
|
||||
deleting_outdated: Menghapus file lama...
|
||||
integrity_check: Verifying Files...
|
||||
download_mismatch_files: Downloading mismatched files...
|
||||
|
||||
# Voice packages installation
|
||||
voice:
|
||||
|
@ -70,6 +72,7 @@ launcher:
|
|||
ready:
|
||||
launch: Luncurkan
|
||||
predownload: Pembaruan pra-unduh
|
||||
integrity: Verify Files & Repair
|
||||
|
||||
# Settings window
|
||||
settings:
|
||||
|
|
|
@ -25,6 +25,8 @@ launcher:
|
|||
unpacking: Decomprimendo il gioco...
|
||||
applying_changes: Applying changes...
|
||||
deleting_outdated: Cancellando file vecchi...
|
||||
integrity_check: Verifying Files...
|
||||
download_mismatch_files: Downloading mismatched files...
|
||||
|
||||
# Voice packages installation
|
||||
voice:
|
||||
|
@ -70,6 +72,7 @@ launcher:
|
|||
ready:
|
||||
launch: Avvia
|
||||
predownload: Pre-scarica aggiornamento
|
||||
integrity: Verify Files & Repair
|
||||
|
||||
# Settings window
|
||||
settings:
|
||||
|
|
|
@ -25,6 +25,8 @@ launcher:
|
|||
unpacking: Pakker ut spill...
|
||||
applying_changes: Applying changes...
|
||||
deleting_outdated: Fjerner utdaterte filer...
|
||||
integrity_check: Verifying Files...
|
||||
download_mismatch_files: Downloading mismatched files...
|
||||
|
||||
# Voice packages installation
|
||||
voice:
|
||||
|
@ -70,6 +72,7 @@ launcher:
|
|||
ready:
|
||||
launch: Start
|
||||
predownload: Forhånds-nedlast oppdatering
|
||||
integrity: Verify Files & Repair
|
||||
|
||||
# Settings window
|
||||
settings:
|
||||
|
|
|
@ -25,6 +25,8 @@ launcher:
|
|||
unpacking: Распаковка игры...
|
||||
applying_changes: Применение изменений...
|
||||
deleting_outdated: Удаление устаревших файлов...
|
||||
integrity_check: Verifying Files...
|
||||
download_mismatch_files: Downloading mismatched files...
|
||||
|
||||
# Установка звуковых пакетов
|
||||
voice:
|
||||
|
@ -70,6 +72,7 @@ launcher:
|
|||
ready:
|
||||
launch: Запустить
|
||||
predownload: Предзагрузить обновление
|
||||
integrity: Verify Files & Repair
|
||||
|
||||
# Окно настроек
|
||||
settings:
|
||||
|
|
|
@ -25,6 +25,8 @@ launcher:
|
|||
unpacking: unpacking g-game (o^▽^o)
|
||||
applying_changes: appwying changes...
|
||||
deleting_outdated: deweting outdated fiwes...
|
||||
integrity_check: vewifying fiwes...
|
||||
download_mismatch_files: downwoading mismatched fiwes...
|
||||
|
||||
# Voice packages installation
|
||||
voice:
|
||||
|
@ -70,6 +72,7 @@ launcher:
|
|||
ready:
|
||||
launch: launch (◕▿◕✿)
|
||||
predownload: pwe-downwoad update
|
||||
integrity: vewify files & wepaiw
|
||||
|
||||
# Settings window
|
||||
settings:
|
||||
|
|
|
@ -1,14 +1,43 @@
|
|||
import type Launcher from '../../Launcher';
|
||||
|
||||
import { Debug, fs, path } from '../../../empathize';
|
||||
import { Debug, fs, path, Cache, Downloader } from '../../../empathize';
|
||||
|
||||
import constants from '../../Constants';
|
||||
import Patch from "../../Patch";
|
||||
import Locales from '../Locales';
|
||||
import Voice from "../../Voice"
|
||||
import Voice from "../../Voice";
|
||||
|
||||
declare const Neutralino;
|
||||
|
||||
async function download(fileInfo): Promise<boolean>
|
||||
{
|
||||
return new Promise(async (resolve) => {
|
||||
const gameDir = await constants.paths.gameDir;
|
||||
const cache = await Cache.get('Game.getLatestData.ServerResponse');
|
||||
|
||||
let uri = `${cache!.value['game']['latest']['decompressed_path']}/${fileInfo.remoteName}`;
|
||||
|
||||
Downloader.download(uri, `${gameDir}/${fileInfo.remoteName}.new`).then((stream) => {
|
||||
stream.finish(async () => {
|
||||
const process = await Neutralino.os.execCommand(`md5sum "${path.addSlashes(`${gameDir}/${fileInfo.remoteName}.new`)}"`);
|
||||
const fileHash = (process.stdOut || process.stdErr).split(' ')[0];
|
||||
|
||||
if (fileHash == fileInfo.md5)
|
||||
{
|
||||
await fs.remove(`${gameDir}/${fileInfo.remoteName}`);
|
||||
await fs.move(`${gameDir}/${fileInfo.remoteName}.new`, `${gameDir}/${fileInfo.remoteName}`);
|
||||
resolve(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
await fs.remove(`${gameDir}/${fileInfo.remoteName}.new`);
|
||||
resolve(false);
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
export default (launcher: Launcher): Promise<void> => {
|
||||
return new Promise(async (resolve) => {
|
||||
const gameDir = await constants.paths.gameDir;
|
||||
|
@ -74,7 +103,7 @@ export default (launcher: Launcher): Promise<void> => {
|
|||
`Checked ${total} files with ${mismatchedFiles.length} mismatches` :
|
||||
[
|
||||
`Checked ${total} files with ${mismatchedFiles.length} mismatch(es):`,
|
||||
...mismatchedFiles
|
||||
...mismatchedFiles.map(e => `[${e.md5}] ${e.remoteName}`)
|
||||
]
|
||||
});
|
||||
}
|
||||
|
@ -83,10 +112,24 @@ export default (launcher: Launcher): Promise<void> => {
|
|||
|
||||
// Replace mismatched files
|
||||
|
||||
for (const file of mismatchedFiles)
|
||||
mismatchedFiles.forEach(async (fileInfo: { remoteName: string, md5: string, fileSize: number }) =>
|
||||
{
|
||||
const fileInfo = JSON.parse(file) as { remoteName: string, md5: string, fileSize: number };
|
||||
}
|
||||
launcher.progressBar?.init({
|
||||
label: Locales.translate('launcher.progress.game.download_mismatch_files') as string,
|
||||
showSpeed: false,
|
||||
showEta: false,
|
||||
showPercents: false,
|
||||
showTotals: false
|
||||
});
|
||||
|
||||
download(fileInfo).then(async (success) => {
|
||||
if (!success)
|
||||
Debug.log({
|
||||
function: 'Launcher/States/Integrity',
|
||||
message: `Download of ${fileInfo.remoteName} failed`
|
||||
});
|
||||
});
|
||||
})
|
||||
|
||||
resolve();
|
||||
})
|
||||
|
|
Loading…
Reference in a new issue