mirror of
https://github.com/sirjonasxx/G-Earth.git
synced 2025-01-19 08:36:27 +01:00
further improvements
This commit is contained in:
parent
0975d66379
commit
e60d9165cf
@ -35,7 +35,10 @@ public class HarblePacketInfoProvider extends RemotePacketInfoProvider {
|
||||
String name;
|
||||
String hash;
|
||||
String structure;
|
||||
try { name = object.getString("Name"); }
|
||||
try {
|
||||
name = object.getString("Name")
|
||||
.replaceAll("Composer$", "");
|
||||
}
|
||||
catch (Exception e) { name = null; }
|
||||
try { hash = object.getString("Hash"); }
|
||||
catch (Exception e) { hash = null; }
|
||||
|
@ -19,6 +19,7 @@ import org.fxmisc.richtext.model.StyleSpansBuilder;
|
||||
|
||||
import java.net.URL;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class UiLoggerController implements Initializable {
|
||||
public FlowPane flowPane;
|
||||
@ -33,7 +34,7 @@ public class UiLoggerController implements Initializable {
|
||||
public CheckMenuItem chkSkipBigPackets;
|
||||
public CheckMenuItem chkMessageName;
|
||||
public CheckMenuItem chkMessageHash;
|
||||
public Label lblHarbleAPI;
|
||||
public Label lblPacketInfo;
|
||||
|
||||
private StyleClassedTextArea area;
|
||||
|
||||
@ -95,23 +96,32 @@ public class UiLoggerController implements Initializable {
|
||||
|
||||
|
||||
boolean packetInfoAvailable = packetInfoManager.getPacketInfoList().size() > 0;
|
||||
lblHarbleAPI.setText("Packet info: " + (packetInfoAvailable ? "True" : "False"));
|
||||
lblPacketInfo.setText("Packet info: " + (packetInfoAvailable ? "True" : "False"));
|
||||
|
||||
if ((viewMessageName || viewMessageHash) && packetInfoAvailable) {
|
||||
PacketInfo message = packetInfoManager.getPacketInfoFromHeaderId(
|
||||
List<PacketInfo> messages = packetInfoManager.getAllPacketInfoFromHeaderId(
|
||||
(isIncoming ? HMessage.Direction.TOCLIENT : HMessage.Direction.TOSERVER),
|
||||
packet.headerId()
|
||||
);
|
||||
List<String> names = messages.stream().map(PacketInfo::getName)
|
||||
.filter(Objects::nonNull).distinct().collect(Collectors.toList());
|
||||
List<String> hashes = messages.stream().map(PacketInfo::getHash)
|
||||
.filter(Objects::nonNull).distinct().collect(Collectors.toList());
|
||||
|
||||
if (message != null && !(viewMessageName && !viewMessageHash && message.getName() == null)) {
|
||||
if (viewMessageName && message.getName() != null) {
|
||||
elements.add(new Element("["+message.getName()+"]", "messageinfo"));
|
||||
boolean addedSomething = false;
|
||||
if (viewMessageName && names.size() > 0) {
|
||||
for (String name : names) {elements.add(new Element("["+name+"]", "messageinfo")); }
|
||||
addedSomething = true;
|
||||
}
|
||||
if (viewMessageHash && message.getHash() != null) {
|
||||
elements.add(new Element("["+message.getHash()+"]", "messageinfo"));
|
||||
if (viewMessageHash && hashes.size() > 0) {
|
||||
for (String hash : hashes) {elements.add(new Element("["+hash+"]", "messageinfo")); }
|
||||
addedSomething = true;
|
||||
}
|
||||
|
||||
if (addedSomething) {
|
||||
elements.add(new Element("\n", ""));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (isBlocked) elements.add(new Element("[Blocked]\n", "blocked"));
|
||||
|
@ -1,15 +1,11 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<?import javafx.geometry.Insets?>
|
||||
<?import javafx.scene.control.CheckMenuItem?>
|
||||
<?import javafx.scene.control.Label?>
|
||||
<?import javafx.scene.control.Menu?>
|
||||
<?import javafx.scene.control.MenuBar?>
|
||||
<?import javafx.scene.input.KeyCodeCombination?>
|
||||
<?import javafx.scene.layout.BorderPane?>
|
||||
<?import javafx.scene.layout.FlowPane?>
|
||||
<?import javafx.geometry.*?>
|
||||
<?import javafx.scene.control.*?>
|
||||
<?import javafx.scene.input.*?>
|
||||
<?import javafx.scene.layout.*?>
|
||||
|
||||
<BorderPane fx:id="borderPane" prefHeight="560.0" prefWidth="820.0" xmlns="http://javafx.com/javafx" xmlns:fx="http://javafx.com/fxml/1" fx:controller="gearth.ui.logger.loggerdisplays.uilogger.UiLoggerController">
|
||||
<BorderPane fx:id="borderPane" prefHeight="560.0" prefWidth="820.0" xmlns="http://javafx.com/javafx/10.0.2-internal" xmlns:fx="http://javafx.com/fxml/1" fx:controller="gearth.ui.logger.loggerdisplays.uilogger.UiLoggerController">
|
||||
<top>
|
||||
<MenuBar BorderPane.alignment="CENTER">
|
||||
<Menu mnemonicParsing="false" text="View">
|
||||
@ -75,7 +71,7 @@
|
||||
<Insets right="10.0" />
|
||||
</FlowPane.margin>
|
||||
</Label>
|
||||
<Label fx:id="lblHarbleAPI" layoutX="283.0" layoutY="11.0" style="-fx-text-fill: black !important" text="Messages: False">
|
||||
<Label fx:id="lblPacketInfo" layoutX="283.0" layoutY="11.0" style="-fx-text-fill: black !important" text="Packet info: False">
|
||||
<FlowPane.margin>
|
||||
<Insets right="10.0" />
|
||||
</FlowPane.margin>
|
||||
|
Loading…
Reference in New Issue
Block a user