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
14eeca64
Commit
14eeca64
authored
Dec 05, 2016
by
wudizhanche1000
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
卸载进度,依赖安装
parent
0fafee68
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
77 additions
and
46 deletions
+77
-46
app/app-detail.component.html
app/app-detail.component.html
+9
-6
app/app-detail.component.ts
app/app-detail.component.ts
+17
-4
app/app.ts
app/app.ts
+3
-0
app/apps.service.ts
app/apps.service.ts
+37
-31
app/download.service.ts
app/download.service.ts
+6
-4
app/install.service.ts
app/install.service.ts
+5
-1
No files found.
app/app-detail.component.html
View file @
14eeca64
...
...
@@ -10,6 +10,7 @@
<div>
<span
*ngIf=
"currentApp.isDownloading()"
>
正在下载
</span>
<span
*ngIf=
"currentApp.isInstalling()"
>
正在安装...
</span>
<span
*ngIf=
"currentApp.isUninstalling()"
>
正在卸载...
</span>
<span
*ngIf=
"currentApp.isWaiting()"
>
等待安装...
</span>
<span
*ngIf=
"currentApp.status.total"
>
{{(currentApp.status.progress/currentApp.status.total * 100).toFixed()}}%
</span>
<span>
{{currentApp.progressMessage()}}
</span>
...
...
@@ -64,8 +65,10 @@
</td>
<td
*ngIf=
"!mod.isInstalled()"
>
<button
i18n
(click)=
"installMod(mod)"
type=
"button"
*ngIf=
"!mod.isInstalled()"
class=
"btn btn-primary btn-sm"
>
安装
</button>
<progress
*ngIf=
"mod.isDownloading()"
class=
"progress progress-striped progress-animated"
value=
"{{mod.status.progress}}"
max=
"{{mod.status.total}}"
></progress>
<div
i18n
*ngIf=
"mod.isWaiting()"
>
等待安装...
</div>
</td>
<td
*ngIf=
"mod.isInstalled()&&!mod.isReady()"
>
<progress
class=
"progress progress-striped progress-animated"
value=
"{{mod.status.progress}}"
max=
"{{mod.status.total}}"
></progress>
<!--<div i18n *ngIf="mod.isWaiting()">等待安装...</div>-->
</td>
</tr>
</tbody>
...
...
@@ -104,10 +107,10 @@
<input
id=
"create_desktop_shortcut"
type=
"checkbox"
name=
"desktop"
[(ngModel)]=
"installOption.createDesktopShortcut"
>
<label
i18n
for=
"create_desktop_shortcut"
>
创建桌面快捷方式
</label>
</div>
<
!--<h4 *ngIf="installOption.references.length">扩展内容</h4>--
>
<
!--<div *ngFor="let reference of installOption.references"><label>--
>
<!--<input type="checkbox" [(ngModel)]="reference.install" name="references" value="{{reference.app.id}}"> {{reference.app.name}}-->
<
!--</label></div>--
>
<
h4
*ngIf=
"references.length>0"
>
扩展内容
</h4
>
<
div
*ngFor=
"let reference of references"
><label
>
<input
type=
"checkbox"
[(ngModel)]=
"referencesInstall[reference.id]"
name=
"references"
>
{{reference.name}}
<
/label></div
>
<div
*ngIf=
"currentApp.findDependencies().length"
>
<span
i18n
>
依赖:
</span>
<span
class=
"dependency"
*ngFor=
"let dependency of currentApp.findDependencies()"
>
{{dependency.name}}
</span>
...
...
app/app-detail.component.ts
View file @
14eeca64
...
...
@@ -24,6 +24,9 @@ export class AppDetailComponent implements OnInit {
installOption
:
InstallOption
;
references
:
App
[];
referencesInstall
:
{[
id
:
string
]:
boolean
};
constructor
(
private
appsService
:
AppsService
,
private
settingsService
:
SettingsService
,
private
downloadService
:
DownloadService
,
private
installService
:
InstallService
,
private
ref
:
ChangeDetectorRef
)
{
...
...
@@ -35,10 +38,12 @@ export class AppDetailComponent implements OnInit {
updateInstallOption
(
app
:
App
)
{
this
.
installOption
=
new
InstallOption
(
app
);
this
.
installOption
.
installLibrary
=
this
.
settingsService
.
getDefaultLibrary
().
path
;
// this.installOption.references = [];
// for (let reference of app.references.values()) {
// this.installOption.references.push(new InstallOption(reference))
// }
this
.
references
=
Array
.
from
(
app
.
references
.
values
());
console
.
log
(
this
.
references
);
this
.
referencesInstall
=
{};
for
(
let
reference
of
this
.
references
)
{
this
.
referencesInstall
[
reference
.
id
]
=
true
;
}
}
get
libraries
():
string
[]
{
...
...
@@ -73,6 +78,14 @@ export class AppDetailComponent implements OnInit {
try
{
await
this
.
appsService
.
install
(
targetApp
,
options
);
if
(
this
.
references
.
length
>
0
)
{
for
(
let
[
id
,
isInstalled
]
of
Object
.
entries
(
this
.
referencesInstall
))
{
if
(
isInstalled
)
{
let
reference
=
targetApp
.
references
.
get
(
id
)
!
;
await
this
.
appsService
.
install
(
reference
,
options
);
}
}
}
}
catch
(
e
)
{
console
.
error
(
e
);
new
Notification
(
targetApp
.
name
,
{
body
:
"
下载失败
"
});
...
...
app/app.ts
View file @
14eeca64
...
...
@@ -100,6 +100,9 @@ export class App {
isDownloading
():
boolean
{
return
this
.
status
.
status
===
"
downloading
"
;
}
isUninstalling
():
boolean
{
return
this
.
status
.
status
===
"
uninstalling
"
;
}
runable
():
boolean
{
return
[
Category
.
game
].
includes
(
this
.
category
);
...
...
app/apps.service.ts
View file @
14eeca64
...
...
@@ -215,27 +215,30 @@ export class AppsService {
})
});
};
try
{
let
apps
:
App
[]
=
[];
let
dependencies
=
app
.
findDependencies
().
filter
((
dependency
)
=>
{
return
!
dependency
.
isInstalled
();
});
apps
.
push
(...
dependencies
,
app
);
let
downloadPath
=
path
.
join
(
option
.
installLibrary
,
'
downloading
'
);
let
tasks
:
Promise
<
any
>
[]
=
[];
for
(
let
a
of
apps
)
{
tasks
.
push
(
addDownloadTask
(
a
,
downloadPath
));
}
let
downloadResults
=
await
Promise
.
all
(
tasks
);
for
(
let
result
of
downloadResults
)
{
console
.
log
(
result
);
let
o
=
new
InstallOption
(
result
.
app
,
option
.
installLibrary
);
o
.
downloadFiles
=
result
.
files
;
this
.
installService
.
push
({
app
:
result
.
app
,
option
:
o
});
if
(
!
app
.
isInstalled
())
{
try
{
let
apps
:
App
[]
=
[];
let
dependencies
=
app
.
findDependencies
().
filter
((
dependency
)
=>
{
return
!
dependency
.
isInstalled
();
});
apps
.
push
(...
dependencies
,
app
);
let
downloadPath
=
path
.
join
(
option
.
installLibrary
,
'
downloading
'
);
let
tasks
:
Promise
<
any
>
[]
=
[];
for
(
let
a
of
apps
)
{
tasks
.
push
(
addDownloadTask
(
a
,
downloadPath
));
}
let
downloadResults
=
await
Promise
.
all
(
tasks
);
for
(
let
result
of
downloadResults
)
{
console
.
log
(
result
);
let
o
=
new
InstallOption
(
result
.
app
,
option
.
installLibrary
);
o
.
downloadFiles
=
result
.
files
;
this
.
installService
.
push
({
app
:
result
.
app
,
option
:
o
});
}
}
catch
(
e
)
{
app
.
status
.
status
=
'
init
'
;
console
.
log
(
e
);
throw
e
;
}
}
catch
(
e
)
{
console
.
log
(
e
);
throw
e
;
}
}
...
...
@@ -288,12 +291,12 @@ export class AppsService {
}
if
(
action
.
open
)
{
let
np2
=
<
App
>
action
.
open
;
let
np2
=
action
.
open
;
let
openAction
:
Action
;
openAction
=
<
Action
>
np2
.
actions
.
get
(
'
main
'
)
;
let
openPath
=
(
<
AppLocal
>
np2
.
local
)
.
path
;
openAction
=
np2
.
actions
.
get
(
'
main
'
)
!
;
let
openPath
=
np2
.
local
!
.
path
;
if
(
action
.
open
.
id
==
'
np2fmgen
'
)
{
const
config_file
=
path
.
join
(
(
<
AppLocal
>
(
<
App
>
action
.
open
).
local
)
.
path
,
'
np21nt.ini
'
);
const
config_file
=
path
.
join
(
action
.
open
!
.
local
!
.
path
,
'
np21nt.ini
'
);
let
config
=
await
new
Promise
((
resolve
,
reject
)
=>
{
fs
.
readFile
(
config_file
,
{
encoding
:
'
utf-8
'
},
(
error
,
data
)
=>
{
if
(
error
)
return
reject
(
error
);
...
...
@@ -309,7 +312,7 @@ export class AppsService {
windtype
:
'
0
'
};
config
[
'
NekoProject21
'
]
=
Object
.
assign
({},
default_config
,
config
[
'
NekoProject21
'
]);
config
[
'
NekoProject21
'
][
'
HDD1FILE
'
]
=
path
.
win32
.
join
(
process
.
platform
==
'
win32
'
?
''
:
'
Z:
'
,
(
<
AppLocal
>
app
.
local
)
.
path
,
action
.
execute
);
config
[
'
NekoProject21
'
][
'
HDD1FILE
'
]
=
path
.
win32
.
join
(
process
.
platform
==
'
win32
'
?
''
:
'
Z:
'
,
app
.
local
!
.
path
,
action
.
execute
);
await
new
Promise
((
resolve
,
reject
)
=>
{
fs
.
writeFile
(
config_file
,
ini
.
stringify
(
config
),
(
error
)
=>
{
if
(
error
)
{
...
...
@@ -319,12 +322,15 @@ export class AppsService {
}
})
});
args
.
push
(
openAction
.
execute
);
args
=
args
.
concat
(
openAction
.
args
);
let
wine
=
<
App
>
openAction
.
open
;
openPath
=
(
<
AppLocal
>
wine
.
local
).
path
;
openAction
=
<
Action
>
(
<
App
>
openAction
.
open
).
actions
.
get
(
'
main
'
);
cwd
=
(
<
AppLocal
>
np2
.
local
).
path
;
if
(
process
.
platform
!=
'
win32
'
)
{
args
.
push
(
openAction
.
execute
);
args
=
args
.
concat
(
openAction
.
args
);
let
wine
=
openAction
.
open
!
;
openPath
=
wine
.
local
!
.
path
;
openAction
=
openAction
!
.
open
!
.
actions
.
get
(
'
main
'
)
!
;
}
cwd
=
np2
.
local
!
.
path
;
}
args
=
args
.
concat
(
openAction
.
args
);
args
.
push
(
action
.
execute
);
...
...
app/download.service.ts
View file @
14eeca64
...
...
@@ -83,10 +83,12 @@ export class DownloadService {
let
newDownloadSpeed
=
0
;
for
(
let
[
index
,
gid
]
of
gidList
.
entries
())
{
let
task
=
this
.
taskList
.
get
(
gid
)
!
;
statusList
[
index
]
=
task
.
status
;
newCompletedLength
+=
parseInt
(
task
.
completedLength
);
newTotalLength
+=
parseInt
(
task
.
totalLength
);
newDownloadSpeed
+=
parseInt
(
task
.
downloadSpeed
);
if
(
task
)
{
statusList
[
index
]
=
task
.
status
;
newCompletedLength
+=
parseInt
(
task
.
completedLength
);
newTotalLength
+=
parseInt
(
task
.
totalLength
);
newDownloadSpeed
+=
parseInt
(
task
.
downloadSpeed
);
}
}
if
(
newCompletedLength
!==
completedLength
||
newTotalLength
!==
totalLength
)
{
completedLength
=
newCompletedLength
;
...
...
app/install.service.ts
View file @
14eeca64
...
...
@@ -293,11 +293,15 @@ export class InstallService {
async
uninstall
(
app
:
App
)
{
if
(
app
.
isReady
())
{
app
.
status
.
status
=
"
uninstalling
"
;
let
appDir
=
app
.
local
!
.
path
;
let
files
=
Array
.
from
(
app
.
local
!
.
files
.
keys
()).
sort
().
reverse
();
app
.
status
.
total
=
files
.
length
;
for
(
let
file
of
files
)
{
this
.
deleteFile
(
path
.
join
(
appDir
,
file
));
app
.
status
.
progress
+=
1
;
await
this
.
deleteFile
(
path
.
join
(
appDir
,
file
));
}
if
(
app
.
parent
)
{
...
...
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