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
b5e80eab
Commit
b5e80eab
authored
Apr 07, 2019
by
feihuaduo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修复多个压缩包数据库读取的问题
修复压缩包内有中文文件崩溃的问题
parent
3264cf60
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
6 deletions
+13
-6
mobile/libs/ZipEntry.jar
mobile/libs/ZipEntry.jar
+0
-0
mobile/src/main/java/ocgcore/CardManager.java
mobile/src/main/java/ocgcore/CardManager.java
+13
-6
No files found.
mobile/libs/ZipEntry.jar
0 → 100644
View file @
b5e80eab
File added
mobile/src/main/java/ocgcore/CardManager.java
View file @
b5e80eab
...
@@ -6,6 +6,9 @@ import android.support.annotation.WorkerThread;
...
@@ -6,6 +6,9 @@ import android.support.annotation.WorkerThread;
import
android.util.Log
;
import
android.util.Log
;
import
android.util.SparseArray
;
import
android.util.SparseArray
;
import
com.file.zip.ZipEntry
;
import
com.file.zip.ZipFile
;
import
java.io.BufferedInputStream
;
import
java.io.BufferedInputStream
;
import
java.io.File
;
import
java.io.File
;
import
java.io.FileInputStream
;
import
java.io.FileInputStream
;
...
@@ -15,11 +18,11 @@ import java.io.IOException;
...
@@ -15,11 +18,11 @@ import java.io.IOException;
import
java.io.InputStream
;
import
java.io.InputStream
;
import
java.io.OutputStream
;
import
java.io.OutputStream
;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
import
java.util.Enumeration
;
import
java.util.List
;
import
java.util.List
;
import
java.util.zip.ZipEntry
;
import
java.util.zip.ZipFile
;
import
java.util.zip.ZipInputStream
;
import
java.util.zip.ZipInputStream
;
import
cn.garymb.ygomobile.App
;
import
cn.garymb.ygomobile.App
;
import
cn.garymb.ygomobile.AppsSettings
;
import
cn.garymb.ygomobile.AppsSettings
;
import
cn.garymb.ygomobile.utils.IOUtils
;
import
cn.garymb.ygomobile.utils.IOUtils
;
...
@@ -29,6 +32,7 @@ import ocgcore.data.Card;
...
@@ -29,6 +32,7 @@ import ocgcore.data.Card;
public
class
CardManager
{
public
class
CardManager
{
private
String
dbDir
,
exDbPath
;
private
String
dbDir
,
exDbPath
;
private
final
SparseArray
<
Card
>
cardDataHashMap
=
new
SparseArray
<>();
private
final
SparseArray
<
Card
>
cardDataHashMap
=
new
SparseArray
<>();
private
static
int
cdbNum
=
0
;
public
CardManager
(
String
dbDir
,
String
exPath
)
{
public
CardManager
(
String
dbDir
,
String
exPath
)
{
this
.
dbDir
=
dbDir
;
this
.
dbDir
=
dbDir
;
...
@@ -122,17 +126,19 @@ public class CardManager {
...
@@ -122,17 +126,19 @@ public class CardManager {
public
static
List
<
File
>
readZipCdb
(
String
zipPath
)
throws
IOException
{
public
static
List
<
File
>
readZipCdb
(
String
zipPath
)
throws
IOException
{
String
savePath
=
App
.
get
().
getExternalCacheDir
().
getAbsolutePath
();
String
savePath
=
App
.
get
().
getExternalCacheDir
().
getAbsolutePath
();
List
<
File
>
fileList
=
new
ArrayList
<>();
List
<
File
>
fileList
=
new
ArrayList
<>();
int
num
=
0
;
ZipFile
zf
=
new
ZipFile
(
zipPath
);
ZipFile
zf
=
new
ZipFile
(
zipPath
,
"GBK"
);
InputStream
in
=
new
BufferedInputStream
(
new
FileInputStream
(
zipPath
));
InputStream
in
=
new
BufferedInputStream
(
new
FileInputStream
(
zipPath
));
ZipInputStream
zin
=
new
ZipInputStream
(
in
);
ZipInputStream
zin
=
new
ZipInputStream
(
in
);
ZipEntry
ze
;
ZipEntry
ze
;
while
((
ze
=
zin
.
getNextEntry
())
!=
null
)
{
Enumeration
<
ZipEntry
>
entris
=
zf
.
getEntries
();
while
(
entris
.
hasMoreElements
())
{
ze
=
entris
.
nextElement
();
if
(
ze
.
isDirectory
())
{
if
(
ze
.
isDirectory
())
{
//Do nothing
//Do nothing
}
else
{
}
else
{
if
(
ze
.
getName
().
endsWith
(
".cdb"
))
{
if
(
ze
.
getName
().
endsWith
(
".cdb"
))
{
File
file
=
new
File
(
savePath
,
"cards"
+
n
um
+
".cdb"
);
File
file
=
new
File
(
savePath
,
"cards"
+
cdbN
um
+
".cdb"
);
InputStream
inputStream
=
zf
.
getInputStream
(
ze
);
InputStream
inputStream
=
zf
.
getInputStream
(
ze
);
OutputStream
os
=
new
FileOutputStream
(
file
);
OutputStream
os
=
new
FileOutputStream
(
file
);
int
bytesRead
=
0
;
int
bytesRead
=
0
;
...
@@ -143,6 +149,7 @@ public class CardManager {
...
@@ -143,6 +149,7 @@ public class CardManager {
os
.
close
();
os
.
close
();
inputStream
.
close
();
inputStream
.
close
();
fileList
.
add
(
file
);
fileList
.
add
(
file
);
cdbNum
++;
}
}
}
}
}
}
...
...
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