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
55b92a24
Commit
55b92a24
authored
Sep 14, 2023
by
fallenstardust
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
webactivity调用相同addserver方法
parent
4792f85f
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
52 deletions
+3
-52
mobile/src/main/java/cn/garymb/ygomobile/ui/activities/WebActivity.java
...n/java/cn/garymb/ygomobile/ui/activities/WebActivity.java
+3
-52
No files found.
mobile/src/main/java/cn/garymb/ygomobile/ui/activities/WebActivity.java
View file @
55b92a24
...
...
@@ -5,6 +5,8 @@ import static cn.garymb.ygomobile.Constants.URL_YGO233_ADVANCE;
import
static
cn
.
garymb
.
ygomobile
.
Constants
.
URL_YGO233_FILE
;
import
static
cn
.
garymb
.
ygomobile
.
Constants
.
URL_YGO233_FILE_ALT
;
import
static
cn
.
garymb
.
ygomobile
.
utils
.
DownloadUtil
.
TYPE_DOWNLOAD_EXCEPTION
;
import
static
cn
.
garymb
.
ygomobile
.
utils
.
DownloadUtil
.
get
;
import
static
cn
.
garymb
.
ygomobile
.
utils
.
ServerUtil
.
AddServer
;
import
android.annotation.SuppressLint
;
import
android.content.Context
;
...
...
@@ -121,7 +123,7 @@ public class WebActivity extends BaseActivity implements View.OnClickListener {
servername
=
"YGOPRO 사전 게시 중국서버"
;
if
(
AppsSettings
.
get
().
getDataLanguage
()
==
2
)
servername
=
"Mercury23333 OCG/TCG Pre-release"
;
AddServer
(
servername
,
"s1.ygo233.com"
,
23333
,
"Knight of Hanoi"
);
AddServer
(
getActivity
(),
servername
,
"s1.ygo233.com"
,
23333
,
"Knight of Hanoi"
);
btn_download
.
setVisibility
(
View
.
GONE
);
SharedPreferenceUtil
.
setExpansionDataVer
(
WebActivity
.
exCardVer
);
break
;
...
...
@@ -349,57 +351,6 @@ public class WebActivity extends BaseActivity implements View.OnClickListener {
WebActivity
.
open
(
context
,
cardInfo
.
Name
,
uri
);
}
public
void
AddServer
(
String
name
,
String
Addr
,
int
port
,
String
playername
)
{
mServerInfo
=
new
ServerInfo
();
mServerInfo
.
setName
(
name
);
mServerInfo
.
setServerAddr
(
Addr
);
mServerInfo
.
setPort
(
port
);
mServerInfo
.
setPlayerName
(
playername
);
VUiKit
.
defer
().
when
(()
->
{
ServerList
assetList
=
ServerListManager
.
readList
(
this
.
getAssets
().
open
(
ASSET_SERVER_LIST
));
ServerList
fileList
=
xmlFile
.
exists
()
?
ServerListManager
.
readList
(
new
FileInputStream
(
xmlFile
))
:
null
;
if
(
fileList
==
null
)
{
return
assetList
;
}
if
(
fileList
.
getVercode
()
<
assetList
.
getVercode
())
{
xmlFile
.
delete
();
return
assetList
;
}
return
fileList
;
}).
done
((
list
)
->
{
if
(
list
!=
null
)
{
serverInfos
.
clear
();
serverInfos
.
addAll
(
list
.
getServerInfoList
());
boolean
hasServer
=
false
;
for
(
int
i
=
0
;
i
<
list
.
getServerInfoList
().
size
();
i
++)
{
if
(
mServerInfo
.
getPort
()
!=
serverInfos
.
get
(
i
).
getPort
()
&&
mServerInfo
.
getServerAddr
()
!=
serverInfos
.
get
(
i
).
getServerAddr
())
{
continue
;
}
else
{
hasServer
=
true
;
break
;
}
}
if
(!
hasServer
&&
!
serverInfos
.
contains
(
mServerInfo
))
{
serverInfos
.
add
(
mServerInfo
);
}
saveItems
();
}
});
}
public
void
saveItems
()
{
OutputStream
outputStream
=
null
;
try
{
outputStream
=
new
FileOutputStream
(
xmlFile
);
XmlUtils
.
get
().
saveXml
(
new
ServerList
(
SystemUtils
.
getVersion
(
getContext
()),
serverInfos
),
outputStream
);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
finally
{
IOUtils
.
close
(
outputStream
);
}
}
private
void
downloadfromWeb
(
String
fileUrl
)
{
File
file
=
new
File
(
AppsSettings
.
get
().
getResourcePath
()
+
"-preRlease.zip"
);
if
(
file
.
exists
())
{
...
...
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