Commit 7eaca2bf authored by fallenstardust's avatar fallenstardust

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

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