using System;
using System.Runtime.InteropServices;

namespace Decal.Adapter;

public class MessageProcessedEventArgs : EventArgs
{
	private Message myMessage;

	private int myData;

	private int mySize;

	public Message Message => myMessage;

	public int Data => myData;

	public int Size => mySize;

	internal MessageProcessedEventArgs(int pbData, int dwSize)
	{
		if (pbData != 0 && dwSize != 0)
		{
			byte[] array = (byte[])Array.CreateInstance(typeof(byte), dwSize);
			Marshal.Copy(new IntPtr(pbData), array, 0, dwSize);
			myMessage = new Message(array, Message.GetParser(BitConverter.ToInt32(array, 0), MessageDirection.Inbound));
		}
		myData = pbData;
		mySize = dwSize;
	}
}
