using System.Collections;
using System.Threading.Tasks;
using QC.QTMApplication.Utilities;
using QC.QTMInterface;

namespace QC.QTMApplication.Plugin.Common;

internal class PluginMessenger
{
	private FifoTaskScheduler fifoScheduler;

	private TaskFactory taskFactory;

	private BasePlugin plugin;

	public BasePlugin Plugin => plugin;

	public PluginMessenger(BasePlugin plugin)
	{
		fifoScheduler = new FifoTaskScheduler();
		taskFactory = new TaskFactory(fifoScheduler);
		this.plugin = plugin;
	}

	public void SendMsg(ArrayList msg)
	{
		taskFactory.StartNew(delegate
		{
			plugin.OnMsg(msg);
		});
	}
}
