Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Y
YGOMobile-Cn-Ko-En
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
fallenstardust
YGOMobile-Cn-Ko-En
Commits
6f9b8948
Commit
6f9b8948
authored
Jul 01, 2025
by
fallenstardust
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix保存和路径和卡组名重复拼接
parent
1404712a
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
11 deletions
+6
-11
mobile/src/main/java/cn/garymb/ygomobile/deck_square/DeckSquareApiUtil.java
...va/cn/garymb/ygomobile/deck_square/DeckSquareApiUtil.java
+6
-11
No files found.
mobile/src/main/java/cn/garymb/ygomobile/deck_square/DeckSquareApiUtil.java
View file @
6f9b8948
...
@@ -44,7 +44,7 @@ import okhttp3.Response;
...
@@ -44,7 +44,7 @@ import okhttp3.Response;
public
class
DeckSquareApiUtil
{
public
class
DeckSquareApiUtil
{
private
static
final
String
TAG
=
"
seesee
decksquareApiUtil"
;
private
static
final
String
TAG
=
"decksquareApiUtil"
;
public
static
boolean
needLogin
()
{
public
static
boolean
needLogin
()
{
...
@@ -456,7 +456,6 @@ public class DeckSquareApiUtil {
...
@@ -456,7 +456,6 @@ public class DeckSquareApiUtil {
localDeckName
=
localDeckName
.
replace
(
".ydk"
,
""
);
localDeckName
=
localDeckName
.
replace
(
".ydk"
,
""
);
for
(
MyOnlineDeckDetail
onlineDeck
:
onlineDecks
)
{
for
(
MyOnlineDeckDetail
onlineDeck
:
onlineDecks
)
{
if
(
localDeckName
.
equals
(
onlineDeck
.
getDeckName
()))
{
if
(
localDeckName
.
equals
(
onlineDeck
.
getDeckName
()))
{
// 标记该在线卡组已处理
// 标记该在线卡组已处理
onlineDeckProcessed
.
put
(
onlineDeck
.
getDeckName
(),
true
);
onlineDeckProcessed
.
put
(
onlineDeck
.
getDeckName
(),
true
);
...
@@ -469,6 +468,7 @@ public class DeckSquareApiUtil {
...
@@ -469,6 +468,7 @@ public class DeckSquareApiUtil {
onlineUpdateDate
=
String
.
valueOf
(
dateTime
.
toInstant
(
ZoneOffset
.
UTC
).
toEpochMilli
());
onlineUpdateDate
=
String
.
valueOf
(
dateTime
.
toInstant
(
ZoneOffset
.
UTC
).
toEpochMilli
());
}
}
LogUtil
.
d
(
"seesee"
,
localUpdateDate
+
"//"
+
onlineUpdateDate
);
LogUtil
.
d
(
"seesee"
,
localUpdateDate
+
"//"
+
onlineUpdateDate
);
LogUtil
.
w
(
"seesee lockdeck.getDeckPath"
,
localDeck
.
getDeckPath
());
if
(
onlineUpdateDate
!=
null
&&
(
localUpdateDate
==
null
||
onlineUpdateDate
.
compareTo
(
localUpdateDate
)
>
0
))
{
if
(
onlineUpdateDate
!=
null
&&
(
localUpdateDate
==
null
||
onlineUpdateDate
.
compareTo
(
localUpdateDate
)
>
0
))
{
// 在线卡组更新时间更晚,下载在线卡组覆盖本地卡组
// 在线卡组更新时间更晚,下载在线卡组覆盖本地卡组
downloadOnlineDeck
(
onlineDeck
,
localDeck
.
getDeckPath
());
downloadOnlineDeck
(
onlineDeck
,
localDeck
.
getDeckPath
());
...
@@ -501,11 +501,8 @@ public class DeckSquareApiUtil {
...
@@ -501,11 +501,8 @@ public class DeckSquareApiUtil {
return
false
;
return
false
;
}
}
MyOnlineDeckDetail
deckDetail
=
deckResponse
.
getData
();
String
deckContent
=
deckDetail
.
getDeckYdk
();
// 构建本地文件路径
// 构建本地文件路径
String
deckDirectory
=
AppsSettings
.
get
().
get
ResourcePath
()
+
"/"
+
Constants
.
CORE_DECK_PATH
;
String
deckDirectory
=
AppsSettings
.
get
().
get
DeckDir
()
;
File
dir
=
new
File
(
deckDirectory
);
File
dir
=
new
File
(
deckDirectory
);
if
(!
dir
.
exists
())
{
if
(!
dir
.
exists
())
{
boolean
created
=
dir
.
mkdirs
();
boolean
created
=
dir
.
mkdirs
();
...
@@ -524,13 +521,13 @@ public class DeckSquareApiUtil {
...
@@ -524,13 +521,13 @@ public class DeckSquareApiUtil {
String
filePath
=
deckDirectory
+
"/"
+
fileName
;
String
filePath
=
deckDirectory
+
"/"
+
fileName
;
// 保存在线卡组到本地
// 保存在线卡组到本地
boolean
saved
=
DeckSquareFileUtil
.
saveFileToPath
(
filePath
,
onlineDeck
.
getDeckName
(),
deckContent
);
boolean
saved
=
DeckSquareFileUtil
.
saveFileToPath
(
deckDirectory
,
fileName
,
deckResponse
.
getData
().
getDeckYdk
()
);
if
(!
saved
)
{
if
(!
saved
)
{
LogUtil
.
e
(
TAG
,
"downloadMissingDeckToLocal-Failed to save deck file: "
+
filePath
);
LogUtil
.
e
(
TAG
,
"downloadMissingDeckToLocal-Failed to save deck file: "
+
filePath
);
return
false
;
return
false
;
}
}
LogUtil
.
i
(
TAG
,
"Deck saved to: "
+
filePath
);
LogUtil
.
i
(
TAG
,
"
downloadMissingDeckToLocal-
Deck saved to: "
+
filePath
);
// 更新本地卡组列表
// 更新本地卡组列表
MyDeckItem
newLocalDeck
=
new
MyDeckItem
();
MyDeckItem
newLocalDeck
=
new
MyDeckItem
();
...
@@ -557,11 +554,9 @@ public class DeckSquareApiUtil {
...
@@ -557,11 +554,9 @@ public class DeckSquareApiUtil {
return
false
;
return
false
;
}
}
MyOnlineDeckDetail
deckDetail
=
deckResponse
.
getData
();
String
deckContent
=
deckDetail
.
getDeckYdk
();
// 保存在线卡组到本地
// 保存在线卡组到本地
boolean
saved
=
DeckSquareFileUtil
.
saveFileToPath
(
localPath
,
onlineDeck
.
getDeckName
(),
deck
Content
);
boolean
saved
=
DeckSquareFileUtil
.
saveFileToPath
(
localPath
,
onlineDeck
.
getDeckName
(),
deck
Response
.
getData
().
getDeckYdk
()
);
if
(!
saved
)
{
if
(!
saved
)
{
LogUtil
.
e
(
TAG
,
"downloadOnlineDeck-Failed to save deck file: "
+
localPath
);
LogUtil
.
e
(
TAG
,
"downloadOnlineDeck-Failed to save deck file: "
+
localPath
);
return
false
;
return
false
;
...
...
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