public Routes(POTI data)
 {
     foreach (var path in data.Routes)
     {
         Entries.Add(new RouteGroup(path));
     }
 }
        public KMP(byte[] Data)
        {
            EndianBinaryReaderEx er = new EndianBinaryReaderEx(new MemoryStream(Data), Endianness.LittleEndian);

            try
            {
                Header = new KMPHeader(er);
                foreach (var v in Header.SectionOffsets)
                {
                    er.BaseStream.Position = Header.HeaderSize + v;
                    String sig = er.ReadString(Encoding.ASCII, 4);
                    er.BaseStream.Position -= 4;
                    switch (sig)
                    {
                    case "TPTK": KartPoint = new KTPT(er); break;

                    case "TPNE": EnemyPoint = new ENPT(er); break;

                    case "HPNE": EnemyPointPath = new ENPH(er); break;

                    case "TPTI": ItemPoint = new ITPT(er); break;

                    case "HPTI": ItemPointPath = new ITPH(er); break;

                    case "TPKC": CheckPoint = new CKPT(er); break;

                    case "HPKC": CheckPointPath = new CKPH(er); break;

                    case "JBOG": GlobalObject = new GOBJ(er); break;

                    case "ITOP": PointInfo = new POTI(er); break;

                    case "AERA": Area = new AREA(er); break;

                    case "EMAC": Camera = new CAME(er); break;

                    case "TPGJ": JugemPoint = new JGPT(er); break;

                    case "TPNC": CannonPoint = new CNPT(er); break;

                    case "TPSM": MissionPoint = new MSPT(er); break;

                    case "IGTS": StageInfo = new STGI(er); break;

                    case "SROC": CourseSect = new CORS(er); break;

                    case "TPLG": GliderPoint = new GLPT(er); break;

                    case "HPLG": GliderPointPath = new GLPH(er); break;

                    default: continue;
                    }
                }
            }
            finally
            {
                er.Close();
            }
        }
        public POTI ToPOTI()
        {
            POTI   data  = new POTI();
            ushort Count = 0;

            data.NrRoutes = (ushort)Entries.Count;
            foreach (var group in Entries)
            {
                data.Routes.Add(group.ToPOTIRoute());
                Count += (ushort)group.Entries.Count;
            }
            data.NrPoints = Count;
            return(data);
        }