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

namespace skyscraper5.Mhp.Descriptors
{
	[SkyscraperPlugin]
	[TsDescriptor(0x04,"AIT")]
    class DvbJApplicationLocationDescriptor : TsDescriptor
    {
        public DvbJApplicationLocationDescriptor(byte[] buffer)
        {
            MemoryStream ms = new MemoryStream(buffer, false);
            byte baseDirectoryLength = ms.ReadUInt8();
            BaseDirectory = Encoding.ASCII.GetString(ms.ReadBytes(baseDirectoryLength));
            byte classPathExtensionLength = ms.ReadUInt8();
            ClassPathExtension = Encoding.ASCII.GetString(ms.ReadBytes(classPathExtensionLength));
            InitialClass = Encoding.ASCII.GetString(ms.ReadBytes(ms.GetAvailableBytes()));
            Valid = true;
        }

        public string InitialClass { get; private set; }

        public string ClassPathExtension { get; private set; }

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