using System.IO;
using skyscraper5.Dvb.SystemSoftwareUpdate.Model;
using skyscraper5.Skyscraper.IO;

namespace skyscraper5.DsmCc
{
    class CompatibilityDescriptor
    {
        public CompatibilityDescriptor(MemoryStream ms)
        {
            ushort length = ms.ReadUInt16BE();
            if (length == 0)
                return;

            ushort count = ms.ReadUInt16BE();
            Compatibilities = new Compatibility[count];
            for (ushort i = 0; i < count; i++)
            {
                if (ms.GetAvailableBytes() == 0)
                    return;
                Compatibilities[i] = new Compatibility(ms);
            }
        }

        public Compatibility[] Compatibilities { get; }
    }
}
