mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/jpexs-decompiler.git
synced 2026-06-23 18:15:36 +00:00
generic tag panel: binary editor now can edit byte[]
This commit is contained in:
@@ -23,6 +23,8 @@ import com.jpexs.decompiler.flash.types.BasicType;
|
||||
import com.jpexs.decompiler.flash.types.annotations.SWFType;
|
||||
import com.jpexs.helpers.ByteArrayRange;
|
||||
import java.io.IOException;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -72,6 +74,10 @@ public class DebugIDTag extends Tag {
|
||||
*/
|
||||
@Override
|
||||
public void getData(SWFOutputStream sos) throws IOException {
|
||||
if (debugId.length != 16) {
|
||||
Logger.getLogger(DebugIDTag.class.getName()).log(Level.WARNING, "DebugID should be 16 bytes");
|
||||
}
|
||||
|
||||
sos.write(debugId);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,6 +25,8 @@ import com.jpexs.decompiler.flash.types.annotations.Reserved;
|
||||
import com.jpexs.decompiler.flash.types.annotations.SWFType;
|
||||
import com.jpexs.helpers.ByteArrayRange;
|
||||
import java.io.IOException;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
/**
|
||||
* Enable flash profiling information
|
||||
@@ -71,6 +73,10 @@ public class EnableTelemetryTag extends Tag {
|
||||
public final void readData(SWFInputStream sis, ByteArrayRange data, int level, boolean parallel, boolean skipUnusualTags, boolean lazy) throws IOException {
|
||||
reserved = (int) sis.readUB(16, "reserved");
|
||||
if (sis.available() > 0) {
|
||||
if (passwordHash.length != 32) {
|
||||
Logger.getLogger(EnableTelemetryTag.class.getName()).log(Level.WARNING, "PasswordHash should be 32 bytes");
|
||||
}
|
||||
|
||||
passwordHash = sis.readBytesEx(32, "passwordHash");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -41,6 +41,10 @@ public class ReflectionTools {
|
||||
}
|
||||
|
||||
public static Object getValue(Object obj, Field field, int index) throws IllegalArgumentException, IllegalAccessException {
|
||||
if (index == -1) {
|
||||
return getValue(obj, field);
|
||||
}
|
||||
|
||||
if (getFieldSubSize(obj, field) <= index) {
|
||||
return null;
|
||||
}
|
||||
@@ -87,6 +91,11 @@ public class ReflectionTools {
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public static void setValue(Object obj, Field field, int index, Object newValue) throws IllegalArgumentException, IllegalAccessException {
|
||||
if (index == -1) {
|
||||
setValue(obj, field, newValue);
|
||||
return;
|
||||
}
|
||||
|
||||
Object value = field.get(obj);
|
||||
if (needsIndex(field) && index >= getFieldSubSize(obj, field)) { //outofbounds, ignore
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user