mirror of
https://github.com/revanced/ARSCLib.git
synced 2025-04-30 06:14:25 +02:00
preserve Spec flags during decompile xml
This commit is contained in:
parent
cd819c1d0d
commit
490deb59a3
@ -214,21 +214,10 @@ public class SpecTypePairArray extends BlockArray<SpecTypePair>
|
||||
}
|
||||
@Override
|
||||
public JSONArray toJson() {
|
||||
JSONArray jsonArray=new JSONArray();
|
||||
int i=0;
|
||||
for(SpecTypePair specTypePair:listItems()){
|
||||
JSONObject jsonObject = specTypePair.toJson();
|
||||
if(jsonObject==null){
|
||||
continue;
|
||||
}
|
||||
jsonArray.put(i, jsonObject);
|
||||
i++;
|
||||
}
|
||||
return jsonArray;
|
||||
return toJson(false);
|
||||
}
|
||||
@Override
|
||||
public void fromJson(JSONArray json) {
|
||||
clearChildes();
|
||||
if(json==null){
|
||||
return;
|
||||
}
|
||||
@ -241,6 +230,19 @@ public class SpecTypePairArray extends BlockArray<SpecTypePair>
|
||||
specTypePair.fromJson(jsonObject);
|
||||
}
|
||||
}
|
||||
public JSONArray toJson(boolean specsOnly) {
|
||||
JSONArray jsonArray=new JSONArray();
|
||||
int i=0;
|
||||
for(SpecTypePair specTypePair:listItems()){
|
||||
JSONObject jsonObject = specTypePair.toJson(specsOnly);
|
||||
if(jsonObject==null){
|
||||
continue;
|
||||
}
|
||||
jsonArray.put(i, jsonObject);
|
||||
i++;
|
||||
}
|
||||
return jsonArray;
|
||||
}
|
||||
public void merge(SpecTypePairArray pairArray){
|
||||
if(pairArray==null || pairArray==this){
|
||||
return;
|
||||
|
@ -294,8 +294,10 @@ public class TypeBlockArray extends BlockArray<TypeBlock>
|
||||
}
|
||||
@Override
|
||||
public void fromJson(JSONArray json) {
|
||||
if(json == null){
|
||||
return;
|
||||
}
|
||||
int length= json.length();
|
||||
clearChildes();
|
||||
ensureSize(length);
|
||||
for (int i=0;i<length;i++){
|
||||
JSONObject jsonObject=json.getJSONObject(i);
|
||||
|
@ -315,16 +315,14 @@ package com.reandroid.arsc.chunk;
|
||||
public JSONObject toJson() {
|
||||
return toJson(true);
|
||||
}
|
||||
public JSONObject toJson(boolean addSpecs) {
|
||||
public JSONObject toJson(boolean addTypes) {
|
||||
JSONObject jsonObject=new JSONObject();
|
||||
|
||||
jsonObject.put(BuildInfo.NAME_arsc_lib_version, BuildInfo.getVersion());
|
||||
|
||||
jsonObject.put(NAME_package_id, getId());
|
||||
jsonObject.put(NAME_package_name, getName());
|
||||
if(addSpecs){
|
||||
jsonObject.put(NAME_specs, getSpecTypePairArray().toJson());
|
||||
}
|
||||
jsonObject.put(NAME_specs, getSpecTypePairArray().toJson(!addTypes));
|
||||
LibraryInfoArray libraryInfoArray = getLibraryBlock().getLibraryInfoArray();
|
||||
if(libraryInfoArray.childesCount()>0){
|
||||
jsonObject.put(NAME_libraries,libraryInfoArray.toJson());
|
||||
|
@ -198,15 +198,20 @@ public class SpecTypePair extends BlockContainer<Block>
|
||||
|
||||
@Override
|
||||
public JSONObject toJson() {
|
||||
JSONObject jsonObject=new JSONObject();
|
||||
jsonObject.put(SpecBlock.NAME_spec, getSpecBlock().toJson());
|
||||
jsonObject.put(NAME_types, getTypeBlockArray().toJson());
|
||||
return jsonObject;
|
||||
return toJson(false);
|
||||
}
|
||||
@Override
|
||||
public void fromJson(JSONObject json) {
|
||||
getSpecBlock().fromJson(json.getJSONObject(SpecBlock.NAME_spec));
|
||||
getTypeBlockArray().fromJson(json.getJSONArray(NAME_types));
|
||||
getTypeBlockArray().fromJson(json.optJSONArray(NAME_types));
|
||||
}
|
||||
public JSONObject toJson(boolean specOnly) {
|
||||
JSONObject jsonObject=new JSONObject();
|
||||
jsonObject.put(SpecBlock.NAME_spec, getSpecBlock().toJson());
|
||||
if(!specOnly){
|
||||
jsonObject.put(NAME_types, getTypeBlockArray().toJson());
|
||||
}
|
||||
return jsonObject;
|
||||
}
|
||||
public void merge(SpecTypePair typePair){
|
||||
if(typePair==null||typePair==this){
|
||||
|
Loading…
x
Reference in New Issue
Block a user