<commit_before>﻿using System.Drawing;
using MonoHaven.UI.Widgets;

namespace MonoHaven.UI.Remote
{
	public class ServerInventoryWidget : ServerWidget
	{
		public static ServerWidget Create(ushort id, ServerWidget parent, object[] args)
		{
			var size = (Point)args[0];
			var widget = new InventoryWidget(parent.Widget);
			widget.SetInventorySize(size);
			return new ServerInventoryWidget(id, parent, widget);
		}

		public ServerInventoryWidget(ushort id, ServerWidget parent, InventoryWidget widget)
			: base(id, parent, widget)
		{
			widget.Drop += (p) => SendMessage("drop", p);
			widget.Transfer += OnTransfer;
		}

		private void OnTransfer(TransferEventArgs e)
		{
			var mods = ServerInput.ToServerModifiers(e.Modifiers);
			SendMessage("xfer", e.Delta, mods);
		}
	}
}<commit_msg>Handle message changing inventory size<commit_after>﻿using System.Drawing;
using MonoHaven.UI.Widgets;

namespace MonoHaven.UI.Remote
{
	public class ServerInventoryWidget : ServerWidget
	{
		public static ServerWidget Create(ushort id, ServerWidget parent, object[] args)
		{
			var size = (Point)args[0];
			var widget = new InventoryWidget(parent.Widget);
			widget.SetInventorySize(size);
			return new ServerInventoryWidget(id, parent, widget);
		}

		private readonly InventoryWidget widget;

		public ServerInventoryWidget(ushort id, ServerWidget parent, InventoryWidget widget)
			: base(id, parent, widget)
		{
			this.widget = widget;
			this.widget.Drop += (p) => SendMessage("drop", p);
			this.widget.Transfer += OnTransfer;
		}

		public override void ReceiveMessage(string message, object[] args)
		{
			if (message == "sz")
				widget.SetInventorySize((Point)args[0]);
			else
				base.ReceiveMessage(message, args);
		}

		private void OnTransfer(TransferEventArgs e)
		{
			var mods = ServerInput.ToServerModifiers(e.Modifiers);
			SendMessage("xfer", e.Delta, mods);
		}
	}
}
{'fraction_non_alphanumeric': 0.11222869242985707, 'fraction_numerical': 0.0015881418740074113, 'mean_word_length': 4.6083086053412465, 'pattern_counts': {'":': 0, '<': 3, '<?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': '5390043', 'n_tokens_mistral': 661, 'n_tokens_neox': 577, 'n_words': 140}