Commit 0d4ace01 authored by nanahira's avatar nanahira

v3 changes by mercury

parent ebcd1dbe
Pipeline #15001 failed with stages
in 9 minutes and 54 seconds
......@@ -29,6 +29,8 @@
<span i18n *ngIf="currentApp.isUninstalling()">正在卸载...</span>
<span i18n *ngIf="currentApp.isWaiting()">等待安装...</span>
<span i18n *ngIf="currentApp.isUpdating()">正在更新...</span>
<span i18n *ngIf="currentApp.isGettingFileList()">正在获取文件列表...</span>
<span i18n *ngIf="currentApp.isVerifying()">正在校验...</span>
<span *ngIf="currentApp.status.total">{{(currentApp.status.progress/currentApp.status.total * 100).toFixed()}}%</span>
<span>{{currentApp.progressMessage()}}</span>
</div>
......
......@@ -502,13 +502,14 @@ export class AppsService {
readyToUpdate = app.isReady() && mods.every((mod) => mod.isReady());
}
if (readyToUpdate && (verify || app.local!.version !== app.version)) {
app.status.status = 'updating';
app.status.status = 'gettingFileList';
try {
Logger.info('Checking updating: ', app);
let latestFiles = await this.getChecksumFile(app);
let localFiles: Map<string, string> | undefined;
if (verify) {
// 刷新进度条
app.status.status = 'verifying';
let interval = setInterval(() => {}, 500);
app.status.total = latestFiles.size;
await new Promise((resolve, reject) => {
......@@ -527,6 +528,7 @@ export class AppsService {
} else {
localFiles = app.local!.files;
}
app.status.status = 'updating';
let addedFiles: Set<string> = new Set<string>();
let changedFiles: Set<string> = new Set<string>();
let deletedFiles: Set<string> = new Set<string>();
......
......@@ -21,7 +21,7 @@ export class DownloadStatus {
if (item) {
this.completedLength = parseInt(item.completedLength) || 0;
this.downloadSpeed = parseInt(item.downloadSpeed) || 0;
this.totalLength = parseInt(item.totalLength) || 0;
this.totalLength = parseInt(item.totalLength) || parseInt(item.files[0].length) || 0;
this.gid = item.gid;
this.status = item.status;
this.errorCode = item.errorCode;
......@@ -61,10 +61,10 @@ export class DownloadStatus {
status.errorCode = o.errorCode;
status.errorMessage = o.errorMessage;
}
status.downloadSpeed += o.downloadSpeed;
status.totalLength += o.totalLength;
status.completedLength += o.completedLength;
}
status.downloadSpeed += o.downloadSpeed;
status.totalLength += o.totalLength;
status.completedLength += o.completedLength;
}
return status;
}
......
......@@ -192,6 +192,14 @@ export class App {
return this.status.status === 'updating';
}
isGettingFileList(): boolean {
return this.status.status === 'gettingFileList';
}
isVerifying(): boolean {
return this.status.status === 'verifying';
}
runnable(): boolean {
return [Category.game].includes(this.category);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment