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
9
Issues
9
List
Boards
Labels
Service Desk
Milestones
Merge Requests
1
Merge Requests
1
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
MyCard
mycard
Commits
ba66b5ec
Commit
ba66b5ec
authored
Dec 08, 2016
by
wudizhanche1000
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
游戏更新
parent
a769d444
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
68 additions
and
2 deletions
+68
-2
app/app-detail.component.ts
app/app-detail.component.ts
+2
-2
app/apps.service.ts
app/apps.service.ts
+63
-0
app/lobby.component.ts
app/lobby.component.ts
+3
-0
No files found.
app/app-detail.component.ts
View file @
ba66b5ec
import
{
Component
,
OnInit
,
Input
,
ChangeDetectorRef
}
from
"
@angular/core
"
;
import
{
Component
,
OnInit
,
Input
,
ChangeDetectorRef
,
OnChanges
,
SimpleChanges
}
from
"
@angular/core
"
;
import
{
AppsService
}
from
"
./apps.service
"
;
import
{
InstallOption
}
from
"
./install-option
"
;
import
{
SettingsService
}
from
"
./settings.sevices
"
;
...
...
@@ -31,7 +31,7 @@ export class AppDetailComponent implements OnInit {
private
downloadService
:
DownloadService
,
private
ref
:
ChangeDetectorRef
)
{
}
async
ngOnInit
()
{
async
ngOnInit
()
:
Promise
<
void
>
{
let
volume
=
'
A
'
;
for
(
let
i
=
0
;
i
<
26
;
i
++
)
{
await
new
Promise
((
resolve
,
reject
)
=>
{
...
...
app/apps.service.ts
View file @
ba66b5ec
...
...
@@ -248,6 +248,68 @@ export class AppsService {
async
update
(
app
:
App
)
{
const
updateServer
=
"
https://thief.mycard.moe/update/metalinks/
"
;
if
(
app
.
isReady
()
&&
app
.
local
!
.
version
!==
app
.
version
)
{
app
.
status
.
status
=
"
updating
"
;
let
updateMetalink
=
updateServer
+
app
.
id
;
if
(
app
.
id
===
"
ygopro
"
||
app
.
id
===
"
desmume
"
)
{
updateMetalink
=
updateMetalink
+
'
-
'
+
process
.
platform
;
}
Logger
.
info
(
"
Checking updating:
"
,
app
);
let
latestFiles
=
await
this
.
getChecksumFile
(
app
);
let
localFiles
=
app
.
local
!
.
files
;
let
changedFiles
:
string
[]
=
[];
let
deletedFiles
:
string
[]
=
[];
for
(
let
[
file
,
checksum
]
of
latestFiles
)
{
if
(
!
localFiles
.
has
(
file
))
{
changedFiles
.
push
(
file
);
}
}
for
(
let
[
file
,
checksum
]
of
localFiles
)
{
if
(
latestFiles
.
has
(
file
))
{
if
(
latestFiles
.
get
(
file
)
!==
checksum
)
{
changedFiles
.
push
(
file
);
}
}
else
{
deletedFiles
.
push
(
file
);
}
}
if
(
changedFiles
.
length
>
0
)
{
Logger
.
info
(
"
Found files changed:
"
,
changedFiles
);
let
metalink
=
await
this
.
http
.
post
(
updateMetalink
,
changedFiles
).
map
((
response
)
=>
response
.
text
()).
toPromise
();
let
library
=
path
.
dirname
(
app
.
local
!
.
path
);
let
downloadId
=
await
this
.
downloadService
.
addMetalink
(
metalink
,
library
);
await
this
.
downloadService
.
progress
(
downloadId
,
(
status
:
DownloadStatus
)
=>
{
app
.
status
.
progress
=
status
.
completedLength
;
app
.
status
.
total
=
status
.
totalLength
;
app
.
status
.
progressMessage
=
status
.
downloadSpeedText
;
this
.
ref
.
tick
();
});
let
downloadFiles
=
await
this
.
downloadService
.
getFiles
(
downloadId
);
for
(
let
downloadFile
of
downloadFiles
)
{
await
new
Promise
((
resolve
,
reject
)
=>
{
this
.
extract
(
downloadFile
,
app
.
local
!
.
path
).
subscribe
(()
=>
{
},
(
error
)
=>
{
reject
(
error
);
},
()
=>
{
resolve
();
});
});
}
}
if
(
deletedFiles
.
length
>
0
)
{
Logger
.
info
(
"
Found files deleted:
"
,
deletedFiles
);
for
(
let
deletedFile
of
deletedFiles
)
{
await
this
.
deleteFile
(
path
.
join
(
app
.
local
!
.
path
,
deletedFile
));
}
}
app
.
local
!
.
version
=
app
.
version
;
app
.
local
!
.
files
=
latestFiles
;
this
.
saveAppLocal
(
app
);
app
.
status
.
status
=
"
ready
"
;
Logger
.
info
(
"
Update Finished:
"
,
app
);
}
}
async
install
(
app
:
App
,
option
:
InstallOption
)
{
...
...
@@ -635,6 +697,7 @@ export class AppsService {
extract
(
file
:
string
,
dir
:
string
):
Observable
<
string
>
{
return
Observable
.
create
((
observer
:
Observer
<
string
>
)
=>
{
Logger
.
info
(
"
Start to extract... Command Line:
"
+
this
.
tarPath
,
file
,
dir
);
let
tarProcess
=
child_process
.
spawn
(
this
.
tarPath
,
[
'
xvf
'
,
file
,
'
-C
'
,
dir
]);
let
rl
=
readline
.
createInterface
({
input
:
<
ReadableStream
>
tarProcess
.
stderr
,
...
...
app/lobby.component.ts
View file @
ba66b5ec
...
...
@@ -31,6 +31,9 @@ export class LobbyComponent implements OnInit {
async
ngOnInit
()
{
this
.
apps
=
await
this
.
appsService
.
loadApps
();
await
this
.
appsService
.
migrate
();
for
(
let
app
of
this
.
apps
.
values
())
{
this
.
appsService
.
update
(
app
);
}
this
.
chooseApp
(
Array
.
from
(
this
.
apps
.
values
()).
find
(
app
=>
app
.
isInstalled
())
||
this
.
apps
.
get
(
"
ygopro
"
)
!
);
// 初始化聊天室
...
...
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