Commit 7eaca2bf authored by fallenstardust's avatar fallenstardust

遍历expansions下所有压缩包里strings.conf文件并合并读取

parent 9dafd063
......@@ -4,6 +4,9 @@ import android.text.TextUtils;
import android.util.Log;
import android.util.SparseArray;
import com.file.zip.ZipEntry;
import com.file.zip.ZipFile;
import java.io.BufferedReader;
import java.io.Closeable;
import java.io.File;
......@@ -14,9 +17,8 @@ import java.io.InputStreamReader;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Enumeration;
import java.util.List;
import java.util.zip.ZipEntry;
import java.util.zip.ZipFile;
import cn.garymb.ygomobile.AppsSettings;
import cn.garymb.ygomobile.Constants;
......@@ -62,11 +64,17 @@ public class StringManager implements Closeable {
if (file.isFile() && (file.getName().endsWith(".zip") || file.getName().endsWith(".ypk"))) {
Log.e("StringManager", "读取压缩包");
try {
ZipFile zipFile = new ZipFile(file.getAbsoluteFile());
ZipEntry entry = zipFile.getEntry(Constants.CORE_CUSTOM_STRING_PATH);
if (entry != null) {
ZipFile zipFile = new ZipFile(file.getAbsoluteFile(), "GBK");
Enumeration<ZipEntry> entris = zipFile.getEntries();
ZipEntry entry;
while (entris.hasMoreElements()) {
entry = entris.nextElement();
if (!entry.isDirectory()) {
if (entry.getName().contains("string") && entry.getName().endsWith(".conf")) {
res3 &= loadFile(zipFile.getInputStream(entry));
}
}
}
} catch (IOException e) {
e.printStackTrace();
res3 = false;
......
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