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
f9f9059d
Commit
f9f9059d
authored
Nov 24, 2016
by
神楽坂玲奈
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
np2
parent
f3ae14ac
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
41 additions
and
11 deletions
+41
-11
app/app.ts
app/app.ts
+9
-3
app/apps.service.ts
app/apps.service.ts
+32
-8
No files found.
app/app.ts
View file @
f9f9059d
...
...
@@ -20,6 +20,12 @@ export enum Category {
// uninstalling,
// waiting,
// }
export
interface
Action
{
execute
:
string
;
args
:
string
[];
env
:
{};
open
?:
App
}
export
class
AppStatus
{
progress
:
number
;
...
...
@@ -42,11 +48,11 @@ export class App {
homepage
:
string
;
category
:
Category
;
parent
:
App
;
actions
:
Map
<
string
,
{
execute
:
string
,
args
:
string
[],
env
:
{},
open
:
App
}
>
;
actions
:
Map
<
string
,
Action
>
;
references
:
Map
<
string
,
App
>
;
dependencies
:
Map
<
string
,
App
>
;
locales
:
string
[];
download
:
string
;
// meta4 url
download
:
string
;
// meta4 url
news
:
{
title
:
string
,
url
:
string
,
image
:
string
}[];
network
:
any
;
tags
:
string
[];
...
...
@@ -82,7 +88,7 @@ export class App {
let
set
=
new
Set
();
for
(
let
dependency
of
this
.
dependencies
.
values
())
{
dependency
.
findDependencies
()
.
forEach
((
value
)
=>
{
.
forEach
((
value
)
=>
{
set
.
add
(
value
);
});
set
.
add
(
dependency
);
...
...
app/apps.service.ts
View file @
f9f9059d
import
{
Injectable
,
ApplicationRef
}
from
"
@angular/core
"
;
import
{
Http
}
from
"
@angular/http
"
;
import
{
App
,
AppStatus
}
from
"
./app
"
;
import
{
App
,
AppStatus
,
Action
}
from
"
./app
"
;
import
{
SettingsService
}
from
"
./settings.sevices
"
;
import
*
as
fs
from
"
fs
"
;
import
*
as
path
from
"
path
"
;
import
*
as
child_process
from
"
child_process
"
;
import
{
remote
}
from
"
electron
"
;
import
"
rxjs/Rx
"
;
import
{
AppLocal
}
from
"
./app-local
"
;
import
*
as
ini
from
"
ini
"
;
const
Aria2
=
require
(
'
aria2
'
);
const
sudo
=
require
(
'
electron-sudo
'
);
...
...
@@ -120,23 +121,46 @@ export class AppsService {
return
children
;
}
runApp
(
app
:
App
)
{
async
runApp
(
app
:
App
)
{
let
children
=
this
.
findChildren
(
app
);
let
cwd
=
(
<
AppLocal
>
app
.
local
).
path
;
let
action
:
any
=
app
.
actions
.
get
(
'
main
'
);
let
action
:
Action
=
<
Action
>
app
.
actions
.
get
(
'
main
'
);
let
args
:
string
[]
=
[];
let
env
=
{};
for
(
let
child
of
children
)
{
if
(
child
.
isInstalled
())
{
action
=
child
.
actions
.
get
(
'
main
'
);
if
(
child
.
isInstalled
())
{
let
_action
=
child
.
actions
.
get
(
'
main
'
);
if
(
_action
)
{
action
=
_action
}
}
}
let
execute
=
path
.
join
(
cwd
,
action
.
execute
);
if
(
action
.
open
)
{
let
openAction
=
action
.
open
.
actions
.
get
(
'
main
'
);
if
(
action
.
open
.
id
==
'
np2fmgen
'
)
{
const
config_file
=
path
.
join
((
<
AppLocal
>
(
<
App
>
action
.
open
).
local
).
path
,
'
np21nt.ini
'
);
let
config
=
await
new
Promise
((
resolve
,
reject
)
=>
{
let
config
=
fs
.
readFile
(
config_file
,
{
encoding
:
'
utf-8
'
},
(
error
,
data
)
=>
{
if
(
error
)
return
reject
(
error
);
resolve
(
ini
.
parse
(
data
));
});
});
config
[
'
NekoProject21
'
][
'
HDD1FILE
'
]
=
path
.
win32
.
join
(
"
Z:
"
,
(
<
AppLocal
>
app
.
local
).
path
,
action
.
execute
);
await
new
Promise
((
resolve
,
reject
)
=>
{
fs
.
writeFile
(
config_file
,
ini
.
stringify
(
config
),
(
error
)
=>
{
if
(
error
)
{
reject
(
error
)
}
else
{
resolve
()
}
})
});
}
let
openAction
=
<
Action
>
action
.
open
.
actions
.
get
(
'
main
'
);
args
=
args
.
concat
(
openAction
.
args
);
args
.
push
(
action
.
execute
);
execute
=
path
.
join
(
action
.
open
.
local
.
path
,
openAction
.
execute
);
execute
=
path
.
join
(
(
<
AppLocal
>
action
.
open
.
local
)
.
path
,
openAction
.
execute
);
env
=
Object
.
assign
(
env
,
openAction
.
env
);
}
args
=
args
.
concat
(
action
.
args
);
...
...
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