using skyscraper5.Dvb;
using skyscraper5.Mpeg2;
using skyscraper5.Skyscraper.IO;
using skyscraper5.Skyscraper.Plugins;
using skyscraper5.Skyscraper.Text;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace skyscraper8.Ses.Descriptors
{
	[SkyscraperPlugin]
	[UserDefinedDescriptor(0x01, 0x93, "Astra SGT")]
	internal class _0x93_BouquetListDescriptor : TsDescriptor
	{
		public _0x93_BouquetListDescriptor(byte[] buffer)
		{
			MemoryStream ms = new MemoryStream(buffer, false);
			while (ms.GetAvailableBytes() >= 1)
			{
				byte bouquetNameLength = ms.ReadUInt8();
				if (bouquetNameLength != 0)
				{
					byte[] chars = ms.ReadBytes(bouquetNameLength);
					string chars2 = En300468AnnexATextDecoder.GetInstance().Decode(chars);
					if (!string.IsNullOrEmpty(chars2))
					{
						if (string.IsNullOrEmpty(Name))
						{
							Name = chars2;
						}
						else
						{
							throw new NotImplementedException("multiple bouquet names");
						}
					}
				}
			}
			Valid = true;
		}

		public string Name { get; private set; }
	}
}
