예제 #1
0
        protected override void Encode_Header(BinaryReaderWriter bw)
        {
            Unknown_0x0C = 0x01; // Bedeutung unklar
            base.Encode_Header(bw);

            bw.Write(Codepage);

            PointDatablock.Write(bw);
            PolylineDatablock.Write(bw);
            PolygoneDatablock.Write(bw);

            bw.Write(FamilyID);
            bw.Write(ProductID);

            PointTableBlock.Write(bw);
            PolylineTableBlock.Write(bw);
            PolygoneTableBlock.Write(bw);
            PolygoneDraworderTableBlock.Write(bw);

            if (Headerlength > 0x5b)
            {
                NT_PointTableBlock.Write(bw);
                bw.Write(nt_unknown_0x65);
                NT_PointDatablock.Write(bw);

                if (Headerlength > 0x6E)
                {
                    bw.Write(nt_unknown_0x6E);
                    NT_PointLabelblock.Write(bw);
                    bw.Write(nt_unknown_0x7A);
                    bw.Write(nt_unknown_0x7E);
                    NT_LabelblockTable2.Write(bw);
                    bw.Write(nt_unknown_0x8A);
                    bw.Write(nt_unknown_0x8E);
                    NT_LabelblockTable2.Write(bw);
                    bw.Write(nt_unknown_0x9A);
                    bw.Write(nt_unknown_0x9C);

                    if (Headerlength > 0xA4)
                    {
                        bw.Write(nt_unknown_0xA4);

                        if (Headerlength > 0xAE)
                        {
                            nt_unknown_0xAE = new byte[Headerlength - 0xAE];
                            bw.Write(nt_unknown_0xAE);
                        }
                    }
                }
            }
        }
예제 #2
0
        public override void ReadHeader(BinaryReaderWriter br)
        {
            base.ReadCommonHeader(br, Type);

            if (Unknown_0x0C != 0x01) // Bedeutung unklar
            {
                throw new Exception("Das ist keine Garmin-TYP-Datei.");
            }

            Headertyp htyp = Headertyp.Unknown;

            Codepage = br.Read2AsUShort();
            // Infos zu den Datenblöcken für POI, Polyline und Polygon einlesen (Offset, Länge)
            // (eigentlich uninteressant, da auf die Daten über die entsprechenden Tabellen zugegriffen wird)
            PointDatablock.Read(br);
            PolylineDatablock.Read(br);
            PolygoneDatablock.Read(br);

            FamilyID  = br.Read2AsUShort();
            ProductID = br.Read2AsUShort();

            // Infos zu den Tabellen für POI, Polyline und Polygon einlesen (Offset, Länge, Länge der Tabelleneinträge)
            PointTableBlock             = new TypDataBlockWithRecordsize(br);
            PolylineTableBlock          = new TypDataBlockWithRecordsize(br);
            PolygoneTableBlock          = new TypDataBlockWithRecordsize(br);
            PolygoneDraworderTableBlock = new TypDataBlockWithRecordsize(br);

            htyp = Headertyp.Standard;

            // ev. kommt noch NT-Zeugs
            if (Headerlength > 0x5b) // Extra icons
            {
                htyp = Headertyp.Type_6E;

                // spez. Daten für NT1-Punkte
                NT_PointTableBlock = new TypDataBlockWithRecordsize(br);
                nt_unknown_0x65    = br.ReadByte();        // sollte wohl immer 0x1F sein (?), auch 0x0D
                NT_PointDatablock.Read(br);

                if (Headerlength > 0x6e)         // Extra POI Labels
                {
                    htyp = Headertyp.Type_9C;

                    nt_unknown_0x6E = br.Read4UInt();     // 0
                    NT_PointLabelblock.Read(br);          // Block-Offset und -Länge
                    nt_unknown_0x7A = br.Read4UInt();     // 6    Datensatzlänge?
                    nt_unknown_0x7E = br.Read4UInt();     // 0x1B
                    NT_LabelblockTable1.Read(br);
                    nt_unknown_0x8A = br.Read4UInt();     // 6
                    nt_unknown_0x8E = br.Read4UInt();     // 0x1B
                    NT_LabelblockTable2.Read(br);
                    nt_unknown_0x9A = br.Read2AsUShort(); // 0x12

                    if (Headerlength > 0x9C)              // Indexing a selection of POIs
                    {
                        htyp = Headertyp.Type_A4;

                        br.ReadBytes(nt_unknown_0x9C); // scheint nochmal der gleiche Datenblock wie LabelblockTable2 zu sein

                        if (Headerlength > 0xA4)       // Active Routing
                        {
                            htyp = Headertyp.Type_AE;

                            br.ReadBytes(nt_unknown_0xA4);

                            if (Headerlength > 0xAE)
                            {
                                htyp = Headertyp.Unknown;

                                nt_unknown_0xA4 = br.ReadBytes(Headerlength - (int)br.Position); // Rest einlesen
                            }
                        }
                    }
                }
            }
            _HeaderTyp = htyp;
        }