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
49c13820
Commit
49c13820
authored
Sep 13, 2016
by
A
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add exec app
parent
00f50907
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
61 additions
and
25 deletions
+61
-25
app/app-detail.component.html
app/app-detail.component.html
+1
-1
app/app-detail.component.ts
app/app-detail.component.ts
+45
-4
app/apps.service.ts
app/apps.service.ts
+0
-1
apps.json
apps.json
+15
-19
No files found.
app/app-detail.component.html
View file @
49c13820
...
...
@@ -16,7 +16,7 @@
</div>
</div>
<div
*ngIf=
"isInstalled"
>
<button
type=
"button"
class=
"btn btn-primary"
>
运行
</button>
<button
(click)=
"startApp(routingService.app)"
type=
"button"
class=
"btn btn-primary"
>
运行
</button>
<button
type=
"button"
class=
"btn btn-secondary"
>
设置
</button>
<button
(click)=
"openDir(routingService.app)"
type=
"button"
class=
"btn btn-secondary"
>
游览本地文件
</button>
<button
type=
"button"
class=
"btn btn-secondary"
>
联机
</button>
...
...
app/app-detail.component.ts
View file @
49c13820
...
...
@@ -14,7 +14,10 @@ declare var $;
export
class
AppDetailComponent
{
platform
=
process
.
platform
;
fs
=
window
[
'
System
'
].
_nodeRequire
(
'
fs
'
);
electron
=
window
[
'
System
'
].
_nodeRequire
(
'
electron
'
);
spawn
=
window
[
'
System
'
].
_nodeRequire
(
'
child_process
'
).
spawn
;
path
=
window
[
'
System
'
].
_nodeRequire
(
'
path
'
);
constructor
(
private
appsService
:
AppsService
,
private
routingService
:
RoutingService
)
{
}
...
...
@@ -58,7 +61,7 @@ export class AppDetailComponent {
_mods
;
get
mods
()
{
let
contains
=
[
"
optional
"
,
"
language
"
];
let
contains
=
[
"
optional
"
,
"
language
"
,
"
emulator
"
];
if
(
this
.
currentApp
)
{
if
(
this
.
currentApp
.
references
[
process
.
platform
]
&&
this
.
currentApp
.
references
[
process
.
platform
].
length
>
0
)
{
...
...
@@ -137,13 +140,51 @@ export class AppDetailComponent {
return
dir
[
0
];
}
openDir
(
id
)
{
this
.
appsService
.
data
.
map
((
v
)
=>
{
if
(
v
.
id
==
id
)
{
this
.
electron
.
remote
.
shell
.
showItemInFolder
(
v
.
local
.
path
);
this
.
electron
.
remote
.
shell
.
showItemInFolder
(
this
.
searchApp
(
id
).
local
.
path
);
}
startApp
(
id
)
{
let
execute
=
this
.
path
.
join
(
this
.
searchApp
(
id
).
local
.
path
,
this
.
searchApp
(
id
).
actions
[
process
.
platform
][
"
main
"
].
execute
);
let
args
=
this
.
searchApp
(
id
).
actions
[
process
.
platform
][
"
main
"
].
args
;
let
env
=
this
.
searchApp
(
id
).
actions
[
process
.
platform
][
"
main
"
].
env
;
let
opt
=
{
env
:
env
};
let
open
=
''
;
let
openId
=
this
.
searchApp
(
id
).
actions
[
process
.
platform
][
"
main
"
].
open
;
if
(
openId
)
{
this
.
searchApp
(
openId
).
actions
[
process
.
platform
][
"
main
"
].
execute
;
if
(
this
.
checkInstall
(
openId
))
{
open
=
this
.
path
.
join
(
this
.
searchApp
(
openId
).
local
.
path
,
this
.
searchApp
(
openId
).
actions
[
process
.
platform
][
"
main
"
].
execute
);
args
.
push
(
execute
);
}
else
{
console
.
error
(
'
open app not found
'
);
}
}
else
{
//没有需要通过open启动依赖,直接启动程序
open
=
execute
;
}
let
handle
=
this
.
spawn
(
open
,
args
,
opt
);
handle
.
stdout
.
on
(
'
data
'
,
(
data
)
=>
{
console
.
log
(
`stdout:
${
data
}
`
);
});
handle
.
stderr
.
on
(
'
data
'
,
(
data
)
=>
{
console
.
log
(
`stderr:
${
data
}
`
);
});
handle
.
on
(
'
close
'
,
(
code
)
=>
{
console
.
log
(
`child process exited with code
${
code
}
`
);
this
.
electron
.
remote
.
getCurrentWindow
().
restore
();
});
this
.
electron
.
remote
.
getCurrentWindow
().
minimize
();
}
}
app/apps.service.ts
View file @
49c13820
...
...
@@ -37,7 +37,6 @@ export class AppsService {
mkdirp
=
window
[
'
System
'
].
_nodeRequire
(
'
mkdirp
'
);
electron
=
window
[
'
System
'
].
_nodeRequire
(
'
electron
'
);
Aria2
=
window
[
'
System
'
].
_nodeRequire
(
'
aria2
'
);
spawn
=
window
[
'
System
'
].
_nodeRequire
(
'
child_process
'
);
execFile
=
window
[
'
System
'
].
_nodeRequire
(
'
child_process
'
).
execFile
;
//localStorage = window['localStorage'];
...
...
apps.json
View file @
49c13820
...
...
@@ -13,10 +13,10 @@
"actions"
:
{
"darwin"
:
{
"main"
:
{
"execute"
:
""
,
"execute"
:
"
th13.exe
"
,
"args"
:
[],
"env"
:
""
,
"open"
:
""
"env"
:
{
"LC_ALL"
:
"ja_JP"
}
,
"open"
:
"
wine
"
}
}
},
...
...
@@ -31,8 +31,8 @@
"type"
:
"language"
},
{
"id"
:
"
th12_mod2
"
,
"type"
:
"
runtime
"
"id"
:
"
wine
"
,
"type"
:
"
emulator
"
}
]
},
...
...
@@ -90,10 +90,6 @@
{
"id"
:
"th12_mod1"
,
"type"
:
"language"
},
{
"id"
:
"th12_mod2"
,
"type"
:
"runtime"
}
]
},
...
...
@@ -146,20 +142,20 @@
}
},
{
"id"
:
"
th12_mod2
"
,
"id"
:
"
wine
"
,
"name"
:
{
"zh-CN"
:
"
th12_mod2
"
"zh-CN"
:
"
wine
"
},
"description"
:
{
"zh-CN"
:
"th12 desc"
},
"author"
:
"ZUN"
,
"homepage"
:
"http://www.myacg.cc"
,
"category"
:
"
runtime
"
,
"category"
:
"
emulator
"
,
"actions"
:
{
"darwin"
:
{
"main"
:
{
"execute"
:
""
,
"execute"
:
"
wine
"
,
"args"
:
[],
"env"
:
""
,
"open"
:
""
...
...
@@ -176,8 +172,8 @@
"STG"
],
"local"
:
{
"path"
:
"/
foo/bar
"
,
"version"
:
"1
0.3
"
"path"
:
"/
usr/local/bin
"
,
"version"
:
"1
.8
"
}
},
{
...
...
@@ -227,9 +223,9 @@
}
},
{
"id"
:
"
th07
"
,
"id"
:
"
sublime
"
,
"name"
:
{
"zh-CN"
:
"
东方绯想天
"
"zh-CN"
:
"
sublime
"
},
"description"
:
{
"zh-CN"
:
"fxt desc"
...
...
@@ -240,7 +236,7 @@
"actions"
:
{
"darwin"
:
{
"main"
:
{
"execute"
:
""
,
"execute"
:
"
Sublime Text
"
,
"args"
:
[],
"env"
:
""
,
"open"
:
""
...
...
@@ -268,7 +264,7 @@
"game"
],
"local"
:
{
"path"
:
""
,
"path"
:
"
/Applications/Sublime Text.app/Contents/MacOS
"
,
"version"
:
""
}
},
...
...
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