Beispiel #1
0
 public void Raw(byte[] payload, Proxy proxy, PacketContext packetContext)
 {
     if (packetContext == PacketContext.ServerToClient && !settings.LogServer)
         return;
     if (packetContext == PacketContext.ClientToServer && !settings.LogClient)
         return;
     StringBuilder sb = new StringBuilder();
     if (packetContext == PacketContext.ClientToServer)
         sb.AppendLine("RAW {" + DateTime.Now.ToLongTimeString() + "} [CLIENT " + proxy.RemoteSocket.RemoteEndPoint + "->SERVER]: ");
     else
         sb.AppendLine("RAW {" + DateTime.Now.ToLongTimeString() + "} [SERVER->CLIENT " + proxy.LocalSocket.RemoteEndPoint + "]: ");
     sb.Append(DataUtility.DumpArrayPretty(payload));
     stream.Write(sb + Environment.NewLine);
 }
 public PacketEventArgs(IPacket packet, MinecraftClient client, MinecraftServer server, PacketContext context)
 {
     Packet = packet;
     Client = client;
     Server = server;
 }
Beispiel #3
0
 public PacketReader(PacketContext context)
 {
     Buffer = new byte[bufferSize];
     Index = 0;
     EncryptionEnabled = false;
     Context = context;
     BufferHistory = new Stack<Tuple<byte[], int, BufferedBlockCipher>>();
 }
Beispiel #4
0
 int IPacket.ReadBody(Span <byte> span, PacketContext context) => span.Read(ref _bytes, 10);
Beispiel #5
0
 public int WriteBody(Span <byte> span, PacketContext context)
 {
     span[0] = (byte)(Value - (context == PacketContext.Server ? 0 : 42));
     return(1);
 }
Beispiel #6
0
 public int ReadBody(Span <byte> span, PacketContext context)
 {
     Value = (byte)(span[0] + (context == PacketContext.Server ? 0 : 42));
     return(1);
 }