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
64ac26ca
Commit
64ac26ca
authored
Dec 15, 2016
by
神楽坂玲奈
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'v3' of github.com:mycard/mycard into v3
parents
fad06ea8
a6b26d36
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
27 additions
and
13 deletions
+27
-13
app/apps.service.ts
app/apps.service.ts
+27
-11
app/ygopro.component.ts
app/ygopro.component.ts
+0
-2
No files found.
app/apps.service.ts
View file @
64ac26ca
...
...
@@ -313,18 +313,22 @@ export class AppsService {
app
.
status
.
status
=
"
updating
"
;
let
checksumFiles
=
await
this
.
getChecksumFile
(
app
);
await
this
.
createDirectory
(
option
.
installDir
);
let
sortedFiles
=
Array
.
from
(
checksumFiles
.
entries
()).
sort
((
a
:
string
[],
b
:
string
[]):
number
=>
{
if
(
a
[
0
]
>
b
[
0
])
{
return
1
;
}
else
if
(
a
[
0
]
<
b
[
0
])
{
return
-
1
;
}
else
{
return
0
;
}
});
app
.
status
.
total
=
sortedFiles
.
length
;
// 刷新进度
let
interval
=
setInterval
(()
=>
{
},
500
);
await
new
Promise
((
resolve
,
reject
)
=>
{
this
.
ngZone
.
runOutsideAngular
(
async
()
=>
{
try
{
let
sortedFiles
=
Array
.
from
(
checksumFiles
.
entries
()).
sort
((
a
:
string
[],
b
:
string
[]):
number
=>
{
if
(
a
[
0
]
>
b
[
0
])
{
return
1
;
}
else
if
(
a
[
0
]
<
b
[
0
])
{
return
-
1
;
}
else
{
return
0
;
}
});
for
(
let
[
file
,
checksum
]
of
sortedFiles
)
{
let
src
=
path
.
join
(
appPath
,
file
);
let
dst
=
path
.
join
(
option
.
installDir
,
file
);
...
...
@@ -334,6 +338,9 @@ export class AppsService {
try
{
await
this
.
copyFile
(
src
,
dst
);
}
catch
(
e
)
{
}
finally
{
app
.
status
.
progress
+=
1
;
}
}
}
...
...
@@ -343,6 +350,7 @@ export class AppsService {
}
});
});
clearInterval
(
interval
);
app
.
local
=
new
AppLocal
();
app
.
local
.
path
=
option
.
installDir
;
app
.
status
.
status
=
"
ready
"
;
...
...
@@ -371,7 +379,7 @@ export class AppsService {
});
}
async
verifyFiles
(
app
:
App
,
checksumFiles
:
Map
<
string
,
string
>
):
Promise
<
Map
<
string
,
string
>>
{
async
verifyFiles
(
app
:
App
,
checksumFiles
:
Map
<
string
,
string
>
,
callback
:
()
=>
void
):
Promise
<
Map
<
string
,
string
>>
{
let
result
=
new
Map
<
string
,
string
>
();
for
(
let
[
file
,
checksum
]
of
checksumFiles
)
{
let
filePath
=
path
.
join
(
app
.
local
!
.
path
,
file
);
...
...
@@ -386,6 +394,7 @@ export class AppsService {
let
sha256sum
=
await
this
.
sha256sum
(
filePath
);
result
.
set
(
file
,
sha256sum
);
}
callback
();
resolve
();
});
});
...
...
@@ -413,16 +422,23 @@ export class AppsService {
let
latestFiles
=
await
this
.
getChecksumFile
(
app
);
let
localFiles
:
Map
<
string
,
string
>|
undefined
;
if
(
verify
)
{
//刷新进度条
let
interval
=
setInterval
(()
=>
{
},
500
);
app
.
status
.
total
=
latestFiles
.
size
;
await
new
Promise
((
resolve
,
reject
)
=>
{
this
.
ngZone
.
runOutsideAngular
(
async
()
=>
{
try
{
localFiles
=
await
this
.
verifyFiles
(
app
,
latestFiles
);
localFiles
=
await
this
.
verifyFiles
(
app
,
latestFiles
,
()
=>
{
app
.
status
.
progress
+=
1
;
});
resolve
();
}
catch
(
e
)
{
reject
(
e
);
}
});
});
clearInterval
(
interval
);
}
else
{
localFiles
=
app
.
local
!
.
files
;
}
...
...
app/ygopro.component.ts
View file @
64ac26ca
...
...
@@ -185,9 +185,7 @@ export class YGOProComponent implements OnInit {
async
get_font
(
files
:
string
[]):
Promise
<
string
|
undefined
>
{
for
(
let
file
of
files
)
{
console
.
log
(
file
);
let
found
=
await
new
Promise
((
resolve
)
=>
fs
.
access
(
file
,
fs
.
constants
.
R_OK
,
error
=>
resolve
(
!
error
)));
console
.
log
(
found
);
if
(
found
)
{
return
file
;
}
...
...
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