public override void SetSectionsAlign() { // durch Pseudo-Offsets die Reihenfolge der Abschnitte festlegen uint pos = 0; Filesections.SetOffset((int)InternalFileSections.NT_PointDatablock, pos++); Filesections.SetOffset((int)InternalFileSections.NT_PointDatabtable, pos++); Filesections.SetOffset((int)InternalFileSections.NT_PointLabelblock, pos++); Filesections.SetOffset((int)InternalFileSections.NT_LabelblockTable1, pos++); Filesections.SetOffset((int)InternalFileSections.NT_LabelblockTable2, pos++); Filesections.AdjustSections(DataOffset); // lückenlos ausrichten NT_PointTableBlock = new TypDataBlockWithRecordsize(Filesections.GetPosition((int)InternalFileSections.NT_PointDatabtable)); NT_PointDatablock = new DataBlock(Filesections.GetPosition((int)InternalFileSections.NT_PointDatablock)); NT_PointLabelblock = new DataBlock(Filesections.GetPosition((int)InternalFileSections.NT_PointLabelblock)); NT_LabelblockTable1 = new DataBlock(Filesections.GetPosition((int)InternalFileSections.NT_LabelblockTable1)); NT_LabelblockTable2 = new DataBlock(Filesections.GetPosition((int)InternalFileSections.NT_LabelblockTable2)); }
public StdFile_TYP() : base("TYP") { RelaxedModeErrors = ""; HeaderTyp = Headertyp.Standard; Codepage = 1252; FamilyID = 0; ProductID = 1; PointDatablock = new DataBlock(); PolygoneDatablock = new DataBlock(); PolylineDatablock = new DataBlock(); PointTableBlock = new TypDataBlockWithRecordsize(); PolylineTableBlock = new TypDataBlockWithRecordsize(); PolygoneTableBlock = new TypDataBlockWithRecordsize(); PolygoneDraworderTableBlock = new TypDataBlockWithRecordsize(); // für NT-Format NT_PointTableBlock = new TypDataBlockWithRecordsize(); NT_PointDatablock = new DataBlock(); NT_PointLabelblock = new DataBlock(); NT_LabelblockTable1 = new DataBlock(); NT_LabelblockTable2 = new DataBlock(); polygone = new SortedList <Polygone, byte>(); polyline = new SortedList <Polyline, byte>(); poi = new SortedList <POI, byte>(); nt_unknown_0x65 = 0x1f; nt_unknown_0x6E = nt_unknown_0x7A = nt_unknown_0x7E = nt_unknown_0x8A = nt_unknown_0x8E = nt_unknown_0x9A = 0; nt_unknown_0x9C = new byte[] { 0, 0, 0, 0, 0, 0, 0, 0 }; nt_unknown_0xA4 = new byte[] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 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; }