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
4ab3842e
Commit
4ab3842e
authored
Dec 14, 2016
by
wudizhanche1000
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
调整校验完整性和导入
parent
f43539b8
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
26 additions
and
10 deletions
+26
-10
app/app-detail.component.html
app/app-detail.component.html
+2
-2
app/app-detail.component.ts
app/app-detail.component.ts
+5
-0
app/apps.service.ts
app/apps.service.ts
+19
-8
No files found.
app/app-detail.component.html
View file @
4ab3842e
...
@@ -2,7 +2,7 @@
...
@@ -2,7 +2,7 @@
<!--应用未安装-->
<!--应用未安装-->
<div
class=
"actions"
*ngIf=
"!currentApp.isInstalled()"
>
<div
class=
"actions"
*ngIf=
"!currentApp.isInstalled()"
>
<button
i18n
type=
"button"
class=
"btn btn-primary"
data-toggle=
"modal"
(click)=
"updateInstallOption(currentApp)"
data-target=
"#install-modal"
>
安装
</button>
<button
i18n
type=
"button"
class=
"btn btn-primary"
data-toggle=
"modal"
(click)=
"updateInstallOption(currentApp)"
data-target=
"#install-modal"
>
安装
</button>
<
!--<button i18n type="button" class="btn btn-secondary">导入</button>--
>
<
button
i18n
(click)=
"importGame(currentApp)"
type=
"button"
class=
"btn btn-secondary"
>
导入
</button
>
</div>
</div>
<!--应用变更中-->
<!--应用变更中-->
...
@@ -76,7 +76,7 @@
...
@@ -76,7 +76,7 @@
</div>
</div>
<h2
i18n
>
本地文件
</h2>
<h2
i18n
>
本地文件
</h2>
<button
i18n
(click)=
"appsService.browse(currentApp)"
[disabled]=
"!appsService.allReady(currentApp)"
type=
"button"
class=
"btn btn-secondary"
>
浏览本地文件
</button>
<button
i18n
(click)=
"appsService.browse(currentApp)"
[disabled]=
"!appsService.allReady(currentApp)"
type=
"button"
class=
"btn btn-secondary"
>
浏览本地文件
</button>
<
!--<button i18n type="button" (click)="verifyFiles(currentApp)" class="btn btn-secondary">校验完整性</button>--
>
<
button
i18n
type=
"button"
(click)=
"verifyFiles(currentApp)"
class=
"btn btn-secondary"
>
校验完整性
</button
>
<button
i18n
(click)=
"uninstall(currentApp)"
[disabled]=
"!appsService.allReady(currentApp)"
type=
"button"
class=
"btn btn-secondary"
>
卸载
</button>
<button
i18n
(click)=
"uninstall(currentApp)"
[disabled]=
"!appsService.allReady(currentApp)"
type=
"button"
class=
"btn btn-secondary"
>
卸载
</button>
</div>
</div>
...
...
app/app-detail.component.ts
View file @
4ab3842e
...
@@ -145,6 +145,11 @@ export class AppDetailComponent implements OnInit {
...
@@ -145,6 +145,11 @@ export class AppDetailComponent implements OnInit {
this
.
appsService
.
runApp
(
app
,
'
custom
'
);
this
.
appsService
.
runApp
(
app
,
'
custom
'
);
}
}
importGame
(
app
:
App
)
{
let
dir
=
this
.
selectDir
();
this
.
appsService
.
importApp
(
app
,
dir
);
}
async
verifyFiles
(
app
:
App
)
{
async
verifyFiles
(
app
:
App
)
{
try
{
try
{
await
this
.
appsService
.
update
(
app
,
true
);
await
this
.
appsService
.
update
(
app
,
true
);
...
...
app/apps.service.ts
View file @
4ab3842e
...
@@ -332,17 +332,23 @@ export class AppsService {
...
@@ -332,17 +332,23 @@ export class AppsService {
}
else
{
}
else
{
readyToUpdate
=
app
.
isReady
()
&&
mods
.
every
((
mod
)
=>
mod
.
isReady
());
readyToUpdate
=
app
.
isReady
()
&&
mods
.
every
((
mod
)
=>
mod
.
isReady
());
}
}
if
(
app
.
id
===
"
ygopro
"
)
{
console
.
log
(
111
);
}
if
(
readyToUpdate
&&
(
verify
||
app
.
local
!
.
version
!==
app
.
version
))
{
if
(
readyToUpdate
&&
(
verify
||
app
.
local
!
.
version
!==
app
.
version
))
{
app
.
status
.
status
=
"
updating
"
;
app
.
status
.
status
=
"
updating
"
;
try
{
try
{
Logger
.
info
(
"
Checking updating:
"
,
app
);
Logger
.
info
(
"
Checking updating:
"
,
app
);
let
latestFiles
=
await
this
.
getChecksumFile
(
app
);
let
latestFiles
=
await
this
.
getChecksumFile
(
app
);
let
localFiles
:
Map
<
string
,
string
>
;
let
localFiles
:
Map
<
string
,
string
>
|
undefined
;
if
(
verify
)
{
if
(
verify
)
{
localFiles
=
await
this
.
verifyFiles
(
app
,
latestFiles
);
await
new
Promise
((
resolve
,
reject
)
=>
{
this
.
ngZone
.
runOutsideAngular
(
async
()
=>
{
try
{
localFiles
=
await
this
.
verifyFiles
(
app
,
latestFiles
);
resolve
();
}
catch
(
e
)
{
reject
(
e
);
}
});
});
}
else
{
}
else
{
localFiles
=
app
.
local
!
.
files
;
localFiles
=
app
.
local
!
.
files
;
}
}
...
@@ -351,17 +357,22 @@ export class AppsService {
...
@@ -351,17 +357,22 @@ export class AppsService {
let
deletedFiles
:
Set
<
string
>
=
new
Set
<
string
>
();
let
deletedFiles
:
Set
<
string
>
=
new
Set
<
string
>
();
// 遍历寻找新增加的文件
// 遍历寻找新增加的文件
for
(
let
[
file
,
checksum
]
of
latestFiles
)
{
for
(
let
[
file
,
checksum
]
of
latestFiles
)
{
if
(
!
localFiles
.
has
(
file
)
&&
latestFiles
.
get
(
file
)
!==
""
)
{
if
(
checksum
!==
""
&&
!
localFiles
!
.
has
(
file
)
)
{
addedFiles
.
add
(
file
);
addedFiles
.
add
(
file
);
// changedFiles包含addedFiles,addedFiles仅供mod更新的时候使用。
// changedFiles包含addedFiles,addedFiles仅供mod更新的时候使用。
changedFiles
.
add
(
file
);
changedFiles
.
add
(
file
);
}
else
if
(
checksum
===
""
&&
file
!=
"
.
"
)
{
await
this
.
createDirectory
(
path
.
join
(
app
.
local
!
.
path
,
file
));
}
}
}
}
// 遍历寻找旧版本与新版本不一样的文件和新版本比旧版少了的文件
// 遍历寻找旧版本与新版本不一样的文件和新版本比旧版少了的文件
for
(
let
[
file
,
checksum
]
of
localFiles
)
{
for
(
let
[
file
,
checksum
]
of
localFiles
!
)
{
if
(
latestFiles
.
has
(
file
))
{
if
(
latestFiles
.
has
(
file
))
{
if
(
latestFiles
.
get
(
file
)
!==
checksum
&&
latestFiles
.
get
(
file
)
!==
""
)
{
let
latestChecksum
=
latestFiles
.
get
(
file
);
if
(
latestChecksum
!==
checksum
&&
latestChecksum
!==
""
)
{
changedFiles
.
add
(
file
);
changedFiles
.
add
(
file
);
}
else
if
(
latestChecksum
===
""
)
{
await
this
.
createDirectory
(
path
.
join
(
app
.
local
!
.
path
,
file
));
}
}
}
else
{
}
else
{
deletedFiles
.
add
(
file
);
deletedFiles
.
add
(
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