Commit 10141262 authored by 神楽坂玲奈's avatar 神楽坂玲奈

Merge branch 'v3' of github.com:mycard/mycard into v3

parents 2e4df7f6 97fd7c71
...@@ -66,7 +66,7 @@ ...@@ -66,7 +66,7 @@
<td *ngIf="!mod.isInstalled()"> <td *ngIf="!mod.isInstalled()">
<button i18n (click)="installMod(mod)" type="button" *ngIf="!mod.isInstalled()" class="btn btn-primary btn-sm">安装</button> <button i18n (click)="installMod(mod)" type="button" *ngIf="!mod.isInstalled()" class="btn btn-primary btn-sm">安装</button>
</td> </td>
<td *ngIf="mod.isInstalled()&&!mod.isReady()">: <td *ngIf="mod.isInstalled()&&!mod.isReady()">
<progress class="progress progress-striped progress-animated" value="{{mod.status.progress}}" max="{{mod.status.total}}"></progress> <progress class="progress progress-striped progress-animated" value="{{mod.status.progress}}" max="{{mod.status.total}}"></progress>
<!--<div i18n *ngIf="mod.isWaiting()">等待安装...</div>--> <!--<div i18n *ngIf="mod.isWaiting()">等待安装...</div>-->
</td> </td>
......
...@@ -145,8 +145,18 @@ export class AppDetailComponent implements OnInit { ...@@ -145,8 +145,18 @@ export class AppDetailComponent implements OnInit {
this.appsService.runApp(app, 'custom'); this.appsService.runApp(app, 'custom');
} }
verifyFiles(app: App) { async verifyFiles(app: App) {
this.appsService.verifyFiles(app); try {
await this.appsService.update(app, true);
let installedMods = this.appsService.findChildren(app).filter((child) => {
return child.parent === app && child.isInstalled() && child.isReady();
});
for (let mod of installedMods) {
await this.appsService.update(mod, true);
}
} catch (e) {
console.log(e);
}
} }
copy(text: string) { copy(text: string) {
......
This diff is collapsed.
...@@ -112,6 +112,7 @@ export class DownloadService { ...@@ -112,6 +112,7 @@ export class DownloadService {
let activeList = await this.aria2.tellActive(); let activeList = await this.aria2.tellActive();
let waitList = await this.aria2.tellWaiting(0, MAX_LIST_NUM); let waitList = await this.aria2.tellWaiting(0, MAX_LIST_NUM);
let stoppedList = await this.aria2.tellStopped(0, MAX_LIST_NUM); let stoppedList = await this.aria2.tellStopped(0, MAX_LIST_NUM);
this.downloadList.clear();
for (let item of activeList) { for (let item of activeList) {
this.downloadList.set(item.gid, new DownloadStatus(item)); this.downloadList.set(item.gid, new DownloadStatus(item));
} }
...@@ -142,14 +143,16 @@ export class DownloadService { ...@@ -142,14 +143,16 @@ export class DownloadService {
let gids = this.taskMap.get(id); let gids = this.taskMap.get(id);
if (gids) { if (gids) {
let allStatus: DownloadStatus; let allStatus: DownloadStatus;
this.updateEmitter.subscribe(() => { let subscription = this.updateEmitter.subscribe(() => {
try {
let status: DownloadStatus = new DownloadStatus(); let status: DownloadStatus = new DownloadStatus();
// 合并每个状态信息 // 合并每个状态信息
status = status =
gids!.map((value, index, array) => { gids!.map((value, index, array) => {
let s = this.downloadList.get(value); let s = this.downloadList.get(value);
if (!s) { if (!s) {
throw new Error("Gid not Exists"); throw "Gid not exists";
} }
return s; return s;
}) })
...@@ -164,12 +167,18 @@ export class DownloadService { ...@@ -164,12 +167,18 @@ export class DownloadService {
} }
} }
if (allStatus.status === "error") { if (allStatus.status === "error") {
reject(`Download Error: code ${allStatus.errorCode}, message: ${allStatus.errorMessage}`); throw `Download Error: code ${allStatus.errorCode}, message: ${allStatus.errorMessage}`;
} else if (allStatus.status === "complete") { } else if (allStatus.status === "complete") {
resolve(); resolve();
subscription.unsubscribe();
} else { } else {
callback(allStatus); callback(allStatus);
} }
} catch (e) {
reject(e);
subscription.unsubscribe();
}
}); });
} else { } else {
throw "Try to access invalid download id"; throw "Try to access invalid download id";
......
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