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
42cbf58e
Commit
42cbf58e
authored
Apr 22, 2021
by
fallenstardust
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
已存在的ypk,yrp文件不做处理只给提示
parent
e6dc8ca4
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
13 deletions
+23
-13
mobile/src/main/java/cn/garymb/ygomobile/GameUriManager.java
mobile/src/main/java/cn/garymb/ygomobile/GameUriManager.java
+23
-13
No files found.
mobile/src/main/java/cn/garymb/ygomobile/GameUriManager.java
View file @
42cbf58e
...
@@ -134,11 +134,15 @@ public class GameUriManager {
...
@@ -134,11 +134,15 @@ public class GameUriManager {
activity
.
startActivity
(
startdeck
);
activity
.
startActivity
(
startdeck
);
}
else
if
(
file
.
getName
().
toLowerCase
(
Locale
.
US
).
endsWith
(
".ypk"
))
{
}
else
if
(
file
.
getName
().
toLowerCase
(
Locale
.
US
).
endsWith
(
".ypk"
))
{
File
ypk
=
new
File
(
AppsSettings
.
get
().
getExpansionsPath
()
+
"/"
+
file
.
getName
().
toLowerCase
(
Locale
.
US
));
File
ypk
=
new
File
(
AppsSettings
.
get
().
getExpansionsPath
()
+
"/"
+
file
.
getName
().
toLowerCase
(
Locale
.
US
));
if
(
ypk
.
exists
())
{
Toast
.
makeText
(
activity
,
activity
.
getString
(
R
.
string
.
file_exist
),
Toast
.
LENGTH_LONG
).
show
();
}
else
{
try
{
try
{
FileUtils
.
copyFile
(
file
,
ypk
);
FileUtils
.
copyFile
(
file
,
ypk
);
}
catch
(
Throwable
e
)
{
}
catch
(
Throwable
e
)
{
Toast
.
makeText
(
activity
,
activity
.
getString
(
R
.
string
.
install_failed_bcos
)
+
e
,
Toast
.
LENGTH_LONG
).
show
();
Toast
.
makeText
(
activity
,
activity
.
getString
(
R
.
string
.
install_failed_bcos
)
+
e
,
Toast
.
LENGTH_LONG
).
show
();
}
}
}
if
(!
AppsSettings
.
get
().
isReadExpansions
())
{
if
(!
AppsSettings
.
get
().
isReadExpansions
())
{
activity
.
startActivity
(
startSeting
);
activity
.
startActivity
(
startSeting
);
Toast
.
makeText
(
activity
,
R
.
string
.
ypk_go_setting
,
Toast
.
LENGTH_LONG
).
show
();
Toast
.
makeText
(
activity
,
R
.
string
.
ypk_go_setting
,
Toast
.
LENGTH_LONG
).
show
();
...
@@ -148,8 +152,9 @@ public class GameUriManager {
...
@@ -148,8 +152,9 @@ public class GameUriManager {
}
}
}
else
if
(
file
.
getName
().
toLowerCase
(
Locale
.
US
).
endsWith
(
".yrp"
))
{
}
else
if
(
file
.
getName
().
toLowerCase
(
Locale
.
US
).
endsWith
(
".yrp"
))
{
File
yrp
=
new
File
(
AppsSettings
.
get
().
getResourcePath
()
+
"/"
+
CORE_REPLAY_PATH
+
"/"
+
file
.
getName
().
toLowerCase
(
Locale
.
US
));
File
yrp
=
new
File
(
AppsSettings
.
get
().
getResourcePath
()
+
"/"
+
CORE_REPLAY_PATH
+
"/"
+
file
.
getName
().
toLowerCase
(
Locale
.
US
));
if
(
yrp
.
getAbsolutePath
().
equals
(
file
))
{
if
(
yrp
.
exists
(
))
{
YGOStarter
.
startGame
(
getActivity
(),
null
);
YGOStarter
.
startGame
(
getActivity
(),
null
);
Toast
.
makeText
(
activity
,
activity
.
getString
(
R
.
string
.
file_exist
),
Toast
.
LENGTH_LONG
).
show
();
}
else
{
}
else
{
try
{
try
{
FileUtils
.
copyFile
(
file
,
yrp
);
FileUtils
.
copyFile
(
file
,
yrp
);
...
@@ -190,6 +195,9 @@ public class GameUriManager {
...
@@ -190,6 +195,9 @@ public class GameUriManager {
try
{
try
{
File
ypk
=
new
File
(
AppsSettings
.
get
().
getExpansionsPath
()
+
"/"
+
urifile
.
getName
().
toLowerCase
(
Locale
.
US
));
File
ypk
=
new
File
(
AppsSettings
.
get
().
getExpansionsPath
()
+
"/"
+
urifile
.
getName
().
toLowerCase
(
Locale
.
US
));
ParcelFileDescriptor
pfd
=
getActivity
().
getContentResolver
().
openFileDescriptor
(
uri
,
"r"
);
ParcelFileDescriptor
pfd
=
getActivity
().
getContentResolver
().
openFileDescriptor
(
uri
,
"r"
);
if
(
ypk
.
exists
())
{
Toast
.
makeText
(
activity
,
activity
.
getString
(
R
.
string
.
file_exist
),
Toast
.
LENGTH_SHORT
).
show
();
}
else
{
if
(
pfd
==
null
)
{
if
(
pfd
==
null
)
{
return
;
return
;
}
else
{
}
else
{
...
@@ -201,6 +209,7 @@ public class GameUriManager {
...
@@ -201,6 +209,7 @@ public class GameUriManager {
pfd
.
close
();
pfd
.
close
();
}
}
}
}
}
}
catch
(
Throwable
e
)
{
}
catch
(
Throwable
e
)
{
e
.
printStackTrace
();
e
.
printStackTrace
();
}
}
...
@@ -217,6 +226,7 @@ public class GameUriManager {
...
@@ -217,6 +226,7 @@ public class GameUriManager {
ParcelFileDescriptor
pfd
=
getActivity
().
getContentResolver
().
openFileDescriptor
(
uri
,
"r"
);
ParcelFileDescriptor
pfd
=
getActivity
().
getContentResolver
().
openFileDescriptor
(
uri
,
"r"
);
if
(
yrp
.
exists
())
{
if
(
yrp
.
exists
())
{
YGOStarter
.
startGame
(
getActivity
(),
null
);
YGOStarter
.
startGame
(
getActivity
(),
null
);
Toast
.
makeText
(
activity
,
activity
.
getString
(
R
.
string
.
file_exist
),
Toast
.
LENGTH_SHORT
).
show
();
}
else
{
}
else
{
if
(
pfd
==
null
)
{
if
(
pfd
==
null
)
{
return
;
return
;
...
...
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