From 3ff1abdf9bbfbff4b8d9f17be4f980134ef56afc Mon Sep 17 00:00:00 2001 From: sirjonasxx <36828922+sirjonasxx@users.noreply.github.com> Date: Tue, 1 Jan 2019 23:59:03 +0100 Subject: [PATCH] small changes and small bug fixes --- .../gearth/extensions/parsers/HEntity.java | 4 +-- .../java/gearth/ui/injection/Injection.java | 26 ++++++++++++++++--- 2 files changed, 25 insertions(+), 5 deletions(-) diff --git a/G-Earth/src/main/java/gearth/extensions/parsers/HEntity.java b/G-Earth/src/main/java/gearth/extensions/parsers/HEntity.java index adbee01..bb20d3e 100644 --- a/G-Earth/src/main/java/gearth/extensions/parsers/HEntity.java +++ b/G-Earth/src/main/java/gearth/extensions/parsers/HEntity.java @@ -73,9 +73,9 @@ public class HEntity { } public boolean tryUpdate(HEntityUpdate update) { - if (index != update.index) return false; + if (index != update.getIndex()) return false; - tile = update.tile; + tile = update.getTile(); lastUpdate = update; return true; } diff --git a/G-Earth/src/main/java/gearth/ui/injection/Injection.java b/G-Earth/src/main/java/gearth/ui/injection/Injection.java index 19b7f6e..d8d0cf6 100644 --- a/G-Earth/src/main/java/gearth/ui/injection/Injection.java +++ b/G-Earth/src/main/java/gearth/ui/injection/Injection.java @@ -59,6 +59,12 @@ public class Injection extends SubForm { HPacket[] packets = parsePackets(inputPacket.getText()); + if (packets.length == 0) { + dirty = true; + lbl_corrruption.setFill(Paint.valueOf("#ee0404b2")); + lbl_corrruption.setText("isCorrupted: True"); + } + for (int i = 0; i < packets.length; i++) { if (packets[i].isCorrupted()) { if (!dirty) { @@ -70,13 +76,27 @@ public class Injection extends SubForm { } } + if (dirty && packets.length == 1) { + lbl_corrruption.setText("isCorrupted: True"); // no index needed + } + if (!dirty) { btn_sendToClient.setDisable(getHConnection().getState() != HConnection.State.CONNECTED); btn_sendToServer.setDisable(getHConnection().getState() != HConnection.State.CONNECTED); - lbl_pcktInfo.setText("header (id:" + packets[packets.length - 1].headerId() + ", length:" + - packets[packets.length - 1].length() + ")"); + if (packets.length == 1) { + lbl_pcktInfo.setText("header (id:" + packets[0].headerId() + ", length:" + + packets[0].length() + ")"); + } + else { + lbl_pcktInfo.setText(""); + } } else { - lbl_pcktInfo.setText("header (id:NULL, length:" + packets[packets.length - 1].getBytesLength()+")"); + if (packets.length == 1) { + lbl_pcktInfo.setText("header (id:NULL, length:" + packets[0].getBytesLength()+")"); + } + else { + lbl_pcktInfo.setText(""); + } btn_sendToClient.setDisable(true); btn_sendToServer.setDisable(true);