Commit 51141dfe authored by 神楽坂玲奈's avatar 神楽坂玲奈

ygopro update

parent 63f153b0
......@@ -12,6 +12,7 @@
<span i18n *ngIf="currentApp.isInstalling()">正在安装...</span>
<span i18n *ngIf="currentApp.isUninstalling()">正在卸载...</span>
<span i18n *ngIf="currentApp.isWaiting()">等待安装...</span>
<span i18n *ngIf="currentApp.isUpdating()">正在更新...</span>
<span *ngIf="currentApp.status.total">{{(currentApp.status.progress/currentApp.status.total * 100).toFixed()}}%</span>
<span>{{currentApp.progressMessage()}}</span>
</div>
......
......@@ -114,6 +114,9 @@ export class App {
isUninstalling(): boolean {
return this.status.status === "uninstalling";
}
isUpdating(): boolean {
return this.status.status === "updating";
}
runnable(): boolean {
return [Category.game].includes(this.category);
......
......@@ -4,6 +4,7 @@ import * as crypto from "crypto";
import {App, AppStatus, Action} from "./app";
import {SettingsService} from "./settings.sevices";
import * as fs from "fs";
import {createReadStream, createWriteStream} from "fs";
import * as path from "path";
import * as child_process from "child_process";
import {ChildProcess} from "child_process";
......@@ -19,8 +20,6 @@ import {Observable, Observer} from "rxjs/Rx";
import Timer = NodeJS.Timer;
// import mkdirp = require("mkdirp");
import ReadableStream = NodeJS.ReadableStream;
import {createReadStream} from "fs";
import {createWriteStream} from "fs";
const Aria2 = require('aria2');
const sudo = require('electron-sudo');
......@@ -506,7 +505,13 @@ export class AppsService {
if (changedFiles && changedFiles.size > 0) {
Logger.info("Update changed files: ", changedFiles);
let updateUrl = updateServer + app.id;
if (app.id === "ygopro" || app.id === "desmume") {
if (app.id === "ygopro") {
let locale = this.settingsService.getLocale();
if (!['zh-CN', 'en-US', 'ja-JP'].includes(locale)) {
locale = 'en-US';
}
updateUrl = updateUrl + '-' + process.platform + '-' + locale;
} else if (app.id === "desmume") {
updateUrl = updateUrl + '-' + process.platform;
}
let metalink = await this.http.post(updateUrl, changedFiles).map((response) => response.text()).toPromise();
......@@ -559,9 +564,12 @@ export class AppsService {
const addDownloadTask = async(app: App, dir: string): Promise<{app: App, files: string[]} > => {
let metalinkUrl = app.download;
if (app.id === "ygopro") {
metalinkUrl = "https://thief.mycard.moe/metalinks/ygopro-" + process.platform + ".meta4";
let locale = this.settingsService.getLocale();
if (!['zh-CN', 'en-US', 'ja-JP'].includes(locale)) {
locale = 'en-US';
}
if (app.id === "desmume") {
metalinkUrl = "https://thief.mycard.moe/metalinks/ygopro-" + process.platform + '-' + locale + ".meta4";
} else if (app.id === "desmume") {
metalinkUrl = "https://thief.mycard.moe/metalinks/desmume-" + process.platform + ".meta4";
}
app.status.status = "downloading";
......@@ -1047,9 +1055,17 @@ export class AppsService {
async getChecksumFile(app: App): Promise<Map<string,string> > {
let checksumUrl = this.checksumURL + app.id;
if (["ygopro", 'desmume'].includes(app.id)) {
if (app.id === "ygopro") {
let locale = this.settingsService.getLocale();
if (!['zh-CN', 'en-US', 'ja-JP'].includes(locale)) {
locale = 'en-US';
}
checksumUrl = this.checksumURL + app.id + "-" + process.platform + '-' + locale;
} else if (app.id === "desmume") {
checksumUrl = this.checksumURL + app.id + "-" + process.platform;
}
return this.http.get(checksumUrl)
.map((response) => {
let map = new Map<string,string>();
......
......@@ -2026,10 +2026,8 @@
},
"references": {
"win32": [
"ygopro-lang-en-US"
],
"darwin": [
"ygopro-lang-en-US"
]
},
"author": "Fluorohydride",
......@@ -2056,8 +2054,8 @@
}
},
"version": {
"win32": "1.033.C-9",
"darwin": "1.033.C-9"
"win32": "1.033.C-15",
"darwin": "1.033.C-15"
},
"news": {
"zh-CN": [
......@@ -2085,54 +2083,6 @@
},
"conference": "ygopro_china_north"
},
{
"id": "ygopro-lang-en-US",
"description": {
"zh-CN": "fxt desc"
},
"category": "module",
"parent": "ygopro",
"tags": [
"language"
],
"dependencies": {
"win32": [
"ygopro"
],
"darwin": [
"ygopro"
]
},
"references": {
"win32": [],
"darwin": []
},
"author": "ZUN",
"homepage": "http://www.myacg.cc",
"locales": [
"en-US"
],
"actions": {
"win32": {
"main": {
"execute": "ygopro.exe",
"args": [],
"env": {}
}
},
"darwin": {
"main": {
"execute": "ygopro.app/Contents/MacOS/ygopro",
"args": [],
"env": {}
}
}
},
"version": {
"win32": "1.033.C-9",
"darwin": "1.033.C-9"
}
},
{
"id": "desmume",
"name": {
......
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