Commit 99557d14 authored by fallenstardust's avatar fallenstardust

替换.ypk为Constants.YPK_FILE_EX

parent b3cfcbd0
......@@ -252,7 +252,7 @@ public class AppsSettings {
return false;
}
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 {
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");
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("[()() ]+");
File[] ypkList = AppsSettings.get().getExpansionFiles();
for (int i = 0; i < ypkList.length; i++) {
......
......@@ -133,7 +133,7 @@ public class ExCardListFragment extends Fragment {
textDownload.setText("0%");//点击下载后,距离onDownloading触发要等几秒,这一延迟会造成软件响应慢的错觉,因此在下载函数开始就设置文本
String path = AppsSettings.get().getExpansionsPath().getAbsolutePath();
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();
if (files != null) {
......
......@@ -117,7 +117,7 @@ public class MainActivity extends HomeActivity implements BottomNavigationBar.On
});
dialog.setOnDismissListener(dialogInterface -> {
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()) {
FileUtils.deleteFile(oldypk);
dialogplus.setMessage(R.string.tip_ypk_is_deleted);
......
......@@ -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_PRE_CARD;
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.isNumeric;
import static cn.garymb.ygomobile.utils.WebParseUtil.isValidIP;
......@@ -108,7 +109,7 @@ public class ServerUtil {
* @param 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", "读取压缩包");
try {
String serverName = null, serverDesc = null, serverHost = null, serverPort = null;
......
......@@ -26,6 +26,7 @@ import java.util.zip.ZipInputStream;
import cn.garymb.ygomobile.App;
import cn.garymb.ygomobile.AppsSettings;
import cn.garymb.ygomobile.Constants;
import cn.garymb.ygomobile.utils.IOUtils;
import ocgcore.data.Card;
......@@ -151,7 +152,7 @@ public class CardManager {
@Override
public boolean accept(File dir, String 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 {
for (File file : files) {
if (file.getName().endsWith(".cdb")) {
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", "读取压缩包");
try {
for (File file1 : readZipCdb(file.getAbsolutePath())) {
......
......@@ -61,7 +61,7 @@ public class StringManager implements Closeable {
File[] files = AppsSettings.get().getExpansionsPath().listFiles();
if (files != null) {
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", "读取压缩包");
try {
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