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
d55521a5
Commit
d55521a5
authored
Apr 08, 2020
by
fallenstardust
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
搬运原目录文件
parent
60ede78e
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
37 additions
and
4 deletions
+37
-4
mobile/build.gradle
mobile/build.gradle
+1
-1
mobile/src/main/java/cn/garymb/ygomobile/ui/home/ResCheckTask.java
...c/main/java/cn/garymb/ygomobile/ui/home/ResCheckTask.java
+14
-3
mobile/src/main/java/cn/garymb/ygomobile/utils/FileUtils.java
...le/src/main/java/cn/garymb/ygomobile/utils/FileUtils.java
+22
-0
No files found.
mobile/build.gradle
View file @
d55521a5
...
@@ -8,7 +8,7 @@ android {
...
@@ -8,7 +8,7 @@ android {
applicationId
"cn.garymb.ygomobile"
applicationId
"cn.garymb.ygomobile"
minSdkVersion
21
minSdkVersion
21
targetSdkVersion
28
targetSdkVersion
28
versionCode
37000040
8
versionCode
37000040
9
versionName
"3.7.0"
versionName
"3.7.0"
flavorDimensions
"versionCode"
flavorDimensions
"versionCode"
vectorDrawables
.
useSupportLibrary
=
true
vectorDrawables
.
useSupportLibrary
=
true
...
...
mobile/src/main/java/cn/garymb/ygomobile/ui/home/ResCheckTask.java
View file @
d55521a5
...
@@ -210,13 +210,17 @@ public class ResCheckTask extends AsyncTask<Void, Integer, Integer> {
...
@@ -210,13 +210,17 @@ public class ResCheckTask extends AsyncTask<Void, Integer, Integer> {
ConfigManager
systemConf
=
DataManager
.
openConfig
(
mSettings
.
getSystemConfig
());
ConfigManager
systemConf
=
DataManager
.
openConfig
(
mSettings
.
getSystemConfig
());
systemConf
.
setFontSize
(
mSettings
.
getFontSize
());
systemConf
.
setFontSize
(
mSettings
.
getFontSize
());
systemConf
.
close
();
systemConf
.
close
();
//原目录文件路径
String
deck
=
Environment
.
getExternalStorageDirectory
()
+
"/"
+
Constants
.
PREF_DEF_GAME_DIR
+
"/"
+
Constants
.
CORE_DECK_PATH
;
String
replay
=
Environment
.
getExternalStorageDirectory
()
+
"/"
+
Constants
.
PREF_DEF_GAME_DIR
+
"/"
+
Constants
.
CORE_REPLAY_PATH
;
String
textures
=
Environment
.
getExternalStorageDirectory
()
+
"/"
+
Constants
.
PREF_DEF_GAME_DIR
+
"/"
+
Constants
.
CORE_SKIN_PATH
;
String
pics
=
Environment
.
getExternalStorageDirectory
()
+
"/"
+
Constants
.
PREF_DEF_GAME_DIR
+
"/"
+
Constants
.
CORE_IMAGE_PATH
;
InputStream
fisdeck
=
new
FileInputStream
(
Environment
.
getExternalStorageDirectory
()
+
"/"
+
Constants
.
PREF_DEF_GAME_DIR
+
"/"
+
Constants
.
CORE_DECK_PATH
);
//如果是新版本
//如果是新版本
if
(
needsUpdate
)
{
if
(
needsUpdate
)
{
//复制卡组
//复制卡组
setMessage
(
mContext
.
getString
(
R
.
string
.
check_things
,
mContext
.
getString
(
R
.
string
.
tip_new_deck
)));
setMessage
(
mContext
.
getString
(
R
.
string
.
check_things
,
mContext
.
getString
(
R
.
string
.
tip_new_deck
)));
IOUtils
.
copyToFile
(
fisdeck
,
mContext
.
getExternalFilesDir
(
Constants
.
CORE_DECK_PATH
).
getAbsolutePath
());
IOUtils
.
copyFilesFromAssets
(
mContext
,
getDatapath
(
Constants
.
CORE_DECK_PATH
),
IOUtils
.
copyFilesFromAssets
(
mContext
,
getDatapath
(
Constants
.
CORE_DECK_PATH
),
mSettings
.
getDeckDir
(),
needsUpdate
);
mSettings
.
getDeckDir
(),
needsUpdate
);
//复制卡包
//复制卡包
...
@@ -266,7 +270,14 @@ public class ResCheckTask extends AsyncTask<Void, Integer, Integer> {
...
@@ -266,7 +270,14 @@ public class ResCheckTask extends AsyncTask<Void, Integer, Integer> {
}
}
//复制人机资源
//复制人机资源
IOUtils
.
copyFilesFromAssets
(
mContext
,
getDatapath
(
Constants
.
WINDBOT_PATH
),
IOUtils
.
copyFilesFromAssets
(
mContext
,
getDatapath
(
Constants
.
WINDBOT_PATH
),
resPath
,
needsUpdate
);
//mContext.getFilesDir().getPath()
resPath
,
needsUpdate
);
//复制原目录文件
FileUtils
.
copyDir
(
deck
,
mSettings
.
getDeckDir
());
FileUtils
.
copyDir
(
replay
,
resPath
+
"/"
+
Constants
.
CORE_REPLAY_PATH
);
FileUtils
.
copyDir
(
textures
,
mSettings
.
getCoreSkinPath
());
FileUtils
.
copyDir
(
pics
,
mSettings
.
getCardImagePath
());
han
.
sendEmptyMessage
(
0
);
han
.
sendEmptyMessage
(
0
);
loadData
();
loadData
();
...
...
mobile/src/main/java/cn/garymb/ygomobile/utils/FileUtils.java
View file @
d55521a5
...
@@ -170,6 +170,28 @@ public class FileUtils {
...
@@ -170,6 +170,28 @@ public class FileUtils {
out
.
write
(
data
,
0
,
len
);
out
.
write
(
data
,
0
,
len
);
}
}
}
}
//复制文件夹全部文件
public
static
void
copyDir
(
String
oldPath
,
String
newPath
)
throws
IOException
{
File
file
=
new
File
(
oldPath
);
//文件名称列表
String
[]
filePath
=
file
.
list
();
if
(!(
new
File
(
newPath
)).
exists
())
{
(
new
File
(
newPath
)).
mkdir
();
}
for
(
int
i
=
0
;
i
<
filePath
.
length
;
i
++)
{
if
((
new
File
(
oldPath
+
file
.
separator
+
filePath
[
i
])).
isDirectory
())
{
copyDir
(
oldPath
+
file
.
separator
+
filePath
[
i
],
newPath
+
file
.
separator
+
filePath
[
i
]);
}
if
(
new
File
(
oldPath
+
file
.
separator
+
filePath
[
i
]).
isFile
())
{
if
(!(
new
File
(
newPath
+
file
.
separator
+
filePath
[
i
]).
exists
()))
copyFile
(
oldPath
+
file
.
separator
+
filePath
[
i
],
newPath
+
file
.
separator
+
filePath
[
i
],
true
);
}
}
}
//删除文件(String Path)
//删除文件(String Path)
public
static
void
delFile
(
String
s
)
{
public
static
void
delFile
(
String
s
)
{
...
...
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