Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Y
YGOMobile
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
Commits
4cb4a1dd
Commit
4cb4a1dd
authored
Apr 29, 2020
by
fallenstardust
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
支持读取ypk文件
parent
8ca9e64e
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
20 additions
and
7 deletions
+20
-7
Classes/gframe/game.cpp
Classes/gframe/game.cpp
+2
-2
mobile/src/main/java/cn/garymb/ygomobile/AppsSettings.java
mobile/src/main/java/cn/garymb/ygomobile/AppsSettings.java
+11
-0
mobile/src/main/java/cn/garymb/ygomobile/loader/ImageLoader.java
...src/main/java/cn/garymb/ygomobile/loader/ImageLoader.java
+1
-1
mobile/src/main/java/cn/garymb/ygomobile/utils/DeckUtil.java
mobile/src/main/java/cn/garymb/ygomobile/utils/DeckUtil.java
+1
-1
mobile/src/main/java/ocgcore/CardManager.java
mobile/src/main/java/ocgcore/CardManager.java
+2
-2
mobile/src/main/java/ocgcore/StringManager.java
mobile/src/main/java/ocgcore/StringManager.java
+3
-1
No files found.
Classes/gframe/game.cpp
View file @
4cb4a1dd
...
@@ -1300,11 +1300,11 @@ void Game::LoadExpansions() {
...
@@ -1300,11 +1300,11 @@ void Game::LoadExpansions() {
return
;
return
;
while
((
dirp
=
readdir
(
dir
))
!=
NULL
)
{
while
((
dirp
=
readdir
(
dir
))
!=
NULL
)
{
size_t
len
=
strlen
(
dirp
->
d_name
);
size_t
len
=
strlen
(
dirp
->
d_name
);
if
(
len
<
5
||
strcasecmp
(
dirp
->
d_name
+
len
-
4
,
".zip"
)
!=
0
)
if
(
len
<
5
||
strcasecmp
(
dirp
->
d_name
+
len
-
4
,
".zip"
)
!=
0
||
strcasecmp
(
dirp
->
d_name
+
len
-
4
,
".ypk"
)
!=
0
)
continue
;
continue
;
char
upath
[
1024
];
char
upath
[
1024
];
sprintf
(
upath
,
"./expansions/%s"
,
dirp
->
d_name
);
sprintf
(
upath
,
"./expansions/%s"
,
dirp
->
d_name
);
dataManager
.
FileSystem
->
addFileArchive
(
upath
,
true
,
false
);
dataManager
.
FileSystem
->
addFileArchive
(
upath
,
true
,
false
,
EFAT_ZIP
);
}
}
closedir
(
dir
);
closedir
(
dir
);
#endif
#endif
...
...
mobile/src/main/java/cn/garymb/ygomobile/AppsSettings.java
View file @
4cb4a1dd
...
@@ -257,6 +257,17 @@ public class AppsSettings {
...
@@ -257,6 +257,17 @@ public class AppsSettings {
pathList
.
add
(
file
.
getAbsolutePath
());
pathList
.
add
(
file
.
getAbsolutePath
());
}
}
}
}
File
[]
ypks
=
expansionsDir
.
listFiles
(
new
FileFilter
()
{
@Override
public
boolean
accept
(
File
file
)
{
return
file
.
isFile
()
&&
file
.
getName
().
toLowerCase
(
Locale
.
US
).
endsWith
(
".ypk"
);
}
});
if
(
ypks
!=
null
)
{
for
(
File
file
:
ypks
)
{
pathList
.
add
(
file
.
getAbsolutePath
());
}
}
}
}
}
}
}
}
...
...
mobile/src/main/java/cn/garymb/ygomobile/loader/ImageLoader.java
View file @
4cb4a1dd
...
@@ -227,7 +227,7 @@ public class ImageLoader implements Closeable {
...
@@ -227,7 +227,7 @@ public class ImageLoader implements Closeable {
File
[]
files
=
new
File
(
AppsSettings
.
get
().
getResourcePath
(),
Constants
.
CORE_EXPANSIONS
).
listFiles
();
File
[]
files
=
new
File
(
AppsSettings
.
get
().
getResourcePath
(),
Constants
.
CORE_EXPANSIONS
).
listFiles
();
if
(
files
!=
null
)
{
if
(
files
!=
null
)
{
for
(
File
file
:
files
)
{
for
(
File
file
:
files
)
{
if
(
file
.
isFile
()
&&
file
.
getName
().
endsWith
(
".zip"
))
{
if
(
file
.
isFile
()
&&
(
file
.
getName
().
endsWith
(
".zip"
)
||
file
.
getName
().
endsWith
(
".ypk"
)
))
{
ZipEntry
entry
=
null
;
ZipEntry
entry
=
null
;
InputStream
inputStream
=
null
;
InputStream
inputStream
=
null
;
ByteArrayOutputStream
outputStream
=
null
;
ByteArrayOutputStream
outputStream
=
null
;
...
...
mobile/src/main/java/cn/garymb/ygomobile/utils/DeckUtil.java
View file @
4cb4a1dd
...
@@ -96,7 +96,7 @@ public class DeckUtil {
...
@@ -96,7 +96,7 @@ public class DeckUtil {
}
}
files
=
appsSettings
.
getExpansionsPath
().
listFiles
();
files
=
appsSettings
.
getExpansionsPath
().
listFiles
();
for
(
File
file
:
files
)
{
for
(
File
file
:
files
)
{
if
(
file
.
isFile
()
&&
file
.
getName
().
endsWith
(
".zip"
))
{
if
(
file
.
isFile
()
&&
(
file
.
getName
().
endsWith
(
".zip"
)
||
file
.
getName
().
endsWith
(
".ypk"
)
))
{
ZipFile
zipFile
=
new
ZipFile
(
file
.
getAbsoluteFile
());
ZipFile
zipFile
=
new
ZipFile
(
file
.
getAbsoluteFile
());
Enumeration
entries
=
zipFile
.
entries
();
Enumeration
entries
=
zipFile
.
entries
();
while
(
entries
.
hasMoreElements
())
{
while
(
entries
.
hasMoreElements
())
{
...
...
mobile/src/main/java/ocgcore/CardManager.java
View file @
4cb4a1dd
...
@@ -135,7 +135,7 @@ public class CardManager {
...
@@ -135,7 +135,7 @@ public class CardManager {
@Override
@Override
public
boolean
accept
(
File
dir
,
String
name
)
{
public
boolean
accept
(
File
dir
,
String
name
)
{
File
file
=
new
File
(
dir
,
name
);
File
file
=
new
File
(
dir
,
name
);
return
file
.
isFile
()
&&
(
name
.
endsWith
(
".cdb"
)
||
name
.
endsWith
(
".zip"
));
return
file
.
isFile
()
&&
(
(
name
.
endsWith
(
".cdb"
)
||
(
name
.
endsWith
(
".zip"
)
||
name
.
endsWith
(
".ypk"
))
));
}
}
});
});
//读取全部卡片
//读取全部卡片
...
@@ -143,7 +143,7 @@ public class CardManager {
...
@@ -143,7 +143,7 @@ public class CardManager {
for
(
File
file
:
files
)
{
for
(
File
file
:
files
)
{
if
(
file
.
getName
().
endsWith
(
".cdb"
))
{
if
(
file
.
getName
().
endsWith
(
".cdb"
))
{
count
=
readAllCards
(
file
,
cardDataHashMap
);
count
=
readAllCards
(
file
,
cardDataHashMap
);
}
else
if
(
file
.
getName
().
endsWith
(
".zip"
))
{
}
else
if
(
file
.
getName
().
endsWith
(
".zip"
)
||
file
.
getName
().
endsWith
(
".ypk"
)
)
{
Log
.
e
(
"CardManager"
,
"读取压缩包"
);
Log
.
e
(
"CardManager"
,
"读取压缩包"
);
try
{
try
{
for
(
File
file1
:
readZipCdb
(
file
.
getAbsolutePath
()))
{
for
(
File
file1
:
readZipCdb
(
file
.
getAbsolutePath
()))
{
...
...
mobile/src/main/java/ocgcore/StringManager.java
View file @
4cb4a1dd
package
ocgcore
;
package
ocgcore
;
import
android.text.TextUtils
;
import
android.text.TextUtils
;
import
android.util.Log
;
import
android.util.SparseArray
;
import
android.util.SparseArray
;
import
java.io.BufferedReader
;
import
java.io.BufferedReader
;
...
@@ -52,7 +53,8 @@ public class StringManager implements Closeable {
...
@@ -52,7 +53,8 @@ public class StringManager implements Closeable {
File
[]
files
=
AppsSettings
.
get
().
getExpansionsPath
().
listFiles
();
File
[]
files
=
AppsSettings
.
get
().
getExpansionsPath
().
listFiles
();
if
(
files
!=
null
)
{
if
(
files
!=
null
)
{
for
(
File
file
:
files
)
{
for
(
File
file
:
files
)
{
if
(
file
.
isFile
()
&&
file
.
getName
().
endsWith
(
".zip"
))
{
if
(
file
.
isFile
()
&&
(
file
.
getName
().
endsWith
(
".zip"
)
||
file
.
getName
().
endsWith
(
".ypk"
)))
{
Log
.
e
(
"StringManager"
,
"读取压缩包"
);
try
{
try
{
ZipFile
zipFile
=
new
ZipFile
(
file
.
getAbsoluteFile
());
ZipFile
zipFile
=
new
ZipFile
(
file
.
getAbsoluteFile
());
ZipEntry
entry
=
zipFile
.
getEntry
(
Constants
.
CORE_STRING_PATH
);
ZipEntry
entry
=
zipFile
.
getEntry
(
Constants
.
CORE_STRING_PATH
);
...
...
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