mirror of
https://github.com/sirjonasxx/G-Earth.git
synced 2025-02-20 13:02:36 +01:00
packet info sources
This commit is contained in:
parent
5755b0ca10
commit
26e273f2b5
@ -9,12 +9,15 @@ public class PacketInfo {
|
||||
private final String name;
|
||||
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.headerId = headerId;
|
||||
this.hash = hash;
|
||||
this.name = name;
|
||||
this.structure = structure;
|
||||
this.source = source;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
@ -37,6 +40,10 @@ public class PacketInfo {
|
||||
return structure;
|
||||
}
|
||||
|
||||
public String getSource() {
|
||||
return source;
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
return headerId + ": " + "[" + name + "][" + structure + "]";
|
||||
}
|
||||
|
@ -1,6 +1,5 @@
|
||||
package gearth.misc.packet_info;
|
||||
|
||||
import gearth.misc.Cacher;
|
||||
import gearth.misc.packet_info.providers.RemotePacketInfoProvider;
|
||||
import gearth.misc.packet_info.providers.implementations.HarblePacketInfoProvider;
|
||||
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.HPacket;
|
||||
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.concurrent.Semaphore;
|
||||
|
||||
@ -160,14 +153,15 @@ public class PacketInfoManager {
|
||||
String name = hPacket.readString();
|
||||
String structure = hPacket.readString();
|
||||
boolean isOutgoing = hPacket.readBoolean();
|
||||
String source = hPacket.readString();
|
||||
|
||||
packetInfoList.add(new PacketInfo(
|
||||
isOutgoing ? HMessage.Direction.TOSERVER : HMessage.Direction.TOCLIENT,
|
||||
headerId,
|
||||
hash.equals("NULL") ? null : hash,
|
||||
name.equals("NULL") ? null : name,
|
||||
structure.equals("NULL") ? null : structure
|
||||
));
|
||||
structure.equals("NULL") ? null : structure,
|
||||
source));
|
||||
}
|
||||
|
||||
return new PacketInfoManager(packetInfoList);
|
||||
@ -181,6 +175,7 @@ public class PacketInfoManager {
|
||||
hPacket.appendString(packetInfo.getName() == null ? "NULL" : packetInfo.getName());
|
||||
hPacket.appendString(packetInfo.getStructure() == null ? "NULL" : packetInfo.getStructure());
|
||||
hPacket.appendBoolean(packetInfo.getDestination() == HMessage.Direction.TOSERVER);
|
||||
hPacket.appendString(packetInfo.getSource());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,14 +1,11 @@
|
||||
package gearth.misc.packet_info.providers.implementations;
|
||||
|
||||
import gearth.misc.Cacher;
|
||||
import gearth.misc.packet_info.PacketInfo;
|
||||
import gearth.misc.packet_info.providers.PacketInfoProvider;
|
||||
import gearth.misc.packet_info.providers.RemotePacketInfoProvider;
|
||||
import gearth.protocol.HMessage;
|
||||
import org.json.JSONArray;
|
||||
import org.json.JSONObject;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@ -50,7 +47,7 @@ public class HarblePacketInfoProvider extends RemotePacketInfoProvider {
|
||||
try {headerId = object.getInt("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
|
||||
|
@ -33,7 +33,7 @@ public class SulekPacketInfoProvider extends RemotePacketInfoProvider {
|
||||
String name = object.getString("name")
|
||||
.replaceAll("(((Message)?Composer)|((Message)?Event))$", "");
|
||||
|
||||
return new PacketInfo(destination, headerId, null, name, null);
|
||||
return new PacketInfo(destination, headerId, null, name, null, "Sulek");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -32,7 +32,7 @@ public class UnityPacketInfoProvider extends PacketInfoProvider {
|
||||
private PacketInfo jsonToPacketInfo(JSONObject object, HMessage.Direction destination) {
|
||||
String name = object.getString("Name");
|
||||
int headerId = object.getInt("Id");
|
||||
return new PacketInfo(destination, headerId, null, name, null);
|
||||
return new PacketInfo(destination, headerId, null, name, null, "Unity_local");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
Loading…
x
Reference in New Issue
Block a user