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
2
Merge Requests
2
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
4c2bd711
Commit
4c2bd711
authored
Aug 04, 2022
by
mercury233
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'patch-import' into 'v3'
Patch import See merge request
!18
parents
4eb628be
d4240a4e
Pipeline
#15327
passed with stages
in 3 minutes and 56 seconds
Changes
4
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
57 additions
and
27 deletions
+57
-27
app/app-detail.component.css
app/app-detail.component.css
+4
-0
app/app-detail.component.html
app/app-detail.component.html
+5
-5
app/app-detail.component.ts
app/app-detail.component.ts
+26
-1
app/apps.service.ts
app/apps.service.ts
+22
-21
No files found.
app/app-detail.component.css
View file @
4c2bd711
...
...
@@ -264,4 +264,8 @@ table.expansions tr:last-child td:last-child{
font-size
:
1rem
;
margin-bottom
:
0
;
margin-top
:
.5rem
;
}
.custom-file-control
:lang
(
zh
)
::before
{
content
:
"打开..."
;
}
\ No newline at end of file
app/app-detail.component.html
View file @
4c2bd711
...
...
@@ -252,13 +252,13 @@
</button>
</div>
<div
class=
"modal-body"
>
<p
><strong
i18n
>
请注意,导入功能只适用于下载并解压的MyCard提供的完整包,无法正常导入其他渠道提供的版本。用于导入的完整包请从社区或者反馈群等处获取,导入其他的版本将极易导致无法预知的错误。在下载功能出现故障无法使用时,导入功能也将无法使用。
</strong>
</p>
<p
i18n
>
选择主程序 {{currentApp.actions.get('main').execute}}
</p>
<label
class=
"custom-file"
lang=
"
en
"
>
<p
i18n
>
请注意!!导入功能只适用于手动下载的
<strong
class=
"text-primary"
>
MyCard提供的
</strong>
完整包,
<strong
class=
"text-danger"
>
无法正常导入其他渠道提供的版本
</strong>
。用于导入的完整包请从社区或者反馈群等处获取,导入其他的版本将极易导致无法预知的错误。
<strong
class=
"text-primary"
>
在下载功能出现故障无法使用时,导入功能也可能无法使用
</strong>
。
</p>
<p
i18n
>
选择主程序 {{currentApp.actions.get('main').execute}}
或者完整包
</p>
<label
class=
"custom-file"
lang=
"
zh
"
>
<input
(click)=
"$event.preventDefault();selectImport(currentApp)"
type=
"file"
id=
"file"
class=
"custom-file-input"
>
<span
class=
"custom-file-control"
>
{{import_path
|| currentApp.actions.get('main').execute
}}
</span>
<span
class=
"custom-file-control"
>
{{import_path}}
</span>
</label>
<hr>
<h4
i18n
>
导入到
</h4>
<div
class=
"form-group"
>
<select
class=
"form-control"
name=
"installPath"
(change)=
"selectLibrary()"
[(ngModel)]=
"installOption.installLibrary"
title=
"path"
>
...
...
app/app-detail.component.ts
View file @
4c2bd711
...
...
@@ -213,6 +213,31 @@ export class AppDetailComponent implements OnInit, OnChanges {
async
importGame
(
targetApp
:
App
,
option
:
InstallOption
,
referencesInstall
:
{
[
id
:
string
]:
boolean
})
{
$
(
'
#import-modal
'
).
modal
(
'
hide
'
);
let
dir
=
path
.
dirname
(
this
.
import_path
);
let
ext
=
path
.
extname
(
this
.
import_path
);
if
(
ext
===
'
.zst
'
)
{
try
{
console
.
log
(
'
extracting import file
'
);
await
new
Promise
((
resolve
,
reject
)
=>
{
targetApp
.
status
.
status
=
'
installing
'
;
this
.
appsService
.
extract
(
this
.
import_path
,
option
.
installDir
).
subscribe
(
(
lastItem
:
string
)
=>
{
targetApp
.
status
.
progressMessage
=
lastItem
;
},
(
error
)
=>
{
reject
(
error
);
},
()
=>
{
resolve
(
null
);
});
});
dir
=
option
.
installDir
;
targetApp
.
status
.
status
=
'
init
'
;
}
catch
(
e
)
{
console
.
error
(
e
);
new
Notification
(
targetApp
.
name
,
{
body
:
'
导入时解压失败
'
+
e
.
message
});
}
}
// TODO: 执行依赖和references安装
try
{
await
this
.
appsService
.
importApp
(
targetApp
,
dir
,
option
);
...
...
@@ -263,7 +288,7 @@ export class AppDetailComponent implements OnInit, OnChanges {
// let remote = require('electron').remote
let
filePaths
=
await
new
Promise
<
string
[]
>
((
resolve
,
reject
)
=>
{
remote
.
dialog
.
showOpenDialog
({
filters
:
[{
name
:
filename
,
extensions
:
[
extname
]}],
filters
:
[{
name
:
filename
,
extensions
:
[
extname
,
'
zst
'
]}],
properties
:
[
'
openFile
'
]
},
resolve
);
});
...
...
app/apps.service.ts
View file @
4c2bd711
...
...
@@ -382,7 +382,7 @@ export class AppsService {
async
importApp
(
app
:
App
,
appPath
:
string
,
option
:
InstallOption
)
{
if
(
!
app
.
isInstalled
())
{
app
.
status
.
status
=
'
updat
ing
'
;
app
.
status
.
status
=
'
install
ing
'
;
let
checksumFiles
=
await
this
.
getChecksumFile
(
app
);
for
(
let
[
pattern
,
fileOption
]
of
app
.
files
)
{
await
new
Promise
((
resolve
,
reject
)
=>
{
...
...
@@ -411,30 +411,31 @@ export class AppsService {
// 刷新进度
let
interval
=
setInterval
(()
=>
{
},
500
);
await
new
Promise
((
resolve
,
reject
)
=>
{
this
.
ngZone
.
runOutsideAngular
(
async
()
=>
{
try
{
for
(
let
[
file
,
checksum
]
of
sortedFiles
)
{
let
src
=
path
.
join
(
appPath
,
file
);
let
dst
=
path
.
join
(
option
.
installDir
,
file
);
if
(
checksum
===
''
)
{
await
this
.
createDirectory
(
dst
);
}
else
{
try
{
await
this
.
copyFile
(
src
,
dst
);
}
catch
(
e
)
{
}
finally
{
app
.
status
.
progress
+=
1
;
if
(
path
.
resolve
(
appPath
)
!==
path
.
resolve
(
option
.
installDir
))
{
await
new
Promise
((
resolve
,
reject
)
=>
{
this
.
ngZone
.
runOutsideAngular
(
async
()
=>
{
try
{
for
(
let
[
file
,
checksum
]
of
sortedFiles
)
{
let
src
=
path
.
join
(
appPath
,
file
);
let
dst
=
path
.
join
(
option
.
installDir
,
file
);
if
(
checksum
===
''
)
{
await
this
.
createDirectory
(
dst
);
}
else
{
try
{
await
this
.
copyFile
(
src
,
dst
);
}
catch
(
e
)
{
}
finally
{
app
.
status
.
progress
+=
1
;
}
}
}
resolve
(
null
);
}
catch
(
e
)
{
reject
(
e
);
}
resolve
(
null
);
}
catch
(
e
)
{
reject
(
e
);
}
});
});
}
);
}
clearInterval
(
interval
);
app
.
local
=
new
AppLocal
();
app
.
local
.
path
=
option
.
installDir
;
...
...
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