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
30324532
Commit
30324532
authored
Dec 15, 2016
by
神楽坂玲奈
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ygopro import
parent
4c7f61d6
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
33 additions
and
7 deletions
+33
-7
app/apps.service.ts
app/apps.service.ts
+31
-5
app/lobby.component.ts
app/lobby.component.ts
+1
-1
app/settings.sevices.ts
app/settings.sevices.ts
+1
-1
No files found.
app/apps.service.ts
View file @
30324532
...
...
@@ -18,9 +18,7 @@ import {InstallOption} from "./install-option";
import
{
ComparableSet
}
from
"
./shared/ComparableSet
"
;
import
{
Observable
,
Observer
}
from
"
rxjs/Rx
"
;
import
Timer
=
NodeJS
.
Timer
;
// import mkdirp = require("mkdirp");
import
ReadableStream
=
NodeJS
.
ReadableStream
;
const
Aria2
=
require
(
'
aria2
'
);
const
sudo
=
require
(
'
electron-sudo
'
);
const
Logger
=
{
...
...
@@ -45,6 +43,8 @@ interface Connection {
connection
:
WebSocket
,
address
:
string
|
null
}
declare
const
System
:
any
;
@
Injectable
()
export
class
AppsService
{
...
...
@@ -141,18 +141,44 @@ export class AppsService {
}
}
async
migrate_v2_ygopro
()
{
// 导入萌卡 v2 的 YGOPRO
if
(
this
.
apps
.
get
(
'
ygopro
'
)
!
.
isInstalled
())
{
let
app
=
this
.
apps
.
get
(
'
ygopro
'
)
!
;
if
(
app
.
isInstalled
()
||
localStorage
.
getItem
(
'
migrate_v2_ygopro
'
))
{
return
}
try
{
const
legacy_ygopro_path
=
r
equire
(
path
.
join
(
remote
.
app
.
getPath
(
'
appData
'
),
'
mycard
'
,
'
db.json
'
)).
local
.
ygopro
.
path
;
const
legacy_ygopro_path
=
System
.
_nodeR
equire
(
path
.
join
(
remote
.
app
.
getPath
(
'
appData
'
),
'
mycard
'
,
'
db.json
'
)).
local
.
ygopro
.
path
;
if
(
legacy_ygopro_path
)
{
// TODO: 导入YGOPRO
// 示例: "C:\\Users\\a915329096\\AppData\\Roaming\\mycard\\apps\\ygopro"
// 不带任何reference,如果同盘符已有库,安装到那个库里,否则在那个盘符建个库。
let
library
:
string
|
undefined
;
if
(
process
.
platform
==
'
win32
'
)
{
let
volume
=
legacy_ygopro_path
.
split
(
'
:
'
)[
0
].
toUpperCase
();
for
(
let
_library
of
this
.
settingsService
.
getLibraries
())
{
if
(
_library
.
path
.
split
(
'
:
'
)[
0
].
toUpperCase
()
==
volume
)
{
library
=
_library
.
path
}
}
try
{
let
library
=
path
.
join
(
volume
+
'
:
'
,
"
MyCardLibrary
"
);
await
this
.
createDirectory
(
library
);
this
.
settingsService
.
addLibrary
(
library
,
true
);
}
catch
(
error
)
{
}
}
if
(
!
library
)
{
library
=
this
.
settingsService
.
getDefaultLibrary
().
path
;
}
let
option
=
new
InstallOption
(
app
,
library
,
false
,
false
);
console
.
log
(
'
migrate ygopro
'
,
legacy_ygopro_path
,
library
);
await
this
.
importApp
(
app
,
legacy_ygopro_path
,
option
);
localStorage
.
setItem
(
'
migrate_v2_ygopro
'
,
"
true
"
)
}
}
catch
(
error
)
{
}
}
...
...
app/lobby.component.ts
View file @
30324532
...
...
@@ -30,7 +30,6 @@ 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
);
}
...
...
@@ -53,6 +52,7 @@ export class LobbyComponent implements OnInit {
params
.
set
(
'
autojoin
'
,
this
.
currentApp
.
conference
+
'
@conference.mycard.moe
'
);
}
this
.
candy_url
=
url
;
await
this
.
appsService
.
migrate
();
}
chooseApp
(
app
:
App
)
{
...
...
app/settings.sevices.ts
View file @
30324532
...
...
@@ -5,7 +5,7 @@ import {Injectable} from "@angular/core";
import
{
remote
}
from
"
electron
"
;
import
*
as
path
from
"
path
"
;
interface
Library
{
export
interface
Library
{
"
default
"
:
boolean
,
path
:
string
}
...
...
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