packet info sources

This commit is contained in:
sirjonasxx 2021-04-26 00:47:22 +02:00
parent 5755b0ca10
commit 26e273f2b5
5 changed files with 15 additions and 16 deletions

View File

@ -9,12 +9,15 @@ public class PacketInfo {
private final String name; private final String name;
private final String structure; private final String structure;
public PacketInfo(HMessage.Direction destination, int headerId, String hash, String name, String structure) { private final String source;
public PacketInfo(HMessage.Direction destination, int headerId, String hash, String name, String structure, String source) {
this.destination = destination; this.destination = destination;
this.headerId = headerId; this.headerId = headerId;
this.hash = hash; this.hash = hash;
this.name = name; this.name = name;
this.structure = structure; this.structure = structure;
this.source = source;
} }
public String getName() { public String getName() {
@ -37,6 +40,10 @@ public class PacketInfo {
return structure; return structure;
} }
public String getSource() {
return source;
}
public String toString() { public String toString() {
return headerId + ": " + "[" + name + "][" + structure + "]"; return headerId + ": " + "[" + name + "][" + structure + "]";
} }

View File

@ -1,6 +1,5 @@
package gearth.misc.packet_info; package gearth.misc.packet_info;
import gearth.misc.Cacher;
import gearth.misc.packet_info.providers.RemotePacketInfoProvider; import gearth.misc.packet_info.providers.RemotePacketInfoProvider;
import gearth.misc.packet_info.providers.implementations.HarblePacketInfoProvider; import gearth.misc.packet_info.providers.implementations.HarblePacketInfoProvider;
import gearth.misc.packet_info.providers.implementations.SulekPacketInfoProvider; import gearth.misc.packet_info.providers.implementations.SulekPacketInfoProvider;
@ -8,13 +7,7 @@ import gearth.misc.packet_info.providers.implementations.UnityPacketInfoProvider
import gearth.protocol.HMessage; import gearth.protocol.HMessage;
import gearth.protocol.HPacket; import gearth.protocol.HPacket;
import gearth.protocol.connection.HClient; import gearth.protocol.connection.HClient;
import org.fxmisc.undo.impl.ChangeQueue;
import org.json.JSONArray;
import org.json.JSONObject;
import java.io.File;
import java.io.IOException;
import java.nio.file.Files;
import java.util.*; import java.util.*;
import java.util.concurrent.Semaphore; import java.util.concurrent.Semaphore;
@ -160,14 +153,15 @@ public class PacketInfoManager {
String name = hPacket.readString(); String name = hPacket.readString();
String structure = hPacket.readString(); String structure = hPacket.readString();
boolean isOutgoing = hPacket.readBoolean(); boolean isOutgoing = hPacket.readBoolean();
String source = hPacket.readString();
packetInfoList.add(new PacketInfo( packetInfoList.add(new PacketInfo(
isOutgoing ? HMessage.Direction.TOSERVER : HMessage.Direction.TOCLIENT, isOutgoing ? HMessage.Direction.TOSERVER : HMessage.Direction.TOCLIENT,
headerId, headerId,
hash.equals("NULL") ? null : hash, hash.equals("NULL") ? null : hash,
name.equals("NULL") ? null : name, name.equals("NULL") ? null : name,
structure.equals("NULL") ? null : structure structure.equals("NULL") ? null : structure,
)); source));
} }
return new PacketInfoManager(packetInfoList); return new PacketInfoManager(packetInfoList);
@ -181,6 +175,7 @@ public class PacketInfoManager {
hPacket.appendString(packetInfo.getName() == null ? "NULL" : packetInfo.getName()); hPacket.appendString(packetInfo.getName() == null ? "NULL" : packetInfo.getName());
hPacket.appendString(packetInfo.getStructure() == null ? "NULL" : packetInfo.getStructure()); hPacket.appendString(packetInfo.getStructure() == null ? "NULL" : packetInfo.getStructure());
hPacket.appendBoolean(packetInfo.getDestination() == HMessage.Direction.TOSERVER); hPacket.appendBoolean(packetInfo.getDestination() == HMessage.Direction.TOSERVER);
hPacket.appendString(packetInfo.getSource());
} }
} }

View File

@ -1,14 +1,11 @@
package gearth.misc.packet_info.providers.implementations; package gearth.misc.packet_info.providers.implementations;
import gearth.misc.Cacher;
import gearth.misc.packet_info.PacketInfo; import gearth.misc.packet_info.PacketInfo;
import gearth.misc.packet_info.providers.PacketInfoProvider;
import gearth.misc.packet_info.providers.RemotePacketInfoProvider; import gearth.misc.packet_info.providers.RemotePacketInfoProvider;
import gearth.protocol.HMessage; import gearth.protocol.HMessage;
import org.json.JSONArray; import org.json.JSONArray;
import org.json.JSONObject; import org.json.JSONObject;
import java.io.File;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
@ -50,7 +47,7 @@ public class HarblePacketInfoProvider extends RemotePacketInfoProvider {
try {headerId = object.getInt("Id"); } try {headerId = object.getInt("Id"); }
catch (Exception e) { headerId = Integer.parseInt(object.getString("Id")); } catch (Exception e) { headerId = Integer.parseInt(object.getString("Id")); }
return new PacketInfo(destination, headerId, hash, name, structure); return new PacketInfo(destination, headerId, hash, name, structure, "Harble");
} }
@Override @Override

View File

@ -33,7 +33,7 @@ public class SulekPacketInfoProvider extends RemotePacketInfoProvider {
String name = object.getString("name") String name = object.getString("name")
.replaceAll("(((Message)?Composer)|((Message)?Event))$", ""); .replaceAll("(((Message)?Composer)|((Message)?Event))$", "");
return new PacketInfo(destination, headerId, null, name, null); return new PacketInfo(destination, headerId, null, name, null, "Sulek");
} }
@Override @Override

View File

@ -32,7 +32,7 @@ public class UnityPacketInfoProvider extends PacketInfoProvider {
private PacketInfo jsonToPacketInfo(JSONObject object, HMessage.Direction destination) { private PacketInfo jsonToPacketInfo(JSONObject object, HMessage.Direction destination) {
String name = object.getString("Name"); String name = object.getString("Name");
int headerId = object.getInt("Id"); int headerId = object.getInt("Id");
return new PacketInfo(destination, headerId, null, name, null); return new PacketInfo(destination, headerId, null, name, null, "Unity_local");
} }
@Override @Override