<commit_before>﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Threading.Tasks;
using Common.Logging;
using GladMMO;
using GladNet;

namespace Booma.Proxy
{
	public sealed class DefaultPSOBBInteropPayloadHandler : IPeerPayloadSpecificMessageHandler<PSOBBGamePacketPayloadServer, PSOBBGamePacketPayloadClient, InteropPSOBBPeerMessageContext>
	{
		private ILog Logger { get; }

		public DefaultPSOBBInteropPayloadHandler([NotNull] ILog logger)
		{
			Logger = logger ?? throw new ArgumentNullException(nameof(logger));
		}

		public async Task HandleMessage(InteropPSOBBPeerMessageContext context, PSOBBGamePacketPayloadServer payload)
		{
			if(Logger.IsWarnEnabled)
				Logger.Warn($"PSOBB Unhandled Packet: 0x{payload.OperationCode:x}:{payload.GetType().Name}");
		}
	}
}<commit_msg>Added better opcode logging to default PSOBB intercept handler<commit_after>﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Threading.Tasks;
using Common.Logging;
using GladMMO;
using GladNet;

namespace Booma.Proxy
{
	public sealed class DefaultPSOBBInteropPayloadHandler : IPeerPayloadSpecificMessageHandler<PSOBBGamePacketPayloadServer, PSOBBGamePacketPayloadClient, InteropPSOBBPeerMessageContext>
	{
		private ILog Logger { get; }

		public DefaultPSOBBInteropPayloadHandler([NotNull] ILog logger)
		{
			Logger = logger ?? throw new ArgumentNullException(nameof(logger));
		}

		public async Task HandleMessage(InteropPSOBBPeerMessageContext context, PSOBBGamePacketPayloadServer payload)
		{
			if(Logger.IsWarnEnabled)
				Logger.Warn($"PSOBB Unhandled Packet: 0x{payload.OperationCode:x}:{payload.GetType().Name}");

			if (payload is ISub60CommandContainer sub60)
			{
				Logger.Info($"PSOBB Unhandled Packet: 0x60 {sub60.Command.CommandOperationCode:x} {sub60}");
			}
			else if (payload is ISub62CommandContainer sub62)
			{
				Logger.Info($"PSOBB Unhandled Packet: 0x62 {sub62.Command.CommandOperationCode:x} {sub62}");
			}
			else if (payload is ISub6DCommandContainer sub6D)
			{
				Logger.Info($"PSOBB Unhandled Packet: 0x62 {sub6D.Command.CommandOperationCode:x} {sub6D}");
			}
			else
			{
				if(Logger.IsWarnEnabled)
					if(payload is IUnknownPayloadType unk)
						Logger.Info($"PSOBB Unhandled Packet: 0x{payload.OperationCode:x}:{unk.ToString()}");
					else
						Logger.Info($"PSOBB Unhandled Packet of Type: 0x{payload.OperationCode:x}:{payload.GetType().Name} Info: {payload}");
			}
		}
	}
}
{'fraction_non_alphanumeric': 0.09935379644588045, 'fraction_numerical': 0.01332794830371567, 'mean_word_length': 5.7493188010899186, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6277796', 'n_tokens_mistral': 893, 'n_tokens_neox': 782, 'n_words': 158}