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
|
@Override
|
||||||
public JSONArray toJson() {
|
public JSONArray toJson() {
|
||||||
JSONArray jsonArray=new JSONArray();
|
return toJson(false);
|
||||||
int i=0;
|
|
||||||
for(SpecTypePair specTypePair:listItems()){
|
|
||||||
JSONObject jsonObject = specTypePair.toJson();
|
|
||||||
if(jsonObject==null){
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
jsonArray.put(i, jsonObject);
|
|
||||||
i++;
|
|
||||||
}
|
|
||||||
return jsonArray;
|
|
||||||
}
|
}
|
||||||
@Override
|
@Override
|
||||||
public void fromJson(JSONArray json) {
|
public void fromJson(JSONArray json) {
|
||||||
clearChildes();
|
|
||||||
if(json==null){
|
if(json==null){
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -241,6 +230,19 @@ public class SpecTypePairArray extends BlockArray<SpecTypePair>
|
|||||||
specTypePair.fromJson(jsonObject);
|
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){
|
public void merge(SpecTypePairArray pairArray){
|
||||||
if(pairArray==null || pairArray==this){
|
if(pairArray==null || pairArray==this){
|
||||||
return;
|
return;
|
||||||
|
@ -294,8 +294,10 @@ public class TypeBlockArray extends BlockArray<TypeBlock>
|
|||||||
}
|
}
|
||||||
@Override
|
@Override
|
||||||
public void fromJson(JSONArray json) {
|
public void fromJson(JSONArray json) {
|
||||||
|
if(json == null){
|
||||||
|
return;
|
||||||
|
}
|
||||||
int length= json.length();
|
int length= json.length();
|
||||||
clearChildes();
|
|
||||||
ensureSize(length);
|
ensureSize(length);
|
||||||
for (int i=0;i<length;i++){
|
for (int i=0;i<length;i++){
|
||||||
JSONObject jsonObject=json.getJSONObject(i);
|
JSONObject jsonObject=json.getJSONObject(i);
|
||||||
|
@ -315,16 +315,14 @@ package com.reandroid.arsc.chunk;
|
|||||||
public JSONObject toJson() {
|
public JSONObject toJson() {
|
||||||
return toJson(true);
|
return toJson(true);
|
||||||
}
|
}
|
||||||
public JSONObject toJson(boolean addSpecs) {
|
public JSONObject toJson(boolean addTypes) {
|
||||||
JSONObject jsonObject=new JSONObject();
|
JSONObject jsonObject=new JSONObject();
|
||||||
|
|
||||||
jsonObject.put(BuildInfo.NAME_arsc_lib_version, BuildInfo.getVersion());
|
jsonObject.put(BuildInfo.NAME_arsc_lib_version, BuildInfo.getVersion());
|
||||||
|
|
||||||
jsonObject.put(NAME_package_id, getId());
|
jsonObject.put(NAME_package_id, getId());
|
||||||
jsonObject.put(NAME_package_name, getName());
|
jsonObject.put(NAME_package_name, getName());
|
||||||
if(addSpecs){
|
jsonObject.put(NAME_specs, getSpecTypePairArray().toJson(!addTypes));
|
||||||
jsonObject.put(NAME_specs, getSpecTypePairArray().toJson());
|
|
||||||
}
|
|
||||||
LibraryInfoArray libraryInfoArray = getLibraryBlock().getLibraryInfoArray();
|
LibraryInfoArray libraryInfoArray = getLibraryBlock().getLibraryInfoArray();
|
||||||
if(libraryInfoArray.childesCount()>0){
|
if(libraryInfoArray.childesCount()>0){
|
||||||
jsonObject.put(NAME_libraries,libraryInfoArray.toJson());
|
jsonObject.put(NAME_libraries,libraryInfoArray.toJson());
|
||||||
|
@ -198,15 +198,20 @@ public class SpecTypePair extends BlockContainer<Block>
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public JSONObject toJson() {
|
public JSONObject toJson() {
|
||||||
JSONObject jsonObject=new JSONObject();
|
return toJson(false);
|
||||||
jsonObject.put(SpecBlock.NAME_spec, getSpecBlock().toJson());
|
|
||||||
jsonObject.put(NAME_types, getTypeBlockArray().toJson());
|
|
||||||
return jsonObject;
|
|
||||||
}
|
}
|
||||||
@Override
|
@Override
|
||||||
public void fromJson(JSONObject json) {
|
public void fromJson(JSONObject json) {
|
||||||
getSpecBlock().fromJson(json.getJSONObject(SpecBlock.NAME_spec));
|
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){
|
public void merge(SpecTypePair typePair){
|
||||||
if(typePair==null||typePair==this){
|
if(typePair==null||typePair==this){
|
||||||
|
Loading…
x
Reference in New Issue
Block a user