Commit 99557d14 authored by fallenstardust's avatar fallenstardust

替换.ypk为Constants.YPK_FILE_EX

parent b3cfcbd0
...@@ -252,7 +252,7 @@ public class AppsSettings { ...@@ -252,7 +252,7 @@ public class AppsSettings {
return false; return false;
} }
String s_name = file.getName().toLowerCase(); String s_name = file.getName().toLowerCase();
return s_name.endsWith(".zip") || s_name.endsWith(".ypk"); return s_name.endsWith(".zip") || s_name.endsWith(Constants.YPK_FILE_EX);
}); });
} }
......
...@@ -172,7 +172,7 @@ public class GameUriManager { ...@@ -172,7 +172,7 @@ public class GameUriManager {
if (name.toLowerCase(Locale.US).endsWith(YDK_FILE_EX)) { if (name.toLowerCase(Locale.US).endsWith(YDK_FILE_EX)) {
File dir = Constants.COPY_YDK_FILE ? new File(AppsSettings.get().getDeckDir()) : new File(getActivity().getApplicationInfo().dataDir, "cache"); File dir = Constants.COPY_YDK_FILE ? new File(AppsSettings.get().getDeckDir()) : new File(getActivity().getApplicationInfo().dataDir, "cache");
local = getDeckFile(dir, getPathName(path, true)); local = getDeckFile(dir, getPathName(path, true));
} else if (name.toLowerCase(Locale.US).endsWith(".ypk")) { } else if (name.toLowerCase(Locale.US).endsWith(YPK_FILE_EX)) {
String[] words = name.trim().split("[()() ]+"); String[] words = name.trim().split("[()() ]+");
File[] ypkList = AppsSettings.get().getExpansionFiles(); File[] ypkList = AppsSettings.get().getExpansionFiles();
for (int i = 0; i < ypkList.length; i++) { for (int i = 0; i < ypkList.length; i++) {
......
...@@ -133,7 +133,7 @@ public class ExCardListFragment extends Fragment { ...@@ -133,7 +133,7 @@ public class ExCardListFragment extends Fragment {
textDownload.setText("0%");//点击下载后,距离onDownloading触发要等几秒,这一延迟会造成软件响应慢的错觉,因此在下载函数开始就设置文本 textDownload.setText("0%");//点击下载后,距离onDownloading触发要等几秒,这一延迟会造成软件响应慢的错觉,因此在下载函数开始就设置文本
String path = AppsSettings.get().getExpansionsPath().getAbsolutePath(); String path = AppsSettings.get().getExpansionsPath().getAbsolutePath();
String fileName = Constants.officialExCardPackageName; String fileName = Constants.officialExCardPackageName;
File file = new File(path + "/" + fileName + ".ypk"); File file = new File(path + "/" + fileName + Constants.YPK_FILE_EX);
/* 删除旧的先行卡包 */ /* 删除旧的先行卡包 */
File[] files = AppsSettings.get().getExpansionsPath().listFiles(); File[] files = AppsSettings.get().getExpansionsPath().listFiles();
if (files != null) { if (files != null) {
......
...@@ -117,7 +117,7 @@ public class MainActivity extends HomeActivity implements BottomNavigationBar.On ...@@ -117,7 +117,7 @@ public class MainActivity extends HomeActivity implements BottomNavigationBar.On
}); });
dialog.setOnDismissListener(dialogInterface -> { dialog.setOnDismissListener(dialogInterface -> {
DialogPlus dialogplus = new DialogPlus(this); DialogPlus dialogplus = new DialogPlus(this);
File oldypk = new File(AppsSettings.get().getExpansionsPath() + "/" + officialExCardPackageName + ".ypk"); File oldypk = new File(AppsSettings.get().getExpansionsPath() + "/" + officialExCardPackageName + Constants.YPK_FILE_EX);
if (oldypk.exists()) { if (oldypk.exists()) {
FileUtils.deleteFile(oldypk); FileUtils.deleteFile(oldypk);
dialogplus.setMessage(R.string.tip_ypk_is_deleted); dialogplus.setMessage(R.string.tip_ypk_is_deleted);
......
...@@ -4,6 +4,7 @@ import static cn.garymb.ygomobile.Constants.ASSET_SERVER_LIST; ...@@ -4,6 +4,7 @@ import static cn.garymb.ygomobile.Constants.ASSET_SERVER_LIST;
import static cn.garymb.ygomobile.Constants.URL_CN_DATAVER; import static cn.garymb.ygomobile.Constants.URL_CN_DATAVER;
import static cn.garymb.ygomobile.Constants.URL_PRE_CARD; import static cn.garymb.ygomobile.Constants.URL_PRE_CARD;
import static cn.garymb.ygomobile.Constants.URL_SUPERPRE_CN_FILE; import static cn.garymb.ygomobile.Constants.URL_SUPERPRE_CN_FILE;
import static cn.garymb.ygomobile.Constants.YDK_FILE_EX;
import static cn.garymb.ygomobile.utils.StringUtils.isHost; import static cn.garymb.ygomobile.utils.StringUtils.isHost;
import static cn.garymb.ygomobile.utils.StringUtils.isNumeric; import static cn.garymb.ygomobile.utils.StringUtils.isNumeric;
import static cn.garymb.ygomobile.utils.WebParseUtil.isValidIP; import static cn.garymb.ygomobile.utils.WebParseUtil.isValidIP;
...@@ -108,7 +109,7 @@ public class ServerUtil { ...@@ -108,7 +109,7 @@ public class ServerUtil {
* @param file * @param file
*/ */
public static void loadServerInfoFromZipOrYpk(Context context, File file) { public static void loadServerInfoFromZipOrYpk(Context context, File file) {
if (file.getName().endsWith(".zip") || file.getName().endsWith(".ypk")) { if (file.getName().endsWith(".zip") || file.getName().endsWith(YDK_FILE_EX)) {
LogUtil.e("GameUriManager", "读取压缩包"); LogUtil.e("GameUriManager", "读取压缩包");
try { try {
String serverName = null, serverDesc = null, serverHost = null, serverPort = null; String serverName = null, serverDesc = null, serverHost = null, serverPort = null;
......
...@@ -26,6 +26,7 @@ import java.util.zip.ZipInputStream; ...@@ -26,6 +26,7 @@ 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.Constants;
import cn.garymb.ygomobile.utils.IOUtils; import cn.garymb.ygomobile.utils.IOUtils;
import ocgcore.data.Card; import ocgcore.data.Card;
...@@ -151,7 +152,7 @@ public class CardManager { ...@@ -151,7 +152,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") || name.endsWith(".ypk")))); return file.isFile() && ((name.endsWith(".cdb") || (name.endsWith(".zip") || name.endsWith(Constants.YPK_FILE_EX))));
} }
}); });
//读取全部卡片 //读取全部卡片
...@@ -159,7 +160,7 @@ public class CardManager { ...@@ -159,7 +160,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") || file.getName().endsWith(".ypk")) { } else if (file.getName().endsWith(".zip") || file.getName().endsWith(Constants.YPK_FILE_EX)) {
Log.e("CardManager", "读取压缩包"); Log.e("CardManager", "读取压缩包");
try { try {
for (File file1 : readZipCdb(file.getAbsolutePath())) { for (File file1 : readZipCdb(file.getAbsolutePath())) {
......
...@@ -61,7 +61,7 @@ public class StringManager implements Closeable { ...@@ -61,7 +61,7 @@ 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") || file.getName().endsWith(".ypk"))) { if (file.isFile() && (file.getName().endsWith(".zip") || file.getName().endsWith(Constants.YPK_FILE_EX))) {
Log.e("StringManager", "读取压缩包"); Log.e("StringManager", "读取压缩包");
try { try {
ZipFile zipFile = new ZipFile(file.getAbsoluteFile(), "GBK"); ZipFile zipFile = new ZipFile(file.getAbsoluteFile(), "GBK");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment