mirror of
https://bitbucket.org/Ioncannon/project-meteor-server.git
synced 2025-05-20 08:26:59 -04:00
more work on commands
- moved script object to wrapper class to catch and log exceptions - added loggers for basepacket/subpacket (todo: colour and use them in NLog.config) - finished up most commands (todo: !property and !property2) - todo: create and use mysql wrapper class to log exceptions
This commit is contained in:
@@ -4,6 +4,7 @@ using System.Runtime.InteropServices;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using FFXIVClassic.Common;
|
||||
using NLog;
|
||||
|
||||
namespace FFXIVClassic_Map_Server.packets
|
||||
{
|
||||
@@ -19,7 +20,9 @@ namespace FFXIVClassic_Map_Server.packets
|
||||
public ulong timestamp; //Miliseconds
|
||||
}
|
||||
|
||||
public class BasePacket{
|
||||
public class BasePacket
|
||||
{
|
||||
public static Logger Log = LogManager.GetCurrentClassLogger();
|
||||
|
||||
public const int TYPE_ZONE = 1;
|
||||
public const int TYPE_CHAT = 2;
|
||||
@@ -335,7 +338,7 @@ namespace FFXIVClassic_Map_Server.packets
|
||||
// todo: create new target for colourful packet logging
|
||||
//Console.BackgroundColor = ConsoleColor.DarkYellow;
|
||||
|
||||
Program.Log.Debug("IsAuth: {0} IsEncrypted: {1}, Size: 0x{2:X}, NumSubpackets: {3}{4}{5}", header.isAuthenticated, header.isCompressed, header.packetSize, header.numSubpackets, Environment.NewLine, Utils.ByteArrayToHex(GetHeaderBytes()));
|
||||
Log.Debug("IsAuth: {0} IsEncrypted: {1}, Size: 0x{2:X}, NumSubpackets: {3}{4}{5}", header.isAuthenticated, header.isCompressed, header.packetSize, header.numSubpackets, Environment.NewLine, Utils.ByteArrayToHex(GetHeaderBytes()));
|
||||
|
||||
foreach (SubPacket sub in GetSubpackets())
|
||||
{
|
||||
|
@@ -1,6 +1,7 @@
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
using FFXIVClassic.Common;
|
||||
using NLog;
|
||||
|
||||
namespace FFXIVClassic_Map_Server.packets
|
||||
{
|
||||
@@ -26,6 +27,7 @@ namespace FFXIVClassic_Map_Server.packets
|
||||
|
||||
public class SubPacket
|
||||
{
|
||||
public static Logger Log = LogManager.GetCurrentClassLogger();
|
||||
public const int SUBPACKET_SIZE = 0x10;
|
||||
public const int GAMEMESSAGE_SIZE = 0x10;
|
||||
|
||||
@@ -143,15 +145,15 @@ namespace FFXIVClassic_Map_Server.packets
|
||||
// todo: create new target for colourful packet logging
|
||||
//Console.BackgroundColor = ConsoleColor.DarkRed;
|
||||
|
||||
Program.Log.Debug("Size: 0x{0:X}{1}{2}", header.subpacketSize, Environment.NewLine, Utils.ByteArrayToHex(GetHeaderBytes()));
|
||||
Log.Debug("Size: 0x{0:X}{1}{2}", header.subpacketSize, Environment.NewLine, Utils.ByteArrayToHex(GetHeaderBytes()));
|
||||
|
||||
if (header.type == 0x03)
|
||||
{
|
||||
Program.Log.Debug("Opcode: 0x{0:X}{1}{2}", gameMessage.opcode, Environment.NewLine, Utils.ByteArrayToHex(GetGameMessageBytes(), SUBPACKET_SIZE));
|
||||
Log.Debug("Opcode: 0x{0:X}{1}{2}", gameMessage.opcode, Environment.NewLine, Utils.ByteArrayToHex(GetGameMessageBytes(), SUBPACKET_SIZE));
|
||||
|
||||
//Console.BackgroundColor = ConsoleColor.DarkMagenta;
|
||||
|
||||
Program.Log.Debug("Data: {0}{1}", Environment.NewLine, Utils.ByteArrayToHex(data, SUBPACKET_SIZE + GAMEMESSAGE_SIZE));
|
||||
Log.Debug("Data: {0}{1}", Environment.NewLine, Utils.ByteArrayToHex(data, SUBPACKET_SIZE + GAMEMESSAGE_SIZE));
|
||||
}
|
||||
|
||||
//Console.BackgroundColor = ConsoleColor.Black;
|
||||
|
Reference in New Issue
Block a user