mirror of
https://github.com/revanced/ARSCLib.git
synced 2025-05-02 07:04:27 +02:00
support zero package table XML decoding/encoding
This commit is contained in:
parent
490deb59a3
commit
53d8e192fa
@ -152,6 +152,22 @@ import java.util.*;
|
|||||||
for(PackageBlock packageBlock:tableBlock.listPackages()){
|
for(PackageBlock packageBlock:tableBlock.listPackages()){
|
||||||
decodePublicXml(packageBlock, outDir);
|
decodePublicXml(packageBlock, outDir);
|
||||||
}
|
}
|
||||||
|
if(tableBlock.getPackageArray().childesCount()==0){
|
||||||
|
decodeEmptyTable(outDir);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private void decodeEmptyTable(File outDir) throws IOException {
|
||||||
|
logMessage("Decoding empty table ...");
|
||||||
|
String pkgName = apkModule.getPackageName();
|
||||||
|
if(pkgName==null){
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
File pkgDir = new File(outDir, "0-"+pkgName);
|
||||||
|
File resDir = new File(pkgDir, ApkUtil.RES_DIR_NAME);
|
||||||
|
File values = new File(resDir, "values");
|
||||||
|
File pubXml = new File(values, ApkUtil.FILE_NAME_PUBLIC_XML);
|
||||||
|
XMLDocument xmlDocument = new XMLDocument("resources");
|
||||||
|
xmlDocument.save(pubXml, false);
|
||||||
}
|
}
|
||||||
private void decodePublicXml(PackageBlock packageBlock, File outDir)
|
private void decodePublicXml(PackageBlock packageBlock, File outDir)
|
||||||
throws IOException {
|
throws IOException {
|
||||||
|
@ -77,6 +77,9 @@
|
|||||||
|
|
||||||
for(File pubXmlFile:pubXmlFileList){
|
for(File pubXmlFile:pubXmlFileList){
|
||||||
ResourceIds.Table.Package pkgResourceIds=map.get(pubXmlFile);
|
ResourceIds.Table.Package pkgResourceIds=map.get(pubXmlFile);
|
||||||
|
if(pkgResourceIds==null){
|
||||||
|
continue;
|
||||||
|
}
|
||||||
addParsedFiles(pubXmlFile);
|
addParsedFiles(pubXmlFile);
|
||||||
|
|
||||||
PackageBlock packageBlock = createPackage(pkgResourceIds, pubXmlFile);
|
PackageBlock packageBlock = createPackage(pkgResourceIds, pubXmlFile);
|
||||||
@ -101,6 +104,9 @@
|
|||||||
}
|
}
|
||||||
for(File pubXmlFile:pubXmlFileList){
|
for(File pubXmlFile:pubXmlFileList){
|
||||||
ResourceIds.Table.Package pkgResourceIds=map.get(pubXmlFile);
|
ResourceIds.Table.Package pkgResourceIds=map.get(pubXmlFile);
|
||||||
|
if(pkgResourceIds==null){
|
||||||
|
continue;
|
||||||
|
}
|
||||||
addParsedFiles(pubXmlFile);
|
addParsedFiles(pubXmlFile);
|
||||||
|
|
||||||
PackageBlock packageBlock=packageBlockMap.get(pubXmlFile);
|
PackageBlock packageBlock=packageBlockMap.get(pubXmlFile);
|
||||||
@ -165,8 +171,12 @@
|
|||||||
}
|
}
|
||||||
ResourceIds resourceIds=new ResourceIds();
|
ResourceIds resourceIds=new ResourceIds();
|
||||||
resourceIds.fromXml(pubXmlFile);
|
resourceIds.fromXml(pubXmlFile);
|
||||||
ResourceIds.Table.Package pkg = resourceIds.getTable()
|
List<ResourceIds.Table.Package> pkgList = resourceIds.getTable()
|
||||||
.listPackages().get(0);
|
.listPackages();
|
||||||
|
if(pkgList.size()==0){
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
ResourceIds.Table.Package pkg = pkgList.get(0);
|
||||||
if(pkg.name==null){
|
if(pkg.name==null){
|
||||||
pkg.name=packageName;
|
pkg.name=packageName;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user