using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using DVBServices;
using skyscraper5.Skyscraper.Plugins;
using skyscraper8.EPGCollectorPort.Properties;
using skyscraper8.Skyscraper.Text;

namespace skyscraper8.EPGCollectorPort.SkyscraperSide.Freesat
{
	[SkyscraperPlugin]
	[EncodingTypeId(0x01)]
	[EncodingTypeId(0x02)]
	internal class FreesatTextDecoder : TextDecoder
	{
		public FreesatTextDecoder()
		{
			if (!MultiTreeDictionaryEntry.Loaded)
			{
				MemoryStream t1 = new MemoryStream(Resources.Huffman_Dictionary_Freesat_T1, false);
				MemoryStream t2 = new MemoryStream(Resources.Huffman_Dictionary_Freesat_T2, false);
				MultiTreeDictionaryEntry.Load(t1, t2);
				t1.Dispose();
				t2.Dispose();
			}
		}

		public string Decode(byte[] buffer)
		{

			return MultiTreeDictionaryEntry.DecodeData(buffer, "utf-8");
		}
	}
}
