feat: output useful information in debug mode

This commit is contained in:
Anna 2021-02-12 16:51:47 -05:00
parent 597c6f43e5
commit 555ee73739
1 changed files with 11 additions and 0 deletions

View File

@ -1,5 +1,7 @@
using System;
#if DEBUG
using System.Linq;
#endif
using System.Runtime.InteropServices;
using Dalamud.Hooking;
using Dalamud.Plugin;
@ -48,6 +50,15 @@ namespace BetterPartyFinder {
var needToRewrite = false;
#if DEBUG
var raw = Marshal.AllocHGlobal(PacketInfo.PacketSize);
Marshal.StructureToPtr(packet, raw, false);
var bytes = new byte[PacketInfo.PacketSize];
Marshal.Copy(raw, bytes, 0, PacketInfo.PacketSize);
PluginLog.Log(string.Join("", bytes.Select(b => b.ToString("x2"))));
Marshal.FreeHGlobal(raw);
#endif
for (var i = 0; i < packet.listings.Length; i++) {
if (packet.listings[i].IsNull()) {
continue;