Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
M
mycard
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
syntax_j
mycard
Commits
cdcf2540
Commit
cdcf2540
authored
Oct 26, 2016
by
wudizhanche1000
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修复安装
parent
dcff19e1
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
54 additions
and
77 deletions
+54
-77
app/app-detail.component.html
app/app-detail.component.html
+5
-6
app/app-detail.component.ts
app/app-detail.component.ts
+5
-20
app/app.ts
app/app.ts
+3
-2
app/apps.component.html
app/apps.component.html
+4
-4
app/apps.service.ts
app/apps.service.ts
+35
-43
app/settings.sevices.ts
app/settings.sevices.ts
+2
-2
No files found.
app/app-detail.component.html
View file @
cdcf2540
<h1>
{{'app.' + appsService.currentApp.id + '.name' | translate}}
</h1>
<h1>
{{appsService.currentApp.name}}
</h1>
<h2>
{{appsService._aa}}
</h2>
<div
*ngIf=
"!isInstalled"
>
<div
*ngIf=
"!isInstalled"
>
<div
*ngIf=
"!appsService.getDownloadInfo(appsService.currentApp)"
>
<div
*ngIf=
"!appsService.getDownloadInfo(appsService.currentApp)"
>
<button
type=
"button"
(click)=
"updateInstallConfig()"
class=
"btn btn-primary"
data-toggle=
"modal"
<button
type=
"button"
(click)=
"updateInstallConfig()"
class=
"btn btn-primary"
data-toggle=
"modal"
...
@@ -146,9 +145,9 @@
...
@@ -146,9 +145,9 @@
</div>
</div>
<!-- Modal -->
<!-- Modal -->
<div
class=
"modal fade"
id=
"install-modal"
tabindex=
"-1"
role=
"dialog"
aria-labelledby=
"myModalLabel"
<div
class=
"modal fade"
id=
"install-modal"
tabindex=
"-1"
role=
"dialog"
aria-labelledby=
"myModalLabel"
aria-hidden=
"true"
>
aria-hidden=
"true"
*ngIf=
"installConfig"
>
<div
class=
"modal-dialog"
role=
"document"
>
<div
class=
"modal-dialog"
role=
"document"
>
<form
id=
"install-form"
class=
"modal-content"
(ngSubmit)=
"install
Submit
()"
#theForm
="
ngForm
"
>
<form
id=
"install-form"
class=
"modal-content"
(ngSubmit)=
"install()"
#theForm
="
ngForm
"
>
<div
class=
"modal-header"
>
<div
class=
"modal-header"
>
<button
type=
"button"
class=
"close"
data-dismiss=
"modal"
aria-label=
"Close"
>
<button
type=
"button"
class=
"close"
data-dismiss=
"modal"
aria-label=
"Close"
>
<span
aria-hidden=
"true"
>
×
</span>
<span
aria-hidden=
"true"
>
×
</span>
...
@@ -160,8 +159,8 @@
...
@@ -160,8 +159,8 @@
<!-- 安装位置选择只在 windows 下存在, 为了方便调试暂时不加ngif -->
<!-- 安装位置选择只在 windows 下存在, 为了方便调试暂时不加ngif -->
<h4>
{{'install_path'|translate}}
</h4>
<h4>
{{'install_path'|translate}}
</h4>
<div
class=
"form-group"
>
<div
class=
"form-group"
>
<select
class=
"form-control"
>
<select
class=
"form-control"
name=
"installPath"
[(ngModel)]=
"installConfig.installPath"
>
<option
*ngFor=
"let library of settingsService.getLibraries()"
[selected]=
"library['default']
"
>
<option
*ngFor=
"let library of settingsService.getLibraries()"
value=
"{{library['path']}}
"
>
{{ library['path']}}
{{ library['path']}}
</option>
</option>
</select>
</select>
...
...
app/app-detail.component.ts
View file @
cdcf2540
...
@@ -30,6 +30,7 @@ export class AppDetailComponent implements OnInit {
...
@@ -30,6 +30,7 @@ export class AppDetailComponent implements OnInit {
updateInstallConfig
()
{
updateInstallConfig
()
{
this
.
installConfig
=
this
.
appsService
.
getInstallConfig
(
this
.
appsService
.
currentApp
);
this
.
installConfig
=
this
.
appsService
.
getInstallConfig
(
this
.
appsService
.
currentApp
);
this
.
installConfig
.
installPath
=
this
.
settingsService
.
getDefaultLibrary
().
path
;
}
}
get
name
()
{
get
name
()
{
...
@@ -41,7 +42,7 @@ export class AppDetailComponent implements OnInit {
...
@@ -41,7 +42,7 @@ export class AppDetailComponent implements OnInit {
};
};
get
isInstalled
()
{
get
isInstalled
()
{
return
this
.
checkInstall
(
this
.
appsService
.
currentApp
);
return
this
.
checkInstall
(
this
.
appsService
.
currentApp
.
id
);
}
}
...
@@ -103,17 +104,6 @@ export class AppDetailComponent implements OnInit {
...
@@ -103,17 +104,6 @@ export class AppDetailComponent implements OnInit {
return
false
;
return
false
;
}
}
install
(
id
)
{
let
uri
=
this
.
appsService
.
searchApp
(
id
).
download
[
process
.
platform
];
$
(
'
#install-modal
'
).
modal
(
'
hide
'
);
if
(
uri
)
{
this
.
appsService
.
download
(
id
,
uri
);
}
else
{
console
.
log
(
"
lost download uri!
"
);
}
}
uninstalling
:
boolean
;
uninstalling
:
boolean
;
uninstall
(
id
:
string
)
{
uninstall
(
id
:
string
)
{
...
@@ -127,14 +117,9 @@ export class AppDetailComponent implements OnInit {
...
@@ -127,14 +117,9 @@ export class AppDetailComponent implements OnInit {
}
}
installSubmit
()
{
install
()
{
console
.
log
(
this
.
installConfig
);
$
(
'
#install-modal
'
).
modal
(
'
hide
'
);
// this.install(this.routingService.app);
this
.
appsService
.
download
();
// for (let mod in this.appsService.installConfig.mods) {
// if (this.appsService.installConfig.mods[mod]) {
// this.install(mod);
// }
// }
}
}
selectDir
()
{
selectDir
()
{
...
...
app/app.ts
View file @
cdcf2540
...
@@ -23,8 +23,8 @@ import {AppLocal} from "./app-local";
...
@@ -23,8 +23,8 @@ import {AppLocal} from "./app-local";
export
class
App
{
export
class
App
{
id
:
string
;
id
:
string
;
name
:
{[
locale
:
string
]:
string
}
;
// i18n
name
:
string
;
// i18n
description
:
{[
locale
:
string
]:
string
}
;
//i18n
description
:
string
;
//i18n
author
:
string
;
// English Only
author
:
string
;
// English Only
homepage
:
string
;
homepage
:
string
;
category
:
string
;
category
:
string
;
...
@@ -55,6 +55,7 @@ export class App {
...
@@ -55,6 +55,7 @@ export class App {
this
.
version
=
app
.
version
;
this
.
version
=
app
.
version
;
this
.
local
=
app
.
local
;
this
.
local
=
app
.
local
;
}
}
}
}
export
interface
AppInterface
extends
App
{
export
interface
AppInterface
extends
App
{
...
...
app/apps.component.html
View file @
cdcf2540
<span
*ngIf=
"grouped_apps.installed.length"
>
已安装
</span>
<span
*ngIf=
"grouped_apps.installed.length"
>
已安装
</span>
<ul
*ngIf=
"grouped_apps.installed"
class=
"nav nav-sidebar"
>
<ul
*ngIf=
"grouped_apps.installed"
class=
"nav nav-sidebar"
>
<li
*ngFor=
"let app of grouped_apps.installed"
[class.active]=
"app===appsService.currentApp"
>
<li
*ngFor=
"let app of grouped_apps.installed"
[class.active]=
"app===appsService.currentApp"
>
<a
(click)=
"chooseApp(app)"
href=
"#"
>
{{app.name
[app.locales[0]]
}}
</a>
<a
(click)=
"chooseApp(app)"
href=
"#"
>
{{app.name}}
</a>
</li>
</li>
</ul>
</ul>
<span
*ngIf=
"grouped_apps.yugioh.length"
>
游戏王
</span>
<span
*ngIf=
"grouped_apps.yugioh.length"
>
游戏王
</span>
<ul
*ngIf=
"grouped_apps.yugioh"
class=
"nav nav-sidebar"
>
<ul
*ngIf=
"grouped_apps.yugioh"
class=
"nav nav-sidebar"
>
<li
*ngFor=
"let app of grouped_apps.yugioh"
[class.active]=
"app===appsService.currentApp"
>
<li
*ngFor=
"let app of grouped_apps.yugioh"
[class.active]=
"app===appsService.currentApp"
>
<a
(click)=
"chooseApp(app)"
href=
"#"
>
{{app.name
[app.locales[0]]
}}
</a>
<a
(click)=
"chooseApp(app)"
href=
"#"
>
{{app.name}}
</a>
</li>
</li>
</ul>
</ul>
<span
*ngIf=
"grouped_apps.touhou.length"
>
东方 Project
</span>
<span
*ngIf=
"grouped_apps.touhou.length"
>
东方 Project
</span>
<ul
*ngIf=
"grouped_apps.touhou"
class=
"nav nav-sidebar"
>
<ul
*ngIf=
"grouped_apps.touhou"
class=
"nav nav-sidebar"
>
<li
*ngFor=
"let app of grouped_apps.touhou"
[class.active]=
"app===appsService.currentApp"
>
<li
*ngFor=
"let app of grouped_apps.touhou"
[class.active]=
"app===appsService.currentApp"
>
<a
(click)=
"chooseApp(app)"
href=
"#"
>
{{app.name
[app.locales[0]]
}}
</a>
<a
(click)=
"chooseApp(app)"
href=
"#"
>
{{app.name}}
</a>
</li>
</li>
</ul>
</ul>
<span
*ngIf=
"grouped_apps.touhou_pc98.length"
>
东方旧作
</span>
<span
*ngIf=
"grouped_apps.touhou_pc98.length"
>
东方旧作
</span>
<ul
*ngIf=
"grouped_apps.touhou_pc98"
class=
"nav nav-sidebar"
>
<ul
*ngIf=
"grouped_apps.touhou_pc98"
class=
"nav nav-sidebar"
>
<li
*ngFor=
"let app of grouped_apps.touhou_pc98"
[class.active]=
"app===appsService.currentApp"
>
<li
*ngFor=
"let app of grouped_apps.touhou_pc98"
[class.active]=
"app===appsService.currentApp"
>
<a
(click)=
"chooseApp(app)"
href=
"#"
>
{{app.name
[app.locales[0]]
}}
</a>
<a
(click)=
"chooseApp(app)"
href=
"#"
>
{{app.name}}
</a>
</li>
</li>
</ul>
</ul>
\ No newline at end of file
app/apps.service.ts
View file @
cdcf2540
...
@@ -19,6 +19,7 @@ const execFile = window['System']._nodeRequire('child_process').execFile;
...
@@ -19,6 +19,7 @@ const execFile = window['System']._nodeRequire('child_process').execFile;
export
class
AppsService
{
export
class
AppsService
{
installConfig
:
InstallConfig
;
private
_currentApp
:
App
;
private
_currentApp
:
App
;
get
currentApp
():
App
{
get
currentApp
():
App
{
...
@@ -29,7 +30,7 @@ export class AppsService {
...
@@ -29,7 +30,7 @@ export class AppsService {
this
.
_currentApp
=
app
;
this
.
_currentApp
=
app
;
}
}
constructor
(
private
http
:
Http
,
private
translate
:
TranslateService
,
private
settings
:
SettingsService
)
{
constructor
(
private
http
:
Http
,
private
translate
:
TranslateService
,
private
settings
Service
:
SettingsService
)
{
let
loop
=
setInterval
(()
=>
{
let
loop
=
setInterval
(()
=>
{
this
.
aria2
.
tellActive
().
then
((
res
)
=>
{
this
.
aria2
.
tellActive
().
then
((
res
)
=>
{
if
(
res
)
{
if
(
res
)
{
...
@@ -97,7 +98,7 @@ export class AppsService {
...
@@ -97,7 +98,7 @@ export class AppsService {
let
tarObj
=
{
let
tarObj
=
{
id
:
this
.
downloadsInfo
[
index
].
id
,
id
:
this
.
downloadsInfo
[
index
].
id
,
xzFile
:
res
.
files
[
0
].
path
,
xzFile
:
res
.
files
[
0
].
path
,
installDir
:
this
.
installConfig
.
install
Dir
installDir
:
this
.
installConfig
.
install
Path
};
};
let
promise
=
new
Promise
((
resolve
,
reject
)
=>
{
let
promise
=
new
Promise
((
resolve
,
reject
)
=>
{
let
refs
=
this
.
searchApp
(
this
.
downloadsInfo
[
index
].
id
).
references
;
let
refs
=
this
.
searchApp
(
this
.
downloadsInfo
[
index
].
id
).
references
;
...
@@ -186,8 +187,6 @@ export class AppsService {
...
@@ -186,8 +187,6 @@ export class AppsService {
.
map
(
response
=>
{
.
map
(
response
=>
{
let
apps
=
response
.
json
();
let
apps
=
response
.
json
();
let
localAppData
=
JSON
.
parse
(
localStorage
.
getItem
(
"
localAppData
"
));
let
localAppData
=
JSON
.
parse
(
localStorage
.
getItem
(
"
localAppData
"
));
console
.
log
(
"
app:
"
,
apps
);
console
.
log
(
"
store:
"
,
localAppData
);
apps
=
apps
.
map
((
app
)
=>
{
apps
=
apps
.
map
((
app
)
=>
{
if
(
localAppData
)
{
if
(
localAppData
)
{
localAppData
.
map
((
v
)
=>
{
localAppData
.
map
((
v
)
=>
{
...
@@ -198,12 +197,9 @@ export class AppsService {
...
@@ -198,12 +197,9 @@ export class AppsService {
}
}
return
app
;
return
app
;
});
});
return
apps
;
return
apps
;
}).
map
(
this
.
loadApps
)
}).
map
(
this
.
loadApps
)
.
subscribe
((
apps
)
=>
{
.
subscribe
((
apps
)
=>
{
console
.
log
(
apps
);
this
.
data
=
apps
;
this
.
data
=
apps
;
if
(
typeof
(
callback
)
===
'
function
'
)
{
if
(
typeof
(
callback
)
===
'
function
'
)
{
callback
();
callback
();
...
@@ -211,15 +207,34 @@ export class AppsService {
...
@@ -211,15 +207,34 @@ export class AppsService {
});
});
}
}
loadApps
(
data
:
any
):
Map
<
string
,
App
>
{
getLocalString
(
app
:
App
,
tag
:
string
):
string
{
let
locale
=
this
.
settingsService
.
getLocale
();
let
value
=
app
[
tag
][
locale
];
if
(
!
value
)
{
value
=
app
[
tag
][
"
en-US
"
];
}
return
value
;
}
loadApps
=
(
data
:
any
):
Map
<
string
,
App
>
=>
{
let
result
=
new
Map
<
string
,
App
>
();
let
result
=
new
Map
<
string
,
App
>
();
let
locale
=
this
.
settingsService
.
getLocale
();
for
(
let
item
of
data
)
{
for
(
let
item
of
data
)
{
let
id
=
item
[
"
id
"
];
let
id
=
item
[
"
id
"
];
[
'
name
'
,
'
description
'
].
forEach
((
key
,
index
)
=>
{
let
value
=
item
[
key
][
locale
];
if
(
!
value
)
{
value
=
item
[
key
][
"
en-US
"
];
}
item
[
key
]
=
value
;
});
let
app
=
new
App
(
item
);
let
app
=
new
App
(
item
);
result
.
set
(
id
,
app
);
result
.
set
(
id
,
app
);
}
}
return
result
;
return
result
;
}
}
;
searchApp
(
id
):
App
{
searchApp
(
id
):
App
{
return
this
.
data
.
get
(
id
);
return
this
.
data
.
get
(
id
);
...
@@ -273,13 +288,16 @@ export class AppsService {
...
@@ -273,13 +288,16 @@ export class AppsService {
}
}
download
(
id
,
uri
)
{
download
()
{
let
id
=
this
.
currentApp
.
id
;
if
(
this
.
downloadsInfo
.
findIndex
((
v
)
=>
{
if
(
this
.
downloadsInfo
.
findIndex
((
v
)
=>
{
return
v
.
id
==
id
return
v
.
id
==
id
})
!==
-
1
)
{
})
!==
-
1
)
{
console
.
log
(
"
this app is downloading
"
)
console
.
log
(
"
this app is downloading
"
)
}
else
{
}
else
{
this
.
aria2
.
addUri
([
uri
],
{
'
dir
'
:
this
.
download_dir
},
(
error
,
gid
)
=>
{
let
url
=
this
.
currentApp
.
download
[
process
.
platform
];
this
.
aria2
.
addUri
([
url
],
{
'
dir
'
:
this
.
download_dir
},
(
error
,
gid
)
=>
{
console
.
log
(
error
,
gid
);
if
(
error
)
{
if
(
error
)
{
console
.
error
(
error
);
console
.
error
(
error
);
}
}
...
@@ -297,11 +315,10 @@ export class AppsService {
...
@@ -297,11 +315,10 @@ export class AppsService {
return
info
;
return
info
;
}
}
installConfig
;
getInstallConfig
(
app
:
App
):
InstallConfig
{
getInstallConfig
(
app
:
App
):
InstallConfig
{
let
id
=
app
.
id
;
let
id
=
app
.
id
;
let
installConfig
=
new
InstallConfig
(
app
);
this
.
installConfig
=
new
InstallConfig
(
app
);
let
platform
=
process
.
platform
;
let
platform
=
process
.
platform
;
let
references
:
InstallConfig
[]
=
[];
let
references
:
InstallConfig
[]
=
[];
if
(
app
.
references
[
platform
])
{
if
(
app
.
references
[
platform
])
{
...
@@ -309,36 +326,10 @@ export class AppsService {
...
@@ -309,36 +326,10 @@ export class AppsService {
// references.push();
// references.push();
// });
// });
}
}
installConfig
.
references
=
references
;
this
.
installConfig
.
references
=
references
;
return
installConfig
;
return
this
.
installConfig
;
}
}
// createInstallConfig(id) {
// let app = this.data.find((app)=> {
// return app.id == id;
// });
// let platform = process.platform;
// let mods = {};
// if (app.references[platform]) {
// app.references[platform].map((mod)=> {
// mods[mod.id] = false;
// });
//
// }
//
// let tmp = {
// installDir: path.join(electron.remote.app.getPath('appData'), 'mycard'),
// shortcut: {
// desktop: false,
// application: false
// },
// mods: mods
// };
// //console.log(tmp);
// this.installConfig = tmp;
// return tmp;
//
// }
// tar
// tar
tarQueue
=
[];
tarQueue
=
[];
...
@@ -444,6 +435,7 @@ export class AppsService {
...
@@ -444,6 +435,7 @@ export class AppsService {
// 为了卸载时能重新显示安装条
// 为了卸载时能重新显示安装条
this
.
downloadsInfo
.
splice
(
downLoadsInfoIndex
,
1
);
this
.
downloadsInfo
.
splice
(
downLoadsInfoIndex
,
1
);
this
.
data
.
get
(
tarObj
.
id
).
local
=
appLocal
.
local
;
this
.
data
.
get
(
tarObj
.
id
).
local
=
appLocal
.
local
;
console
.
log
(
11111
,
this
.
data
.
get
(
tarObj
.
id
),
appLocal
);
//[{"id": "th01", "wait":["wine", "dx"], resolve: resolve, tarObj: tarObj}]
//[{"id": "th01", "wait":["wine", "dx"], resolve: resolve, tarObj: tarObj}]
this
.
waitInstallQueue
=
this
.
waitInstallQueue
.
map
((
waitObj
)
=>
{
this
.
waitInstallQueue
=
this
.
waitInstallQueue
.
map
((
waitObj
)
=>
{
...
@@ -481,7 +473,7 @@ export class AppsService {
...
@@ -481,7 +473,7 @@ export class AppsService {
return
!
0
return
!
0
}
}
browse
(
id
)
{
browse
(
app
:
App
)
{
electron
.
remote
.
shell
.
showItemInFolder
(
this
.
searchApp
(
id
)
.
local
.
path
);
electron
.
remote
.
shell
.
showItemInFolder
(
app
.
local
.
path
);
}
}
}
}
app/settings.sevices.ts
View file @
cdcf2540
...
@@ -7,7 +7,7 @@ import {Injectable} from "@angular/core";
...
@@ -7,7 +7,7 @@ import {Injectable} from "@angular/core";
export
class
SettingsService
{
export
class
SettingsService
{
static
SETTING_LIBRARY
=
"
library
"
;
static
SETTING_LIBRARY
=
"
library
"
;
libraries
:
[{
selected
:
boolean
,
path
:
string
}];
libraries
:
[{
"
default
"
:
boolean
,
path
:
string
}];
getLibraries
()
{
getLibraries
()
{
if
(
!
this
.
libraries
)
{
if
(
!
this
.
libraries
)
{
...
@@ -21,7 +21,7 @@ export class SettingsService {
...
@@ -21,7 +21,7 @@ export class SettingsService {
if
(
!
this
.
libraries
)
{
if
(
!
this
.
libraries
)
{
this
.
getLibraries
()
this
.
getLibraries
()
}
}
return
this
.
libraries
.
find
((
item
)
=>
item
.
selected
===
true
);
return
this
.
libraries
.
find
((
item
)
=>
item
.
default
===
true
);
}
}
static
SETTING_LOCALE
=
"
locale
"
;
static
SETTING_LOCALE
=
"
locale
"
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment