예제 #1
0
        static void ShowExtLineInfo(StringBuilder info,
                                    AllSubdivInfo asi,
                                    GarminCore.Files.StdFile_RGN rgn,
                                    TreeViewData tvd,
                                    NodeContent.Content4File filedata,
                                    int lineidx,
                                    int tab,
                                    out int hexlen,
                                    out long firsthexadr)
        {
            GarminCore.Files.StdFile_RGN.ExtRawPolyData poly = asi.GetExtLine(lineidx);
            GarminCore.DataBlock block = asi.GetDataBlock4ExtLine(lineidx);

            firsthexadr  = rgn.ExtLinesBlock.Offset;
            firsthexadr += block.Offset;
            hexlen       = (int)block.Length;

            info.AppendLine(FillWithSpace("Type             (1 Byte) (Bit 0..6)", tab, false, DecimalAndHexAndBinary(poly.Type)));
            info.AppendLine(FillWithSpace("Subtype          (1 Byte) (Bit 0..4)", tab, false, DecimalAndHexAndBinary(poly.Subtype)));
            info.AppendLine(FillWithSpace("HasLabel                  (Bit 5)", tab, false, poly.HasLabel.ToString()));
            info.AppendLine(FillWithSpace("HasUnknownFlag            (Bit 6)", tab, false, poly.HasUnknownFlag.ToString()));
            info.AppendLine(FillWithSpace("HasExtraBytes             (Bit 7)", tab, false, poly.HasExtraBytes.ToString()));
            info.AppendLine(FillWithSpace("DeltaLongitude   (2 Byte)", tab, false, DecimalAndHexAndBinary((short)poly.RawDeltaLongitude.Value) + ", " + poly.RawDeltaLongitude.ValueDegree.ToString() + "°"));
            info.AppendLine(FillWithSpace("DeltaLatitude    (2 Byte)", tab, false, DecimalAndHexAndBinary((short)poly.RawDeltaLatitude.Value) + ", " + poly.RawDeltaLatitude.ValueDegree.ToString() + "°"));
            info.AppendLine(FillWithSpace("RawBitStreamLengthBytes (" + poly.RawBitStreamLengthBytes.Length.ToString() + " Byte)", tab, false, HexString(poly.RawBitStreamLengthBytes)));
            info.AppendLine(FillWithSpace("   BitStreamLength", tab, false, poly.BitstreamLength.ToString()));
            info.AppendLine(FillWithSpace("BitstreamInfo    (1 Byte)", tab, false, DecimalAndHexAndBinary(poly.bitstreamInfo)));
            info.AppendLine(FillWithSpace("   basebits4lat", tab, false, DecimalAndHexAndBinary(poly.bitstreamInfo >> 4)));
            info.AppendLine(FillWithSpace("   basebits4lon", tab, false, DecimalAndHexAndBinary(poly.bitstreamInfo & 0xF)));
            if (poly.HasLabel)
            {
                info.AppendLine(FillWithSpace("LabelOffsetInLBL (3 Byte) (Bit 0..21)", tab, false, DecimalAndHexAndBinary(poly.LabelOffsetInLBL)));
                GarminCore.Files.StdFile_LBL lbl = tvd.GetLBL(filedata.Basename);
                if (lbl != null)
                {
                    info.AppendLine(FillWithSpace("   Text (from LBL)", tab, true, lbl.GetText(poly.LabelOffsetInLBL, true) + "'"));
                }
            }
            if (poly.HasExtraBytes)
            {
                int len = 7 + poly.RawBitStreamLengthBytes.Length;
                if (poly.HasLabel)
                {
                    len += 3;
                }
                filedata.BinaryReader.Seek(block.Offset + (uint)len);
                info.AppendLine(FillWithSpace("ExtraBytes", tab, false, HexString(filedata.BinaryReader.ReadBytes((int)block.Length - len))));
            }
            info.AppendLine("Deltas:");
            List <GarminCore.Files.StdFile_RGN.GeoDataBitstream.RawPoint> points = poly.GetRawPoints();

            for (int i = 0; i < points.Count; i++)
            {
                info.AppendLine("   " + points[i].ToString() + " / " + points[0].GetMapUnitPoint(rgn.TREFile.MaplevelList[asi.MaplevelNo].CoordBits, asi.SubdivfInfo.Center).ToString());
            }
        }
예제 #2
0
        static void ShowExtPointInfo(StringBuilder info,
                                     AllSubdivInfo asi,
                                     GarminCore.Files.StdFile_RGN rgn,
                                     TreeViewData tvd,
                                     NodeContent.Content4File filedata,
                                     int pointidx,
                                     int tab,
                                     out int hexlen,
                                     out long firsthexadr)
        {
            GarminCore.Files.StdFile_RGN.ExtRawPointData point = asi.GetExtPoint(pointidx);
            GarminCore.DataBlock block = asi.GetDataBlock4ExtPoint(pointidx);

            firsthexadr  = rgn.ExtLinesBlock.Offset;
            firsthexadr += block.Offset;
            hexlen       = (int)block.Length;

            info.AppendLine(FillWithSpace("Type             (1 Byte) (Bit 0..6)", tab, false, DecimalAndHexAndBinary(point.Type)));
            info.AppendLine(FillWithSpace("Subtype          (1 Byte) (Bit 0..4)", tab, false, DecimalAndHexAndBinary(point.Subtype)));
            info.AppendLine(FillWithSpace("HasLabel                  (Bit 5)", tab, false, point.HasLabel.ToString()));
            info.AppendLine(FillWithSpace("HasUnknownFlag            (Bit 6)", tab, false, point.HasUnknownFlag.ToString()));
            info.AppendLine(FillWithSpace("HasExtraBytes             (Bit 7)", tab, false, point.HasExtraBytes.ToString()));
            info.AppendLine(FillWithSpace("DeltaLongitude   (2 Byte)", tab, false, DecimalAndHexAndBinary((short)point.RawDeltaLongitude.Value) + ", " + point.RawDeltaLongitude.ValueDegree.ToString() + "°"));
            info.AppendLine(FillWithSpace("DeltaLatitude    (2 Byte)", tab, false, DecimalAndHexAndBinary((short)point.RawDeltaLatitude.Value) + ", " + point.RawDeltaLatitude.ValueDegree.ToString() + "°"));
            if (point.HasLabel)
            {
                info.AppendLine(FillWithSpace("LabelOffsetInLBL (3 Byte) (Bit 0..21)", tab, false, DecimalAndHexAndBinary(point.LabelOffsetInLBL)));
                GarminCore.Files.StdFile_LBL lbl = tvd.GetLBL(filedata.Basename);
                if (lbl != null)
                {
                    info.AppendLine(FillWithSpace("   Text (from LBL)", tab, true, lbl.GetText(point.LabelOffsetInLBL, true)));
                }
            }
            if (point.HasExtraBytes)
            {
                int len = 6;
                if (point.HasLabel)
                {
                    len += 3;
                }
                filedata.BinaryReader.Seek(firsthexadr + (uint)len);
                info.AppendLine(FillWithSpace("ExtraBytes", tab, false, HexString(filedata.BinaryReader.ReadBytes(point.ExtraBytes))));
            }
            if (point.HasUnknownFlag)
            {
                info.AppendLine(FillWithSpace("UnknownKey", tab, false, HexString(point.UnknownKey)));
                if (point.UnknownBytes != null && point.UnknownBytes.Length > 0)
                {
                    info.AppendLine(FillWithSpace("UnknownBytes", tab, false, HexString(point.UnknownBytes)));
                }
            }
        }
예제 #3
0
        /// <summary>
        /// Funktion für alle TRE-Datei-Infos
        /// </summary>
        /// <param name="info"></param>
        /// <param name="hex"></param>
        /// <param name="firsthexadr"></param>
        /// <param name="filedata"></param>
        /// <param name="nodetype">"Thema" der Info</param>
        /// <param name="idx">wenn größer oder gleich 0, dann der Index auf ein Objekt einer Tabelle</param>
        /// <param name="tn"></param>
        public static void SectionAndIndex(StringBuilder info, out byte[] hex, out long firsthexadr, NodeContent.Content4File filedata, NodeContent.NodeType nodetype, int idx, TreeViewData tvd)
        {
            GarminCore.Files.StdFile_TRE tre = filedata.GetGarminFileAsTRE();
            int hexlen = 0;

            firsthexadr = 0;
            hex         = null;
            GarminCore.Files.StdFile_LBL lbl;
            GarminCore.DataBlock         block;

            switch (nodetype)
            {
            case NodeContent.NodeType.TRE_DescriptionList:
                firsthexadr = tre.MapDescriptionBlock.Offset;
                if (idx < 0)
                {
                    info.AppendLine("MapDescriptionList: " + tre.MapDescriptionList.Count.ToString());
                    info.AppendLine("  Block:            " + tre.MapDescriptionBlock.ToString());
                    hexlen = (int)tre.MapDescriptionBlock.Length;
                }
                else
                {
                    string mapdescription = tre.MapDescriptionList[idx];
                    info.AppendLine("MapDescription: " + tre.MapDescriptionList[idx]);
                    for (int i = 0; i < idx; i++)
                    {
                        firsthexadr += tre.MapDescriptionList[i].Length + 1;
                    }
                    hexlen = tre.MapDescriptionList[idx].Length + 1;
                }
                break;

            case NodeContent.NodeType.TRE_MaplevelBlock:
                firsthexadr = tre.MaplevelBlock.Offset;
                if (idx < 0)
                {
                    info.AppendLine("Maplevel: " + tre.MaplevelList.Count.ToString());
                    info.AppendLine("  Block:  " + tre.MaplevelBlock.ToString());
                    hexlen = (int)tre.MaplevelBlock.Length;
                    if (hexlen > 0 && tre.MaplevelList.Count == 0)
                    {
                        info.AppendLine("data propably encrypted");
                    }
                }
                else
                {
                    GarminCore.Files.StdFile_TRE.MapLevel maplevel = tre.MaplevelList[idx];
                    info.AppendLine("SymbolicScaleDenominator (Bit 0..3):         " + DecimalAndHexAndBinary((ulong)maplevel.SymbolicScaleDenominator));
                    info.AppendLine("(SymbolicScaleDenominator) Bit 4:            " + maplevel.Bit4.ToString());
                    info.AppendLine("(SymbolicScaleDenominator) Bit 5:            " + maplevel.Bit5.ToString());
                    info.AppendLine("(SymbolicScaleDenominator) Bit 6:            " + maplevel.Bit6.ToString());
                    info.AppendLine("(SymbolicScaleDenominator) Bit 7, Inherited: " + maplevel.Inherited.ToString());
                    info.AppendLine("CoordBits (1 Byte):                          " + DecimalAndHexAndBinary((ulong)maplevel.CoordBits));
                    info.AppendLine("SubdivInfos (2 Byte):                        " + DecimalAndHexAndBinary(maplevel.SubdivInfos));
                    firsthexadr += idx * 4;
                    hexlen       = 4;
                }
                break;

            case NodeContent.NodeType.TRE_SubdivisionBlock:
                firsthexadr = tre.SubdivisionBlock.Offset;
                if (idx < 0)
                {
                    info.AppendLine("Subdivision: " + tre.SubdivInfoList.Count.ToString());
                    info.AppendLine("  Block:     " + tre.SubdivisionBlock.ToString());
                    hexlen = (int)tre.SubdivisionBlock.Length;
                    if (hexlen > 0 && tre.MaplevelList.Count == 0)
                    {
                        info.AppendLine("data propably encrypted");
                    }
                }
                else
                {
                    block        = SampleInfo4SubdivInfo(info, tre, idx);
                    firsthexadr += block.Offset;
                    hexlen       = (int)block.Length;
                }
                break;

            case NodeContent.NodeType.TRE_CopyrightBlock:
                firsthexadr = tre.CopyrightBlock.Offset;
                if (idx < 0)
                {
                    info.AppendLine("Copyrights: " + tre.CopyrightOffsetsList.Count.ToString());
                    info.AppendLine("  Block:    " + tre.CopyrightBlock.ToString());
                    hexlen = (int)tre.CopyrightBlock.Length;
                }
                else
                {
                    info.AppendLine("Offset in LBL (" + tre.CopyrightBlock.Recordsize.ToString() + " Byte): " + DecimalAndHexAndBinary(tre.CopyrightOffsetsList[idx]));
                    lbl = tvd.GetLBL(filedata.Basename);
                    if (lbl != null)
                    {
                        info.AppendLine("   Text (from LBL): '" + lbl.GetText(tre.CopyrightOffsetsList[idx], true) + "'");
                    }
                    firsthexadr += idx * tre.CopyrightBlock.Recordsize;
                    hexlen       = tre.CopyrightBlock.Recordsize;
                }
                break;

            case NodeContent.NodeType.TRE_LineOverviewBlock:
                firsthexadr = tre.LineOverviewBlock.Offset;
                if (idx < 0)
                {
                    info.AppendLine("LineOverview: " + (tre.LineOverviewBlock.Length / tre.LineOverviewBlock.Recordsize).ToString());
                    info.AppendLine("  Block:      " + tre.LineOverviewBlock.ToString());
                    hexlen = (int)tre.LineOverviewBlock.Length;
                }
                else
                {
                    GarminCore.Files.StdFile_TRE.OverviewObject2Byte ov = tre.LineOverviewList[idx];
                    info.AppendLine("Type     (1 Byte): " + DecimalAndHexAndBinary((ulong)ov.Type));
                    info.AppendLine("MaxLevel (1 Byte): " + DecimalAndHexAndBinary((ulong)ov.MaxLevel));
                    if (ov is GarminCore.Files.StdFile_TRE.OverviewObject3Byte ||
                        ov is GarminCore.Files.StdFile_TRE.OverviewObject4Byte)
                    {
                        info.AppendLine("SubType  (1 Byte): " + DecimalAndHexAndBinary((ulong)(ov as GarminCore.Files.StdFile_TRE.OverviewObject3Byte).SubType));
                    }
                    if (ov is GarminCore.Files.StdFile_TRE.OverviewObject4Byte)
                    {
                        info.AppendLine("Unknown  (1 Byte): " + DecimalAndHexAndBinary((ulong)(ov as GarminCore.Files.StdFile_TRE.OverviewObject4Byte).Unknown));
                    }

                    firsthexadr += idx * tre.LineOverviewBlock.Recordsize;
                    hexlen       = tre.LineOverviewBlock.Recordsize;
                }
                break;

            case NodeContent.NodeType.TRE_AreaOverviewBlock:
                firsthexadr = tre.AreaOverviewBlock.Offset;
                if (idx < 0)
                {
                    info.AppendLine("AreaOverview: " + (tre.AreaOverviewBlock.Length / tre.AreaOverviewBlock.Recordsize).ToString());
                    info.AppendLine("  Block:      " + tre.AreaOverviewBlock.ToString());
                    hexlen = (int)tre.AreaOverviewBlock.Length;
                }
                else
                {
                    GarminCore.Files.StdFile_TRE.OverviewObject2Byte ov = tre.AreaOverviewList[idx];
                    info.AppendLine("Type     (1 Byte): " + DecimalAndHexAndBinary((ulong)ov.Type));
                    info.AppendLine("MaxLevel (1 Byte): " + DecimalAndHexAndBinary((ulong)ov.MaxLevel));
                    if (ov is GarminCore.Files.StdFile_TRE.OverviewObject3Byte ||
                        ov is GarminCore.Files.StdFile_TRE.OverviewObject4Byte)
                    {
                        info.AppendLine("SubType (1 Byte): " + DecimalAndHexAndBinary((ulong)(ov as GarminCore.Files.StdFile_TRE.OverviewObject3Byte).SubType));
                    }
                    if (ov is GarminCore.Files.StdFile_TRE.OverviewObject4Byte)
                    {
                        info.AppendLine("Unknown (1 Byte): " + DecimalAndHexAndBinary((ulong)(ov as GarminCore.Files.StdFile_TRE.OverviewObject4Byte).Unknown));
                    }

                    firsthexadr = idx * tre.AreaOverviewBlock.Recordsize;
                    hexlen      = tre.AreaOverviewBlock.Recordsize;
                }
                break;

            case NodeContent.NodeType.TRE_PointOverviewBlock:
                firsthexadr = tre.PointOverviewBlock.Offset;
                if (idx < 0)
                {
                    info.AppendLine("PointOverview: " + (tre.PointOverviewBlock.Length / tre.PointOverviewBlock.Recordsize).ToString());
                    info.AppendLine("  Block:       " + tre.PointOverviewBlock.ToString());
                    hexlen = (int)tre.PointOverviewBlock.Length;
                }
                else
                {
                    GarminCore.Files.StdFile_TRE.OverviewObject2Byte ov = tre.PointOverviewList[idx];
                    info.AppendLine("Type     (1 Byte): " + DecimalAndHexAndBinary((ulong)ov.Type));
                    info.AppendLine("MaxLevel (1 Byte): " + DecimalAndHexAndBinary((ulong)ov.MaxLevel));
                    if (ov is GarminCore.Files.StdFile_TRE.OverviewObject3Byte ||
                        ov is GarminCore.Files.StdFile_TRE.OverviewObject4Byte)
                    {
                        info.AppendLine("SubType (1 Byte): " + DecimalAndHexAndBinary((ulong)(ov as GarminCore.Files.StdFile_TRE.OverviewObject3Byte).SubType));
                    }
                    if (ov is GarminCore.Files.StdFile_TRE.OverviewObject4Byte)
                    {
                        info.AppendLine("Unknown (1 Byte): " + DecimalAndHexAndBinary((ulong)(ov as GarminCore.Files.StdFile_TRE.OverviewObject4Byte).Unknown));
                    }

                    firsthexadr = idx * tre.PointOverviewBlock.Recordsize;
                    hexlen      = tre.PointOverviewBlock.Recordsize;
                }
                break;

            case NodeContent.NodeType.TRE_ExtTypeOffsetsBlock:
                firsthexadr = tre.ExtTypeOffsetsBlock.Offset;
                if (idx < 0)
                {
                    info.AppendLine("ExtTypeOffsets: " + (tre.ExtTypeOffsetsBlock.Length / tre.ExtTypeOffsetsBlock.Recordsize).ToString());
                    info.AppendLine("  Block:        " + tre.ExtTypeOffsetsBlock.ToString());
                    hexlen = (int)tre.ExtTypeOffsetsBlock.Length;
                }
                else
                {
                    firsthexadr += idx * tre.ExtTypeOffsetsBlock.Recordsize;
                    hexlen       = tre.ExtTypeOffsetsBlock.Recordsize;

                    GarminCore.Files.StdFile_TRE.ExtendedTypeOffsets extoffs = new GarminCore.Files.StdFile_TRE.ExtendedTypeOffsets();
                    filedata.BinaryReader.Seek(firsthexadr);
                    extoffs.Read(filedata.BinaryReader, tre.ExtTypeOffsetsBlock.Recordsize);
                    info.AppendLine("Offsets in RGN for each Subdiv");
                    info.AppendLine("AreasOffset  (4 Byte): " + DecimalAndHexAndBinary((ulong)extoffs.AreasOffset));
                    info.AppendLine("LinesOffset  (4 Byte): " + DecimalAndHexAndBinary((ulong)extoffs.LinesOffset));
                    info.AppendLine("PointsOffset (4 Byte): " + DecimalAndHexAndBinary((ulong)extoffs.PointsOffset));
                    if (extoffs.DataLength > 12)
                    {
                        info.AppendLine("Kinds (1 Byte): " + DecimalAndHexAndBinary((ulong)extoffs.Kinds));
                    }
                }
                break;

            case NodeContent.NodeType.TRE_ExtTypeOverviewsBlock:
                firsthexadr = tre.ExtTypeOverviewsBlock.Offset;
                if (idx < 0)
                {
                    info.AppendLine("TRE_ExtTypeOverviews: " + (tre.ExtTypeOverviewsBlock.Length / tre.ExtTypeOverviewsBlock.Recordsize).ToString());
                    info.AppendLine("  Block:              " + tre.ExtTypeOverviewsBlock.ToString());
                    info.AppendLine("ExtLineOverviewList:  " + tre.ExtLineOverviewList.Count.ToString());
                    info.AppendLine("ExtAreaOverviewList:  " + tre.ExtAreaOverviewList.Count.ToString());
                    info.AppendLine("ExtPointOverviewList: " + tre.ExtPointOverviewList.Count.ToString());
                    hexlen = (int)tre.ExtTypeOverviewsBlock.Length;
                }
                else
                {
                    firsthexadr += idx * tre.ExtTypeOverviewsBlock.Recordsize;
                    hexlen       = tre.ExtTypeOverviewsBlock.Recordsize;

                    GarminCore.Files.StdFile_TRE.OverviewObject2Byte ov = null;
                    if (idx < tre.ExtLineCount && idx < tre.ExtLineOverviewList.Count)
                    {
                        info.AppendLine("ExtLine");
                        ov = tre.ExtLineOverviewList[idx];
                    }
                    else if (idx < tre.ExtLineCount + tre.ExtAreaCount && idx - tre.ExtLineOverviewList.Count < tre.ExtAreaOverviewList.Count)
                    {
                        idx -= tre.ExtLineCount;
                        info.AppendLine("ExtArea");
                        ov = tre.ExtAreaOverviewList[idx];
                    }
                    else if (idx - tre.ExtLineOverviewList.Count - tre.ExtAreaOverviewList.Count < tre.ExtPointOverviewList.Count)
                    {
                        idx -= tre.ExtLineCount + tre.ExtAreaCount;
                        info.AppendLine("ExtPoint");
                        ov = tre.ExtPointOverviewList[idx];
                    }
                    if (ov != null)
                    {
                        info.AppendLine("Type     (1 Byte): " + DecimalAndHexAndBinary((ulong)ov.Type));
                        info.AppendLine("MaxLevel (1 Byte): " + DecimalAndHexAndBinary((ulong)ov.MaxLevel));
                        info.AppendLine("SubType  (1 Byte): " + DecimalAndHexAndBinary((ulong)(ov as GarminCore.Files.StdFile_TRE.OverviewObject3Byte).SubType));
                        if (ov is GarminCore.Files.StdFile_TRE.OverviewObject4Byte)
                        {
                            info.AppendLine("Unknown (1 Byte):  " + DecimalAndHexAndBinary((ulong)(ov as GarminCore.Files.StdFile_TRE.OverviewObject4Byte).Unknown));
                        }
                    }
                }
                break;

            case NodeContent.NodeType.TRE_UnknownBlock_xAE:
                if (idx < 0)
                {
                    info.AppendLine("UnknownBlock 0xAE: " + tre.UnknownBlock_xAE.ToString());
                    firsthexadr = tre.UnknownBlock_xAE.Offset;
                    hexlen      = (int)tre.UnknownBlock_xAE.Length;
                }
                else
                {
                }
                break;

            case NodeContent.NodeType.TRE_UnknownBlock_xBC:
                if (idx < 0)
                {
                    info.AppendLine("UnknownBlock 0xBC: " + tre.UnknownBlock_xBC.ToString());
                    firsthexadr = tre.UnknownBlock_xAE.Offset;
                    hexlen      = (int)tre.UnknownBlock_xAE.Length;
                }
                else
                {
                }
                break;

            case NodeContent.NodeType.TRE_UnknownBlock_xE3:
                if (idx < 0)
                {
                    info.AppendLine("UnknownBlock 0xE3: " + tre.UnknownBlock_xE3.ToString());
                    firsthexadr = tre.UnknownBlock_xAE.Offset;
                    hexlen      = (int)tre.UnknownBlock_xAE.Length;
                }
                else
                {
                }
                break;

            default:
                info.AppendLine("internal error: no info for nodetype '" + nodetype.ToString() + "'");
                break;
            }

            if (hexlen > 0)
            {
                hex = HexRange(firsthexadr, filedata.BinaryReader, hexlen);
            }
        }
예제 #4
0
        /// <summary>
        /// Funktion für alle Datei-Infos
        /// </summary>
        /// <param name="info"></param>
        /// <param name="hex"></param>
        /// <param name="firsthexadr"></param>
        /// <param name="filedata"></param>
        /// <param name="nodetype">"Thema" der Info</param>
        /// <param name="idx">wenn größer oder gleich 0, dann der Index auf ein Objekt einer Tabelle</param>
        /// <param name="tn"></param>
        public static void SectionAndIndex(StringBuilder info, out byte[] hex, out long firsthexadr, NodeContent.Content4File filedata, NodeContent.NodeType nodetype, int idx, TreeViewData tvd)
        {
            GarminCore.Files.File_MPS mps = filedata.GetGarminFileAsMPS();
            int hexlen = 0;

            firsthexadr = 0;
            hex         = null;
            GarminCore.DataBlock block;

            switch (nodetype)
            {
            case NodeContent.NodeType.MPS_MapEntry:
                if (idx < 0)
                {
                    info.AppendLine("MapEntrys: " + mps.Maps.Count);
                }
                else
                {
                    block       = MapEntryBlock(mps, idx);
                    firsthexadr = block.Offset;
                    hexlen      = (int)block.Length;

                    GarminCore.Files.File_MPS.MapEntry mapentry = mps.Maps[idx];
                    info.AppendLine("Typ         (1 Byte): " + mapentry.Typ + " / " + DecimalAndHexAndBinary((byte)mapentry.Typ));
                    info.AppendLine("BlockLength (2 Byte): " + DecimalAndHexAndBinary(block.Length - 3));
                    switch (mapentry.Typ)
                    {
                    case 'L':
                        info.AppendLine("ProductID   (2 Byte): " + DecimalAndHexAndBinary(mapentry.ProductID));
                        info.AppendLine("FamilyID    (2 Byte): " + DecimalAndHexAndBinary(mapentry.FamilyID));
                        info.AppendLine("MapNumber   (2 Byte): " + DecimalAndHexAndBinary(mapentry.MapNumber));
                        info.AppendLine("Names:");
                        for (int i = 0; i < mapentry.Name.Count; i++)
                        {
                            info.AppendLine("            (" + (mapentry.Name[i].Length + 1).ToString() + " Byte): '" + mapentry.Name[i] + "'");
                        }
                        info.AppendLine("Unknown0    (4 Byte): " + DecimalAndHexAndBinary(mapentry.Unknown0));
                        info.AppendLine("Unknown1    (4 Byte): " + DecimalAndHexAndBinary(mapentry.Unknown1));
                        break;

                    case 'P':
                        info.AppendLine("ProductID   (2 Byte): " + DecimalAndHexAndBinary(mapentry.ProductID));
                        info.AppendLine("FamilyID    (2 Byte): " + DecimalAndHexAndBinary(mapentry.FamilyID));
                        info.AppendLine("Unknown2    (2 Byte): " + DecimalAndHexAndBinary(mapentry.Unknown2));
                        info.AppendLine("Unknown3    (2 Byte): " + DecimalAndHexAndBinary(mapentry.Unknown3));
                        info.AppendLine("Unknown4    (2 Byte): " + DecimalAndHexAndBinary(mapentry.Unknown4));
                        break;

                    case 'F':
                        info.AppendLine("ProductID   (2 Byte): " + DecimalAndHexAndBinary(mapentry.ProductID));
                        info.AppendLine("FamilyID    (2 Byte): " + DecimalAndHexAndBinary(mapentry.FamilyID));
                        info.AppendLine("Names:");
                        for (int i = 0; i < mapentry.Name.Count; i++)
                        {
                            info.AppendLine("            (" + (mapentry.Name[i].Length + 1).ToString() + " Byte): '" + mapentry.Name[i] + "'");
                        }
                        break;

                    case 'V':
                        info.AppendLine("Names:");
                        for (int i = 0; i < mapentry.Name.Count; i++)
                        {
                            info.AppendLine("            (" + (mapentry.Name[i].Length + 1).ToString() + " Byte): '" + mapentry.Name[i] + "'");
                        }
                        info.AppendLine("Unknown5    (1 Byte): " + DecimalAndHexAndBinary(mapentry.Unknown5));
                        break;

                    default:
                        break;
                    }
                }
                break;

            default:
                info.AppendLine("internal error: no info for nodetype '" + nodetype.ToString() + "'");
                break;
            }

            if (hexlen > 0)
            {
                hex = HexRange(firsthexadr, filedata.BinaryReader, hexlen);
            }
        }
예제 #5
0
        /// <summary>
        /// Funktion für alle Datei-Infos
        /// </summary>
        /// <param name="info"></param>
        /// <param name="hex"></param>
        /// <param name="firsthexadr"></param>
        /// <param name="filedata"></param>
        /// <param name="nodetype">"Thema" der Info</param>
        /// <param name="idx">wenn größer oder gleich 0, dann der Index auf ein Objekt einer Tabelle</param>
        /// <param name="tn"></param>
        public static void SectionAndIndex(StringBuilder info, out byte[] hex, out long firsthexadr, NodeContent.Content4File filedata, NodeContent.NodeType nodetype, int idx, TreeViewData tvd)
        {
            GarminCore.Files.File_TDB tdb = filedata.GetGarminFileAsTDB();
            int hexlen = 0;

            firsthexadr = 0;
            hex         = null;
            GarminCore.DataBlock block;

            switch (nodetype)
            {
            case NodeContent.NodeType.TDB_Header:
                block       = TDBBlock(tdb, GarminCore.Files.File_TDB.BlockHeader.Typ.Header);
                firsthexadr = block.Offset;
                hexlen      = (int)block.Length;

                info.AppendLine("ProductID             (2 Byte): " + DecimalAndHexAndBinary(tdb.Head.ProductID));
                info.AppendLine("FamilyID              (2 Byte): " + DecimalAndHexAndBinary(tdb.Head.FamilyID));
                info.AppendLine("TDBVersion            (2 Byte): " + DecimalAndHexAndBinary(tdb.Head.TDBVersion));
                info.AppendLine("MapSeriesName         (" + (tdb.Head.MapSeriesName.Length + 1).ToString() + " Byte): '" + tdb.Head.MapSeriesName + "'");
                info.AppendLine("ProductVersion        (2 Byte): " + DecimalAndHexAndBinary(tdb.Head.ProductVersion));
                info.AppendLine("MapFamilyName         (" + (tdb.Head.MapFamilyName.Length + 1).ToString() + " Byte): '" + tdb.Head.MapFamilyName + "'");
                if (tdb.Head.TDBVersion >= 407)
                {
                    info.AppendLine("Unknown1              (1 Byte): " + DecimalAndHexAndBinary(tdb.Head.Unknown1));
                    info.AppendLine("MaxCoordbits4Overview (1 Byte): " + DecimalAndHexAndBinary(tdb.Head.MaxCoordbits4Overview));
                    info.AppendLine("Unknown2              (1 Byte): " + DecimalAndHexAndBinary(tdb.Head.Unknown2));
                    info.AppendLine("Unknown3              (1 Byte): " + DecimalAndHexAndBinary(tdb.Head.Unknown3));
                    info.AppendLine("Unknown4              (1 Byte): " + DecimalAndHexAndBinary(tdb.Head.Unknown4));
                    info.AppendLine("Unknown5              (1 Byte): " + DecimalAndHexAndBinary(tdb.Head.Unknown5));
                    info.AppendLine("Unknown6              (1 Byte): " + DecimalAndHexAndBinary(tdb.Head.Unknown6));
                    info.AppendLine("Unknown7              (1 Byte): " + DecimalAndHexAndBinary(tdb.Head.Unknown7));
                    info.AppendLine("Unknown8              (1 Byte): " + DecimalAndHexAndBinary(tdb.Head.Unknown8));
                    info.AppendLine("Unknown9              (1 Byte): " + DecimalAndHexAndBinary(tdb.Head.Unknown9));
                    info.AppendLine("HighestRoutable       (1 Byte): " + DecimalAndHexAndBinary(tdb.Head.HighestRoutable));
                    info.AppendLine("Unknown10             (1 Byte): " + DecimalAndHexAndBinary(tdb.Head.Unknown10));
                    info.AppendLine("Unknown11             (1 Byte): " + DecimalAndHexAndBinary(tdb.Head.Unknown11));
                    info.AppendLine("Unknown12             (1 Byte): " + DecimalAndHexAndBinary(tdb.Head.Unknown12));
                    info.AppendLine("Unknown13             (1 Byte): " + DecimalAndHexAndBinary(tdb.Head.Unknown13));
                    info.AppendLine("Unknown14             (1 Byte): " + DecimalAndHexAndBinary(tdb.Head.Unknown14));
                    info.AppendLine("Unknown15             (1 Byte): " + DecimalAndHexAndBinary(tdb.Head.Unknown15));
                    info.AppendLine("Unknown16             (1 Byte): " + DecimalAndHexAndBinary(tdb.Head.Unknown16));
                    info.AppendLine("Unknown17             (1 Byte): " + DecimalAndHexAndBinary(tdb.Head.Unknown17));
                    info.AppendLine("Unknown18             (1 Byte): " + DecimalAndHexAndBinary(tdb.Head.Unknown18));
                    info.AppendLine("Unknown19             (1 Byte): " + DecimalAndHexAndBinary(tdb.Head.Unknown19));
                    info.AppendLine("Unknown20             (1 Byte): " + DecimalAndHexAndBinary(tdb.Head.Unknown20));
                    info.AppendLine("Unknown21             (1 Byte): " + DecimalAndHexAndBinary(tdb.Head.Unknown21));
                    info.AppendLine("Unknown22             (1 Byte): " + DecimalAndHexAndBinary(tdb.Head.Unknown22));
                    info.AppendLine("Unknown23             (1 Byte): " + DecimalAndHexAndBinary(tdb.Head.Unknown23));
                    info.AppendLine("Unknown24             (1 Byte): " + DecimalAndHexAndBinary(tdb.Head.Unknown24));
                    info.AppendLine("Unknown25             (1 Byte): " + DecimalAndHexAndBinary(tdb.Head.Unknown25));
                    info.AppendLine("Unknown26             (1 Byte): " + DecimalAndHexAndBinary(tdb.Head.Unknown26));
                    info.AppendLine("Unknown27             (1 Byte): " + DecimalAndHexAndBinary(tdb.Head.Unknown27));
                    info.AppendLine("Unknown28             (1 Byte): " + DecimalAndHexAndBinary(tdb.Head.Unknown28));
                    info.AppendLine("CodePage              (4 Byte): " + DecimalAndHexAndBinary(tdb.Head.CodePage));
                    info.AppendLine("Unknown29             (4 Byte): " + DecimalAndHexAndBinary(tdb.Head.Unknown29));
                    info.AppendLine("Routable              (1 Byte): " + DecimalAndHexAndBinary(tdb.Head.Routable));
                    info.AppendLine("HasProfileInformation (1 Byte): " + DecimalAndHexAndBinary(tdb.Head.HasProfileInformation));
                    info.AppendLine("HasDEM                (1 Byte): " + DecimalAndHexAndBinary(tdb.Head.HasDEM));
                    if (tdb.Head.TDBVersion >= 411)
                    {
                        info.AppendLine("Unknown30             (1 Byte): " + DecimalAndHexAndBinary(tdb.Head.Unknown30));
                        info.AppendLine("Unknown31             (1 Byte): " + DecimalAndHexAndBinary(tdb.Head.Unknown31));
                        info.AppendLine("Unknown32             (1 Byte): " + DecimalAndHexAndBinary(tdb.Head.Unknown32));
                        info.AppendLine("Unknown33             (1 Byte): " + DecimalAndHexAndBinary(tdb.Head.Unknown33));
                        info.AppendLine("Unknown34             (1 Byte): " + DecimalAndHexAndBinary(tdb.Head.Unknown34));
                        info.AppendLine("Unknown35             (1 Byte): " + DecimalAndHexAndBinary(tdb.Head.Unknown35));
                        info.AppendLine("Unknown36             (1 Byte): " + DecimalAndHexAndBinary(tdb.Head.Unknown36));
                        info.AppendLine("Unknown37             (1 Byte): " + DecimalAndHexAndBinary(tdb.Head.Unknown37));
                        info.AppendLine("Unknown38             (1 Byte): " + DecimalAndHexAndBinary(tdb.Head.Unknown38));
                        info.AppendLine("Unknown39             (1 Byte): " + DecimalAndHexAndBinary(tdb.Head.Unknown39));
                        info.AppendLine("Unknown40             (1 Byte): " + DecimalAndHexAndBinary(tdb.Head.Unknown40));
                        info.AppendLine("Unknown41             (1 Byte): " + DecimalAndHexAndBinary(tdb.Head.Unknown41));
                        info.AppendLine("Unknown42             (1 Byte): " + DecimalAndHexAndBinary(tdb.Head.Unknown42));
                        info.AppendLine("Unknown43             (1 Byte): " + DecimalAndHexAndBinary(tdb.Head.Unknown43));
                        info.AppendLine("Unknown44             (1 Byte): " + DecimalAndHexAndBinary(tdb.Head.Unknown44));
                        info.AppendLine("Unknown45             (1 Byte): " + DecimalAndHexAndBinary(tdb.Head.Unknown45));
                        info.AppendLine("Unknown46             (1 Byte): " + DecimalAndHexAndBinary(tdb.Head.Unknown46));
                        info.AppendLine("Unknown47             (1 Byte): " + DecimalAndHexAndBinary(tdb.Head.Unknown47));
                        info.AppendLine("Unknown48             (1 Byte): " + DecimalAndHexAndBinary(tdb.Head.Unknown48));
                        info.AppendLine("Unknown49             (1 Byte): " + DecimalAndHexAndBinary(tdb.Head.Unknown49));
                    }
                }
                break;

            case NodeContent.NodeType.TDB_Copyright:
                block       = TDBBlock(tdb, GarminCore.Files.File_TDB.BlockHeader.Typ.Copyright);
                firsthexadr = block.Offset;
                hexlen      = (int)block.Length;
                if (idx < 0)
                {
                    info.AppendLine("Segmente: " + tdb.Copyright.Segments.Count.ToString());
                }
                else
                {
                    GarminCore.Files.File_TDB.SegmentedCopyright.Segment segment = tdb.Copyright.Segments[idx];
                    info.AppendLine("CopyrightCode   (1 Byte): " + segment.CopyrightCode.ToString() + " / " + DecimalAndHexAndBinary((byte)segment.CopyrightCode));
                    info.AppendLine("WhereCode       (1 Byte): " + segment.WhereCode.ToString() + " / " + DecimalAndHexAndBinary((byte)segment.WhereCode));
                    info.AppendLine("ExtraProperties (2 Byte): " + DecimalAndHexAndBinary(segment.ExtraProperties));
                    info.AppendLine("Copyright       (" + (segment.Copyright.Length + 1).ToString() + " Byte): '" + segment.Copyright + "'");
                    for (int i = 0; i < tdb.Copyright.Segments.Count && i < idx; i++)
                    {
                        firsthexadr += (uint)(4 + tdb.Copyright.Segments[i].Copyright.Length + 1);
                    }
                    hexlen = 4 + segment.Copyright.Length + 1;
                }
                break;

            case NodeContent.NodeType.TDB_Crc:
                block       = TDBBlock(tdb, GarminCore.Files.File_TDB.BlockHeader.Typ.Crc);
                firsthexadr = block.Offset;
                hexlen      = (int)block.Length;
                info.AppendLine("Unknown1 (2 Byte): " + DecimalAndHexAndBinary(tdb.Crc.Unknown1));
                info.AppendLine("A        (1 Byte): " + DecimalAndHexAndBinary(tdb.Crc.A));
                info.AppendLine("Unknown2 (4 Byte): " + DecimalAndHexAndBinary(tdb.Crc.Unknown2));
                info.AppendLine("Unknown3 (2 Byte): " + DecimalAndHexAndBinary(tdb.Crc.Unknown3));
                info.AppendLine("B        (1 Byte): " + DecimalAndHexAndBinary(tdb.Crc.B));
                info.AppendLine("Unknown4 (2 Byte): " + DecimalAndHexAndBinary(tdb.Crc.Unknown4));
                info.AppendLine("C        (1 Byte): " + DecimalAndHexAndBinary(tdb.Crc.C));
                info.AppendLine("Unknown5 (4 Byte): " + DecimalAndHexAndBinary(tdb.Crc.Unknown5));
                info.AppendLine("D        (1 Byte): " + DecimalAndHexAndBinary(tdb.Crc.D));
                info.AppendLine("Unknown6 (2 Byte): " + DecimalAndHexAndBinary(tdb.Crc.Unknown6));
                break;

            case NodeContent.NodeType.TDB_Description:
                block       = TDBBlock(tdb, GarminCore.Files.File_TDB.BlockHeader.Typ.Description);
                firsthexadr = block.Offset;
                hexlen      = (int)block.Length;
                info.AppendLine("Unknown1       (1 Byte): " + DecimalAndHexAndBinary(tdb.Mapdescription.Unknown1));
                info.AppendLine("Mapdescription (" + (tdb.Mapdescription.Text.Length + 1).ToString() + " Byte): '" + tdb.Mapdescription.Text + "'");
                break;

            case NodeContent.NodeType.TDB_Overviewmap:
                block       = TDBBlock(tdb, GarminCore.Files.File_TDB.BlockHeader.Typ.Overviewmap);
                firsthexadr = block.Offset;
                hexlen      = (int)block.Length;
                info.AppendLine("Mapnumber       (4 Byte): " + DecimalAndHexAndBinary(tdb.Overviewmap.Mapnumber));
                info.AppendLine("ParentMapnumber (4 Byte): " + DecimalAndHexAndBinary(tdb.Overviewmap.ParentMapnumber));
                info.AppendLine("North           (4 Byte): " + DecimalAndHexAndBinary(tdb.Overviewmap.north) + "; " + tdb.Overviewmap.North.ToString() + "°");
                info.AppendLine("East            (4 Byte): " + DecimalAndHexAndBinary(tdb.Overviewmap.east) + "; " + tdb.Overviewmap.East.ToString() + "°");
                info.AppendLine("South           (4 Byte): " + DecimalAndHexAndBinary(tdb.Overviewmap.south) + "; " + tdb.Overviewmap.South.ToString() + "°");
                info.AppendLine("West            (4 Byte): " + DecimalAndHexAndBinary(tdb.Overviewmap.west) + "; " + tdb.Overviewmap.West.ToString() + "°");
                info.AppendLine("Description     (" + (tdb.Overviewmap.Description.Length + 1).ToString() + " Byte): '" + tdb.Overviewmap.Description + "'");
                break;

            case NodeContent.NodeType.TDB_Tilemap:
                if (idx < 0)
                {
                    info.AppendLine("Tilemaps: " + tdb.Tilemap.Count);
                }
                else
                {
                    block       = TDBBlock(tdb, GarminCore.Files.File_TDB.BlockHeader.Typ.Tilemap, idx);
                    firsthexadr = block.Offset;
                    hexlen      = (int)block.Length;

                    int readlen = 0;
                    GarminCore.Files.File_TDB.TileMap tilemap = tdb.Tilemap[idx];
                    info.AppendLine("Mapnumber       (4 Byte): " + DecimalAndHexAndBinary(tilemap.Mapnumber));
                    info.AppendLine("ParentMapnumber (4 Byte): " + DecimalAndHexAndBinary(tilemap.ParentMapnumber));
                    info.AppendLine("North           (4 Byte): " + DecimalAndHexAndBinary(tilemap.north) + "; " + tilemap.North.ToString() + "°");
                    info.AppendLine("East            (4 Byte): " + DecimalAndHexAndBinary(tilemap.east) + "; " + tilemap.East.ToString() + "°");
                    info.AppendLine("South           (4 Byte): " + DecimalAndHexAndBinary(tilemap.south) + "; " + tilemap.South.ToString() + "°");
                    info.AppendLine("West            (4 Byte): " + DecimalAndHexAndBinary(tilemap.west) + "; " + tilemap.West.ToString() + "°");
                    readlen += 6 * 4;
                    info.AppendLine("Description     (" + (tilemap.Description.Length + 1).ToString() + " Byte): '" + tilemap.Description + "'");
                    readlen += tilemap.Description.Length + 1;
                    info.AppendLine("Unknown1        (2 Byte): " + DecimalAndHexAndBinary(tilemap.Unknown1));
                    info.AppendLine("SubCount        (2 Byte): " + DecimalAndHexAndBinary(tilemap.SubCount));
                    info.AppendLine("Size:");
                    for (int i = 0; i < tilemap.DataSize.Count; i++)
                    {
                        info.AppendLine("                (4 Byte): " + DecimalAndHexAndBinary(tilemap.DataSize[i]));
                    }
                    readlen += 2 * 2 + tilemap.DataSize.Count * 4;
                    if (block.Length - readlen >= 7)
                    {
                        info.AppendLine("HasCopyright    (1 Byte): " + DecimalAndHexAndBinary(tilemap.HasCopyright));
                        info.AppendLine("Unknown2        (1 Byte): " + DecimalAndHexAndBinary(tilemap.Unknown2));
                        info.AppendLine("Unknown3        (1 Byte): " + DecimalAndHexAndBinary(tilemap.Unknown3));
                        info.AppendLine("Unknown4        (1 Byte): " + DecimalAndHexAndBinary(tilemap.Unknown4));
                        info.AppendLine("Unknown5        (1 Byte): " + DecimalAndHexAndBinary(tilemap.Unknown5));
                        info.AppendLine("Unknown6        (1 Byte): " + DecimalAndHexAndBinary(tilemap.Unknown6));
                        info.AppendLine("Unknown7        (1 Byte): " + DecimalAndHexAndBinary(tilemap.Unknown7));
                        readlen += 7;
                        if (block.Length - readlen > 0)
                        {
                            info.AppendLine("Name:");
                            for (int i = 0; i < tilemap.Name.Count; i++)
                            {
                                info.AppendLine("                (" + (tilemap.Name[i].Length + 1).ToString() + " Byte): '" + tilemap.Name[i] + "'");
                            }
                            if (block.Length - readlen >= 2)
                            {
                                info.AppendLine("Unknown8        (8 Byte): " + DecimalAndHexAndBinary(tilemap.Unknown8));
                                info.AppendLine("Unknown9        (9 Byte): " + DecimalAndHexAndBinary(tilemap.Unknown9));
                            }
                        }
                    }
                }
                break;

            case NodeContent.NodeType.TDB_Unknown:
                block       = TDBBlock(tdb, GarminCore.Files.File_TDB.BlockHeader.Typ.Unknown);
                firsthexadr = block.Offset;
                hexlen      = (int)block.Length;
                break;

            default:
                info.AppendLine("internal error: no info for nodetype '" + nodetype.ToString() + "'");
                break;
            }

            if (hexlen > 0)
            {
                hex = HexRange(firsthexadr, filedata.BinaryReader, hexlen);
            }
        }
예제 #6
0
        /// <summary>
        /// Funktion für alle RGN-Datei-Infos
        /// </summary>
        /// <param name="info"></param>
        /// <param name="hex"></param>
        /// <param name="firsthexadr"></param>
        /// <param name="filedata"></param>
        /// <param name="nodetype"></param>
        /// <param name="idx"></param>
        /// <param name="tvd"></param>
        public static void SectionAndIndex(StringBuilder info, out byte[] hex, out long firsthexadr, NodeContent.Content4File filedata, NodeContent.NodeType nodetype, int idx, TreeViewData tvd)
        {
            GarminCore.Files.StdFile_RGN rgn = filedata.GetGarminFileAsRGN(tvd.GetTRE(filedata.Basename));
            int hexlen = 0;

            firsthexadr = 0;
            hex         = null;
            AllSubdivInfo asi = null;

            switch (nodetype)
            {
            case NodeContent.NodeType.RGN_PostHeaderData:
                firsthexadr = rgn.PostHeaderDataBlock.Offset;
                if (idx < 0)
                {
                    info.AppendLine("PostHeaderDataBlock: " + rgn.PostHeaderDataBlock.ToString());
                    hexlen = (int)rgn.PostHeaderDataBlock.Length;
                }
                break;

            case NodeContent.NodeType.RGN_SubdivContentBlock:
                firsthexadr = rgn.SubdivContentBlock.Offset;
                if (idx < 0)
                {
                    int tab = 22;
                    info.AppendLine(FillWithSpace("SubdivContent", tab, false, rgn.SubdivList.Count.ToString()));
                    info.AppendLine(FillWithSpace("  Block", tab, false, rgn.SubdivContentBlock.ToString()));
                    hexlen = (int)rgn.SubdivContentBlock.Length;
                    if (hexlen > 0 && rgn.SubdivList.Count == 0)
                    {
                        info.AppendLine("data propably encrypted");
                    }
                }
                else
                {
                    asi = new AllSubdivInfo(rgn, filedata.BinaryReader, idx);

                    info.AppendLine("Info from TRE:");
                    DataTRE.SampleInfo4SubdivInfo(info, rgn.TREFile, idx);
                    info.AppendLine();

                    info.AppendLine("Info from RGN:");
                    GarminCore.DataBlock block = SampleInfo4SubdivData(info, rgn, asi);
                    firsthexadr += block.Offset;
                    hexlen       = (int)block.Length;
                }
                break;

            case NodeContent.NodeType.RGN_ExtAreasBlock:
                firsthexadr = rgn.ExtAreasBlock.Offset;
                if (idx < 0)
                {
                    info.AppendLine("ExtAreas");
                    info.AppendLine("  Block:  " + rgn.ExtAreasBlock.ToString());
                    hexlen = (int)rgn.ExtAreasBlock.Length;
                }
                else
                {
                    int subdividx = -1;
                    int count     = 0;
                    idx &= RGN_IDX_MASK; // Gesamt-Index des ExtArea
                    for (subdividx = 0; subdividx < rgn.SubdivList.Count; subdividx++)
                    {
                        count += rgn.SubdivList[subdividx].ExtAreaList.Count;
                        if (idx < count)
                        {
                            break;
                        }
                    }
                    if (subdividx < rgn.SubdivList.Count)
                    {
                        asi = new AllSubdivInfo(rgn, filedata.BinaryReader, subdividx);
                        int idx2 = asi.SubdivData.ExtAreaList.Count - (count - idx);
                        info.AppendLine("ExtArea " + idx2.ToString() + " from Subdiv " + subdividx.ToString());
                        ShowExtAreaInfo(info, asi, rgn, tvd, filedata, idx2, 40, out hexlen, out firsthexadr);
                    }
                }
                break;

            case NodeContent.NodeType.RGN_ExtLinesBlock:
                firsthexadr = rgn.ExtLinesBlock.Offset;
                if (idx < 0)
                {
                    info.AppendLine("ExtLines");
                    info.AppendLine("  Block:  " + rgn.ExtLinesBlock.ToString());
                    hexlen = (int)rgn.ExtLinesBlock.Length;
                }
                else
                {
                    int subdividx = -1;
                    int count     = 0;
                    idx &= RGN_IDX_MASK; // Gesamt-Index des ExtArea
                    for (subdividx = 0; subdividx < rgn.SubdivList.Count; subdividx++)
                    {
                        count += rgn.SubdivList[subdividx].ExtLineList.Count;
                        if (idx < count)
                        {
                            break;
                        }
                    }
                    if (subdividx < rgn.SubdivList.Count)
                    {
                        asi = new AllSubdivInfo(rgn, filedata.BinaryReader, subdividx);
                        int idx2 = asi.SubdivData.ExtLineList.Count - (count - idx);
                        info.AppendLine("ExtLine " + idx2.ToString() + " from Subdiv " + subdividx.ToString());
                        ShowExtLineInfo(info, asi, rgn, tvd, filedata, idx2, 40, out hexlen, out firsthexadr);
                    }
                }
                break;

            case NodeContent.NodeType.RGN_ExtPointsBlock:
                firsthexadr = rgn.ExtPointsBlock.Offset;
                if (idx < 0)
                {
                    info.AppendLine("ExtPoints");
                    info.AppendLine("  Block:  " + rgn.ExtPointsBlock.ToString());
                    hexlen = (int)rgn.ExtPointsBlock.Length;
                }
                else
                {
                    int subdividx = -1;
                    int count     = 0;
                    idx &= RGN_IDX_MASK; // Gesamt-Index des ExtArea
                    for (subdividx = 0; subdividx < rgn.SubdivList.Count; subdividx++)
                    {
                        count += rgn.SubdivList[subdividx].ExtPointList.Count;
                        if (idx < count)
                        {
                            break;
                        }
                    }
                    if (subdividx < rgn.SubdivList.Count)
                    {
                        asi = new AllSubdivInfo(rgn, filedata.BinaryReader, subdividx);
                        int idx2 = asi.SubdivData.ExtPointList.Count - (count - idx);
                        info.AppendLine("ExtPoint " + idx2.ToString() + " from Subdiv " + subdividx.ToString());
                        ShowExtPointInfo(info, asi, rgn, tvd, filedata, idx2, 40, out hexlen, out firsthexadr);
                    }
                }
                break;

            case NodeContent.NodeType.RGN_UnknownBlock_0x71:
                firsthexadr = rgn.UnknownBlock_0x71.Offset;
                if (idx < 0)
                {
                    info.AppendLine("UnknownBlock 0x71");
                    info.AppendLine("  Block:  " + rgn.UnknownBlock_0x71.ToString());
                    hexlen = (int)rgn.UnknownBlock_0x71.Length;
                }
                break;

            case NodeContent.NodeType.Index:
                if (tvd.TreeView.SelectedNode != null)
                {
                    int subdividx = -1;

                    // etwas tricky ...
                    NodeContent nc = NodeContent4TreeNode(tvd.TreeView.SelectedNode.Parent);
                    switch (nc.Type)
                    {
                    case NodeContent.NodeType.Index:  // wenn der übergeordnete Knoten ein Index ist, dann ist es ein Subdiv-Index
                        subdividx = (int)nc.Data;
                        if (subdividx >= 0)
                        {
                            asi = new AllSubdivInfo(rgn, filedata.BinaryReader, subdividx);
                        }
                        break;
                    }
                }

                if (asi != null)
                {
                    if ((idx & RGN_IDX_POINT1) != 0)
                    {
                        idx &= RGN_IDX_MASK;
                        int tab = 40;

                        GarminCore.Files.StdFile_RGN.RawPointData point = asi.GetPoint(idx);
                        GarminCore.Files.StdFile_LBL lbl = tvd.GetLBL(filedata.Basename);

                        info.AppendLine(FillWithSpace("Type             (1 Byte)", tab, false, DecimalAndHexAndBinary(point.Type)));
                        info.AppendLine(FillWithSpace("LabelOffsetInLBL (3 Byte) (Bit 0..21)", tab, false, DecimalAndHexAndBinary(point.LabelOffsetInLBL)));
                        if (lbl != null)
                        {
                            info.AppendLine(FillWithSpace("   Text (from LBL)", tab, true, point.GetText(lbl, true)));
                        }
                        info.AppendLine(FillWithSpace("HasSubtype                (Bit 23)", tab, false, point.HasSubtype.ToString()));
                        info.AppendLine(FillWithSpace("IsPoiOffset               (Bit 22)", tab, false, point.IsPoiOffset.ToString()));
                        info.AppendLine(FillWithSpace("DeltaLongitude   (2 Byte)", tab, false, DecimalAndHexAndBinary((short)point.RawDeltaLongitude.Value) + ", " + point.RawDeltaLongitude.ValueDegree.ToString() + "°"));
                        info.AppendLine(FillWithSpace("DeltaLatitude    (2 Byte)", tab, false, DecimalAndHexAndBinary((short)point.RawDeltaLatitude.Value) + ", " + point.RawDeltaLatitude.ValueDegree.ToString() + "°"));
                        if (point.HasSubtype)
                        {
                            info.AppendLine(FillWithSpace("Subtype        (1 Byte)", tab, false, DecimalAndHexAndBinary(point.Subtype)));
                        }

                        GarminCore.DataBlock block = asi.GetDataBlock4Object(GarminCore.Files.StdFile_TRE.SubdivInfoBasic.SubdivContent.poi, idx);
                        firsthexadr  = rgn.SubdivContentBlock.Offset;
                        firsthexadr += block.Offset;
                        hexlen       = (int)block.Length;
                    }
                    else if ((idx & RGN_IDX_POINT2) != 0)
                    {
                        idx &= RGN_IDX_MASK;
                        int tab = 40;

                        GarminCore.Files.StdFile_RGN.RawPointData point = asi.GetIdxPoint(idx);
                        GarminCore.Files.StdFile_LBL lbl = tvd.GetLBL(filedata.Basename);

                        info.AppendLine(FillWithSpace("Type             (1 Byte)", tab, false, DecimalAndHexAndBinary(point.Type)));
                        info.AppendLine(FillWithSpace("LabelOffsetInLBL (3 Byte) (Bit 0..21)", tab, false, DecimalAndHexAndBinary(point.LabelOffsetInLBL)));
                        if (lbl != null)
                        {
                            info.AppendLine(FillWithSpace("   Text (from LBL)", tab, true, point.GetText(lbl, true)));
                        }
                        info.AppendLine(FillWithSpace("HasSubtype                (Bit 23)", tab, false, point.HasSubtype.ToString()));
                        info.AppendLine(FillWithSpace("IsPoiOffset               (Bit 22)", tab, false, point.IsPoiOffset.ToString()));
                        info.AppendLine(FillWithSpace("DeltaLongitude   (2 Byte)", tab, false, DecimalAndHexAndBinary((short)point.RawDeltaLongitude.Value) + ", " + point.RawDeltaLongitude.ValueDegree.ToString() + "°"));
                        info.AppendLine(FillWithSpace("DeltaLatitude    (2 Byte)", tab, false, DecimalAndHexAndBinary((short)point.RawDeltaLatitude.Value) + ", " + point.RawDeltaLatitude.ValueDegree.ToString() + "°"));
                        if (point.HasSubtype)
                        {
                            info.AppendLine(FillWithSpace("Subtype          (1 Byte)", tab, false, DecimalAndHexAndBinary(point.Subtype)));
                        }

                        GarminCore.DataBlock block = asi.GetDataBlock4Object(GarminCore.Files.StdFile_TRE.SubdivInfoBasic.SubdivContent.idxpoi, idx);
                        firsthexadr  = rgn.SubdivContentBlock.Offset;
                        firsthexadr += block.Offset;
                        hexlen       = (int)block.Length;
                    }
                    else if ((idx & RGN_IDX_LINE) != 0)
                    {
                        idx &= RGN_IDX_MASK;
                        int tab = 40;

                        GarminCore.Files.StdFile_RGN.RawPolyData poly = asi.GetLine(idx);
                        GarminCore.Files.StdFile_LBL             lbl  = tvd.GetLBL(filedata.Basename);
                        GarminCore.Files.StdFile_NET             net  = tvd.GetNET(filedata.Basename);

                        info.AppendLine(FillWithSpace("Type             (1 Byte) (Bit 0..5)", tab, false, DecimalAndHexAndBinary(poly.Type)));
                        info.AppendLine(FillWithSpace("TwoByteLength             (Bit 7)", tab, false, poly.TwoByteLength.ToString()));
                        if (!poly.IsPolygon)
                        {
                            info.AppendLine(FillWithSpace("Direction                 (Bit 6)", tab, false, poly.DirectionIndicator.ToString()));
                        }
                        info.AppendLine(FillWithSpace("LabelOffsetInLBL (3 Byte) (Bit 0..21)", tab, false, DecimalAndHexAndBinary(poly.LabelOffsetInLBL)));

                        if (!poly.LabelInNET)
                        {
                            if (lbl != null)
                            {
                                info.AppendLine(FillWithSpace("Text (from LBL)", tab, true, poly.GetText(lbl, true)));
                            }
                        }
                        else
                        {
                            if (net != null)
                            {
                                GarminCore.Files.StdFile_NET.RoadData rd = net.GetRoadData(poly.LabelOffsetInLBL);
                                if (rd != null)
                                {
                                    info.AppendLine(FillWithSpace("Text (from NET, LBL)", tab, true, rd.GetText(lbl, true)));
                                }
                            }
                        }

                        info.AppendLine(FillWithSpace("WithExtraBit              (Bit 22)", tab, false, poly.WithExtraBit.ToString()));
                        info.AppendLine(FillWithSpace("LabelInNET                (Bit 23)", tab, false, poly.LabelInNET.ToString()));
                        info.AppendLine(FillWithSpace("DeltaLongitude   (2 Byte)", tab, false, DecimalAndHexAndBinary((short)poly.RawDeltaLongitude.Value) + ", " + poly.RawDeltaLongitude.ValueDegree.ToString() + "°"));
                        info.AppendLine(FillWithSpace("DeltaLatitude    (2 Byte)", tab, false, DecimalAndHexAndBinary((short)poly.RawDeltaLatitude.Value) + ", " + poly.RawDeltaLatitude.ValueDegree.ToString() + "°"));
                        info.AppendLine(FillWithSpace("BitstreamInfo    (1 Byte)", tab, false, DecimalAndHexAndBinary(poly.bitstreamInfo)));
                        info.AppendLine(FillWithSpace("   basebits4lat", tab, false, DecimalAndHexAndBinary(poly.bitstreamInfo >> 4)));
                        info.AppendLine(FillWithSpace("   basebits4lon", tab, false, DecimalAndHexAndBinary(poly.bitstreamInfo & 0xF)));
                        info.AppendLine(FillWithSpace("BitstreamLength (" + (poly.TwoByteLength ? "2" : "1") + " Byte)", tab, false, DecimalAndHexAndBinary(poly.bitstream.Length)));
                        if (poly.WithExtraBit)
                        {
                            info.AppendLine(FillWithSpace("ExtraBitList", tab, false, AllSubdivInfo.ExtraBits(poly)));
                        }
                        info.AppendLine("Deltas:");
                        List <GarminCore.Files.StdFile_RGN.GeoDataBitstream.RawPoint> points = poly.GetRawPoints();
                        for (int i = 0; i < points.Count; i++)
                        {
                            info.AppendLine("   " + points[i].ToString() + " / " + points[0].GetMapUnitPoint(rgn.TREFile.MaplevelList[asi.MaplevelNo].CoordBits, asi.SubdivfInfo.Center).ToString());
                        }

                        GarminCore.DataBlock block = asi.GetDataBlock4Object(GarminCore.Files.StdFile_TRE.SubdivInfoBasic.SubdivContent.line, idx);
                        firsthexadr  = rgn.SubdivContentBlock.Offset;
                        firsthexadr += block.Offset;
                        hexlen       = (int)block.Length;
                    }
                    else if ((idx & RGN_IDX_AREA) != 0)
                    {
                        idx &= RGN_IDX_MASK;
                        int tab = 40;

                        GarminCore.Files.StdFile_RGN.RawPolyData poly = asi.GetArea(idx);
                        GarminCore.Files.StdFile_LBL             lbl  = tvd.GetLBL(filedata.Basename);
                        GarminCore.Files.StdFile_NET             net  = tvd.GetNET(filedata.Basename);

                        info.AppendLine(FillWithSpace("Type             (1 Byte) (Bit 0..6) ", tab, false, DecimalAndHexAndBinary(poly.Type)));
                        info.AppendLine(FillWithSpace("TwoByteLength             (Bit 7)", tab, false, poly.TwoByteLength.ToString()));
                        info.AppendLine(FillWithSpace("LabelOffsetInLBL (3 Byte) (Bit 0..21)", tab, false, DecimalAndHexAndBinary(poly.LabelOffsetInLBL)));

                        if (!poly.LabelInNET)
                        {
                            if (lbl != null)
                            {
                                info.AppendLine(FillWithSpace("Text (from LBL)", tab, true, poly.GetText(lbl, true)));
                            }
                        }
                        else
                        {
                            if (net != null)
                            {
                                GarminCore.Files.StdFile_NET.RoadData rd = net.GetRoadData(poly.LabelOffsetInLBL);
                                if (rd != null)
                                {
                                    info.AppendLine(FillWithSpace("Text (from NET, LBL)", tab, true, rd.GetText(lbl, true)));
                                }
                            }
                        }

                        info.AppendLine(FillWithSpace("WithExtraBit              (Bit 22)", tab, false, poly.WithExtraBit.ToString()));
                        info.AppendLine(FillWithSpace("LabelInNET                (Bit 23)", tab, false, poly.LabelInNET.ToString()));
                        info.AppendLine(FillWithSpace("DeltaLongitude   (2 Byte)", tab, false, DecimalAndHexAndBinary((short)poly.RawDeltaLongitude.Value) + ", " + poly.RawDeltaLongitude.ValueDegree.ToString() + "°"));
                        info.AppendLine(FillWithSpace("DeltaLatitude    (2 Byte)", tab, false, DecimalAndHexAndBinary((short)poly.RawDeltaLatitude.Value) + ", " + poly.RawDeltaLatitude.ValueDegree.ToString() + "°"));
                        info.AppendLine(FillWithSpace("BitstreamInfo    (1 Byte)", tab, false, DecimalAndHexAndBinary(poly.bitstreamInfo)));
                        info.AppendLine(FillWithSpace("   basebits4lat", tab, false, DecimalAndHexAndBinary(poly.bitstreamInfo >> 4)));
                        info.AppendLine(FillWithSpace("   basebits4lon", tab, false, DecimalAndHexAndBinary(poly.bitstreamInfo & 0xF)));
                        info.AppendLine(FillWithSpace("BitstreamLength (" + (poly.TwoByteLength ? "2" : "1") + " Byte)", tab, false, DecimalAndHexAndBinary(poly.bitstream.Length)));
                        if (poly.WithExtraBit)
                        {
                            info.AppendLine(FillWithSpace("ExtraBitList", tab, false, AllSubdivInfo.ExtraBits(poly)));
                        }
                        info.AppendLine("Deltas:");
                        List <GarminCore.Files.StdFile_RGN.GeoDataBitstream.RawPoint> points = poly.GetRawPoints();
                        for (int i = 0; i < points.Count; i++)
                        {
                            info.AppendLine("   " + points[i].ToString() + " / " + points[0].GetMapUnitPoint(rgn.TREFile.MaplevelList[asi.MaplevelNo].CoordBits, asi.SubdivfInfo.Center).ToString());
                        }

                        GarminCore.DataBlock block = asi.GetDataBlock4Object(GarminCore.Files.StdFile_TRE.SubdivInfoBasic.SubdivContent.area, idx);
                        firsthexadr  = rgn.SubdivContentBlock.Offset;
                        firsthexadr += block.Offset;
                        hexlen       = (int)block.Length;
                    }
                    else if ((idx & RGN_IDX_EXTPOINT) != 0)
                    {
                        ShowExtPointInfo(info, asi, rgn, tvd, filedata, idx & RGN_IDX_MASK, 40, out hexlen, out firsthexadr);
                    }
                    else if ((idx & RGN_IDX_EXTLINE) != 0)
                    {
                        ShowExtLineInfo(info, asi, rgn, tvd, filedata, idx & RGN_IDX_MASK, 40, out hexlen, out firsthexadr);
                    }
                    else if ((idx & RGN_IDX_EXTAREA) != 0)
                    {
                        ShowExtAreaInfo(info, asi, rgn, tvd, filedata, idx & RGN_IDX_MASK, 40, out hexlen, out firsthexadr);
                    }
                }


                break;

            default:
                info.AppendLine("internal error: no info for nodetype '" + nodetype.ToString() + "'");
                break;
            }

            if (hexlen > 0)
            {
                hex = HexRange(firsthexadr, filedata.BinaryReader, hexlen);
            }
        }
예제 #7
0
        /// <summary>
        /// Funktion für alle Datei-Infos
        /// </summary>
        /// <param name="info"></param>
        /// <param name="hex"></param>
        /// <param name="firsthexadr"></param>
        /// <param name="filedata"></param>
        /// <param name="nodetype">"Thema" der Info</param>
        /// <param name="idx">wenn größer oder gleich 0, dann der Index auf ein Objekt einer Tabelle</param>
        /// <param name="tn"></param>
        public static void SectionAndIndex(StringBuilder info, out byte[] hex, out long firsthexadr, NodeContent.Content4File filedata, NodeContent.NodeType nodetype, int idx, TreeViewData tvd)
        {
            GarminCore.Files.File_MDX mdx = filedata.GetGarminFileAsMDX();
            int hexlen = 0;

            firsthexadr = 0;
            hex         = null;

            switch (nodetype)
            {
            case NodeContent.NodeType.MDX_MapEntry:
                if (idx < 0)
                {
                    firsthexadr = 0;
                    hexlen      = 14;
                    info.AppendLine("           (6 Bytes):  'Midxd'");
                    info.AppendLine("Unknown1   (2 Bytes): " + DecimalAndHexAndBinary(mdx.Unknown1));
                    info.AppendLine("Unknown2   (2 Bytes): " + DecimalAndHexAndBinary(mdx.Unknown2));
                    info.AppendLine("MapEntrys  (4 Bytes): " + DecimalAndHexAndBinary(mdx.Maps.Count));
                }
                else
                {
                    firsthexadr = 14 + idx * 12;
                    hexlen      = 12;

                    GarminCore.Files.File_MDX.MapEntry mapentry = mdx.Maps[idx];
                    info.AppendLine("MapID       (4 Byte): " + DecimalAndHexAndBinary(mapentry.MapID));
                    info.AppendLine("ProductID   (2 Byte): " + DecimalAndHexAndBinary(mapentry.ProductID));
                    info.AppendLine("FamilyID    (2 Byte): " + DecimalAndHexAndBinary(mapentry.FamilyID));
                    info.AppendLine("MapNumber   (4 Byte): " + DecimalAndHexAndBinary(mapentry.MapNumber));
                }
                break;

            default:
                info.AppendLine("internal error: no info for nodetype '" + nodetype.ToString() + "'");
                break;
            }

            if (hexlen > 0)
            {
                hex = HexRange(firsthexadr, filedata.BinaryReader, hexlen);
            }
        }
예제 #8
0
        /// <summary>
        /// Funktion für alle Datei-Infos
        /// </summary>
        /// <param name="info"></param>
        /// <param name="hex"></param>
        /// <param name="firsthexadr"></param>
        /// <param name="filedata"></param>
        /// <param name="nodetype">"Thema" der Info</param>
        /// <param name="idx">wenn größer oder gleich 0, dann der Index auf ein Objekt einer Tabelle</param>
        /// <param name="tn"></param>
        public static void SectionAndIndex(StringBuilder info, out byte[] hex, out long firsthexadr, NodeContent.Content4File filedata, NodeContent.NodeType nodetype, int idx, TreeViewData tvd)
        {
            GarminCore.Files.StdFile_TYP typ = filedata.GetGarminFileAsTYP();
            int hexlen = 0;

            firsthexadr = 0;
            hex         = null;

            switch (nodetype)
            {
            case NodeContent.NodeType.TYP_PolygoneTableBlock:
                firsthexadr = 0x15 + 2 + 3 * 8 + 2 * 2 + 2 * 10; // Daten aus dem Header
                hexlen      = 20;
                if (idx < 0)
                {
                    info.AppendLine("PolygoneTableBlock");
                    info.AppendLine("Offset:              (4 Byte):  " + DecimalAndHexAndBinary(typ.PolygoneTableBlock.Offset));
                    info.AppendLine("Recordsize:          (2 Byte):  " + DecimalAndHexAndBinary(typ.PolygoneTableBlock.Recordsize));
                    info.AppendLine("Length:              (4 Byte):  " + DecimalAndHexAndBinary(typ.PolygoneTableBlock.Length));
                }
                break;

            case NodeContent.NodeType.TYP_PolygoneTable:
                firsthexadr = typ.PolygoneTableBlock.Offset;
                hexlen      = (int)typ.PolygoneTableBlock.Length;
                if (idx < 0)
                {
                    info.AppendLine("PolygoneTableBlock: " + typ.PolygoneTableBlock.ToString());
                }
                else
                {
                    GarminCore.Files.Typ.Polygone poly = typ.GetPolygone(idx);

                    GarminCore.Files.Typ.TableItem ti = typ.PolygonTableItems[idx];
                    info.AppendLine("TableItem " + idx.ToString() + " at position " + DecimalAndHexAndBinary(typ.PolygoneTableBlock.Offset + idx * typ.PolygoneTableBlock.Recordsize));
                    info.AppendLine("rawtype       (2 Byte):              " + DecimalAndHexAndBinary(ti.rawtype, 16));
                    info.AppendLine("   Subtype            (Bit 0..4):    " + DecimalAndHexAndBinary(ti.Subtype, 5));
                    info.AppendLine("   Type               (Bit 5..15):   " + DecimalAndHexAndBinary(ti.Type, 11));
                    info.AppendLine("Offset        (" + (typ.PolygoneTableBlock.Recordsize - 2).ToString() + " Byte):              " + DecimalAndHexAndBinary(ti.Offset));
                    info.AppendLine();

                    firsthexadr = typ.PolygoneDatablock.Offset + ti.Offset;
                    hexlen      = idx < typ.PolygonCount - 1 ? typ.PolygonTableItems[idx + 1].Offset - ti.Offset :
                                  (int)typ.PolygoneTableBlock.Offset - (ti.Offset + (int)typ.PolygoneDatablock.Offset);

                    info.AppendLine("Polygon " + idx.ToString() + " at position " + DecimalAndHexAndBinary(firsthexadr));
                    info.AppendLine("Options          (1 Byte):           " + DecimalAndHexAndBinary(poly.Options));
                    info.AppendLine("   Colortype             (Bit 0..4): " + poly.Colortype.ToString() + " / " + DecimalAndHexAndBinary((byte)poly.Colortype));
                    // Farbdef. des Polygontyps
                    switch (poly.Colortype)
                    {
                    case GarminCore.Files.Typ.Polygone.ColorType.Day1:
                        info.AppendLine("DayColor1        (3 Byte):           " + DecimalAndHex(poly.DayColor1));
                        break;

                    case GarminCore.Files.Typ.Polygone.ColorType.Day1_Night1:
                        info.AppendLine("DayColor1        (3 Byte):           " + DecimalAndHex(poly.DayColor1));
                        info.AppendLine("NightColor1      (3 Byte):           " + DecimalAndHex(poly.NightColor1));
                        break;

                    case GarminCore.Files.Typ.Polygone.ColorType.BM_Day2:
                        info.AppendLine("DayColor1        (3 Byte):           " + DecimalAndHex(poly.DayColor1));
                        info.AppendLine("DayColor2        (3 Byte):           " + DecimalAndHex(poly.DayColor2));
                        info.AppendLine("BitmapDay        (" + DecimalAndHexAndBinary(poly.XBitmapDay.data.rawimgdata.Length) + " Byte):");
                        info.AppendLine("   " + PixMapText(poly.XBitmapDay));
                        break;

                    case GarminCore.Files.Typ.Polygone.ColorType.BM_Day2_Night2:
                        info.AppendLine("DayColor1        (3 Byte):           " + DecimalAndHex(poly.DayColor1));
                        info.AppendLine("DayColor2        (3 Byte):           " + DecimalAndHex(poly.DayColor2));
                        info.AppendLine("NightColor1      (3 Byte):           " + DecimalAndHex(poly.NightColor1));
                        info.AppendLine("NightColor2      (3 Byte):           " + DecimalAndHex(poly.NightColor2));
                        info.AppendLine("BitmapDay        (" + DecimalAndHexAndBinary(poly.XBitmapDay.data.rawimgdata.Length) + " Byte):");
                        info.AppendLine("   " + PixMapText(poly.XBitmapDay));
                        info.AppendLine("XBitmapNight:");
                        info.AppendLine("   " + PixMapText(poly.XBitmapNight));
                        break;

                    case GarminCore.Files.Typ.Polygone.ColorType.BM_Day1_Night2:
                        info.AppendLine("DayColor1        (3 Byte):           " + DecimalAndHex(poly.DayColor1));
                        info.AppendLine("NightColor1      (3 Byte):           " + DecimalAndHex(poly.NightColor1));
                        info.AppendLine("NightColor2      (3 Byte):           " + DecimalAndHex(poly.NightColor2));
                        info.AppendLine("BitmapDay        (" + DecimalAndHexAndBinary(poly.XBitmapDay.data.rawimgdata.Length) + " Byte):");
                        info.AppendLine("   " + PixMapText(poly.XBitmapDay));
                        info.AppendLine("XBitmapNight:");
                        info.AppendLine("   " + PixMapText(poly.XBitmapNight));
                        break;

                    case GarminCore.Files.Typ.Polygone.ColorType.BM_Day2_Night1:
                        info.AppendLine("DayColor1        (3 Byte):           " + DecimalAndHex(poly.DayColor1));
                        info.AppendLine("DayColor2        (3 Byte):           " + DecimalAndHex(poly.DayColor2));
                        info.AppendLine("NightColor1      (3 Byte):           " + DecimalAndHex(poly.NightColor1));
                        info.AppendLine("BitmapDay        (" + DecimalAndHexAndBinary(poly.XBitmapDay.data.rawimgdata.Length) + " Byte):");
                        info.AppendLine("   " + PixMapText(poly.XBitmapDay));
                        info.AppendLine("XBitmapNight:");
                        info.AppendLine("   " + PixMapText(poly.XBitmapNight));
                        break;

                    case GarminCore.Files.Typ.Polygone.ColorType.BM_Day1:
                        info.AppendLine("DayColor1        (3 Byte):           " + DecimalAndHex(poly.DayColor1));
                        info.AppendLine("BitmapDay        (" + DecimalAndHexAndBinary(poly.XBitmapDay.data.rawimgdata.Length) + " Byte):");
                        info.AppendLine("   " + PixMapText(poly.XBitmapDay));
                        break;

                    case GarminCore.Files.Typ.Polygone.ColorType.BM_Day1_Night1:
                        info.AppendLine("DayColor1        (3 Byte):           " + DecimalAndHex(poly.DayColor1));
                        info.AppendLine("NightColor1      (3 Byte):           " + DecimalAndHex(poly.NightColor1));
                        info.AppendLine("BitmapDay        (" + DecimalAndHexAndBinary(poly.XBitmapDay.data.rawimgdata.Length) + " Byte):");
                        info.AppendLine("   " + PixMapText(poly.XBitmapDay));
                        info.AppendLine("XBitmapNight:");
                        info.AppendLine("   " + PixMapText(poly.XBitmapNight));
                        break;
                    }

                    if (poly.WithString)
                    {
                        GarminCore.Files.Typ.MultiText mt = poly.Text;
                        int len = mt.GetIdentificationLength() + mt.GetRealLength();
                        info.AppendLine("Text             (" + DecimalAndHexAndBinary(len) + " Byte):");
                        for (int i = 0; i < mt.Count; i++)
                        {
                            GarminCore.Files.Typ.Text txt = mt.Get(i);
                            info.AppendLine("   " + txt.Language.ToString() + " / " + DecimalAndHexAndBinary((byte)txt.Language) + ": '" + txt.Txt + "'");
                        }
                    }

                    if (poly.WithExtendedOptions)
                    {
                        info.AppendLine("ExtOptions       (1 Byte):           " + DecimalAndHexAndBinary(poly.ExtOptions));
                        info.AppendLine("   FontType              (Bit 0..2): " + poly.FontType.ToString() + " / " + DecimalAndHexAndBinary((byte)poly.FontType));
                        info.AppendLine("   FontColType           (Bit 3,4):  " + poly.FontColType.ToString() + " / " + DecimalAndHexAndBinary((byte)poly.FontColType));
                        switch (poly.FontColType)
                        {
                        case GarminCore.Files.Typ.GraphicElement.FontColours.Day: // es folgt noch 1 Farbe
                            info.AppendLine("FontColor1       (3 Byte):           " + DecimalAndHex(poly.FontColor1));
                            break;

                        case GarminCore.Files.Typ.GraphicElement.FontColours.Night: // es folgt noch 1 Farbe
                            info.AppendLine("FontColor2       (3 Byte):           " + DecimalAndHex(poly.FontColor2));
                            break;

                        case GarminCore.Files.Typ.GraphicElement.FontColours.DayAndNight: // es folgen noch 2 Farben
                            info.AppendLine("FontColor1       (3 Byte):           " + DecimalAndHex(poly.FontColor1));
                            info.AppendLine("FontColor2       (3 Byte):           " + DecimalAndHex(poly.FontColor2));
                            break;
                        }
                    }
                }
                break;

            case NodeContent.NodeType.TYP_PolygoneDraworderTable:
                firsthexadr = typ.PolygoneDraworderTableBlock.Offset;
                hexlen      = (int)typ.PolygoneDraworderTableBlock.Length;
                if (idx < 0)
                {
                    info.AppendLine("PolygoneDraworderTableBlock");
                    info.AppendLine("Offset:     (4 Byte):  " + DecimalAndHexAndBinary(typ.PolygoneDraworderTableBlock.Offset));
                    info.AppendLine("Recordsize: (2 Byte):  " + DecimalAndHexAndBinary(typ.PolygoneDraworderTableBlock.Recordsize));
                    info.AppendLine("Length:     (4 Byte):  " + DecimalAndHexAndBinary(typ.PolygoneDraworderTableBlock.Length));
                }
                else
                {
                    hexlen       = typ.PolygoneDraworderTableBlock.Recordsize;
                    firsthexadr += idx * hexlen;

                    GarminCore.Files.Typ.PolygonDraworderTableItem doi = typ.PolygonDraworderTableItems[idx];
                    if (doi.Type > 0)
                    {
                        info.AppendLine("Level:             " + doi.Level.ToString());
                        info.AppendLine("Type     (1 Byte): " + DecimalAndHexAndBinary(doi.Type));
                        filedata.BinaryReader.Seek(firsthexadr + 1);
                        byte[] st   = filedata.BinaryReader.ReadBytes(typ.PolygoneDraworderTableBlock.Recordsize - 1);
                        uint   styp = 0;
                        for (int i = 0; i < st.Length; i++)
                        {
                            styp <<= 8;
                            styp  += st[i];
                        }
                        info.AppendLine("Subtypes (" + st.Length.ToString() + " Byte): " + HexString(st) + " / 0b" + Binary(styp));
                        for (int j = 0; j < doi.Subtypes.Count; j++)
                        {
                            info.AppendLine("Subtype:           " + DecimalAndHexAndBinary(doi.Subtypes[j]));
                        }
                    }
                }
                break;

            case NodeContent.NodeType.TYP_PolylineTableBlock:
                firsthexadr = 0x15 + 2 + 3 * 8 + 2 * 2 + 1 * 10; // Daten aus dem Header
                hexlen      = 10;
                if (idx < 0)
                {
                    info.AppendLine("PolylineTableBlock");
                    info.AppendLine("Offset:              (4 Byte):  " + DecimalAndHexAndBinary(typ.PolylineTableBlock.Offset));
                    info.AppendLine("Recordsize:          (2 Byte):  " + DecimalAndHexAndBinary(typ.PolylineTableBlock.Recordsize));
                    info.AppendLine("Length:              (4 Byte):  " + DecimalAndHexAndBinary(typ.PolylineTableBlock.Length));
                }
                break;

            case NodeContent.NodeType.TYP_PolylineTable:
                firsthexadr = typ.PolylineTableBlock.Offset;
                hexlen      = (int)typ.PolylineTableBlock.Length;
                if (idx < 0)
                {
                    info.AppendLine("PolylineTableBlock: " + typ.PolylineTableBlock.ToString());
                }
                else
                {
                    GarminCore.Files.Typ.Polyline poly = typ.GetPolyline(idx);

                    GarminCore.Files.Typ.TableItem ti = typ.PolylineTableItems[idx];
                    info.AppendLine("TableItem " + idx.ToString() + " at position " + DecimalAndHexAndBinary(typ.PolylineTableBlock.Offset + idx * typ.PolylineTableBlock.Recordsize));
                    info.AppendLine("rawtype          (2 Byte):            " + DecimalAndHexAndBinary(ti.rawtype, 16));
                    info.AppendLine("   Subtype               (Bit 0..4):  " + DecimalAndHexAndBinary(ti.Subtype, 5));
                    info.AppendLine("   Type                  (Bit 5..15): " + DecimalAndHexAndBinary(ti.Type, 11));
                    info.AppendLine("Offset           (" + (typ.PolylineTableBlock.Recordsize - 2).ToString() + " Byte):            " + DecimalAndHexAndBinary(ti.Offset));
                    info.AppendLine();

                    firsthexadr = typ.PolylineDatablock.Offset + ti.Offset;
                    hexlen      = idx < typ.PolylineCount - 1 ? typ.PolylineTableItems[idx + 1].Offset - ti.Offset :
                                  (int)typ.PolylineTableBlock.Offset - (ti.Offset + (int)typ.PolylineDatablock.Offset);

                    info.AppendLine("Polyline " + idx.ToString() + " at position " + DecimalAndHexAndBinary(firsthexadr));
                    info.AppendLine("Options          (1 Byte):            " + DecimalAndHexAndBinary(poly.Options));
                    info.AppendLine("   Polylinetype          (Bit 0..2):  " + poly.Polylinetype.ToString() + " / " + DecimalAndHexAndBinary((byte)poly.Polylinetype));
                    info.AppendLine("   BitmapHeight          (Bit 3..7):  " + DecimalAndHexAndBinary(poly.BitmapHeight));
                    info.AppendLine("Options2         (1 Byte):            " + DecimalAndHexAndBinary(poly.Options2));
                    info.AppendLine("   WithString            (Bit 0):     " + poly.WithString.ToString());
                    info.AppendLine("   WithTextRotation      (Bit 1):     " + poly.WithTextRotation.ToString());
                    info.AppendLine("   WithExtendedOptions   (Bit 2):     " + poly.WithExtendedOptions.ToString());

                    switch (poly.Polylinetype)
                    {
                    case GarminCore.Files.Typ.Polyline.PolylineType.Day2:
                        info.AppendLine("DayColor1        (3 Byte):            " + DecimalAndHex(poly.DayColor1));
                        info.AppendLine("DayColor2        (3 Byte):            " + DecimalAndHex(poly.DayColor2));
                        break;

                    case GarminCore.Files.Typ.Polyline.PolylineType.Day2_Night2:
                        info.AppendLine("DayColor1        (3 Byte):            " + DecimalAndHex(poly.DayColor1));
                        info.AppendLine("DayColor2        (3 Byte):            " + DecimalAndHex(poly.DayColor2));
                        info.AppendLine("NightColor1      (3 Byte):            " + DecimalAndHex(poly.NightColor1));
                        info.AppendLine("NightColor2      (3 Byte):            " + DecimalAndHex(poly.NightColor2));
                        break;

                    case GarminCore.Files.Typ.Polyline.PolylineType.Day1_Night2:
                        info.AppendLine("DayColor1        (3 Byte):            " + DecimalAndHex(poly.DayColor1));
                        info.AppendLine("NightColor1      (3 Byte):            " + DecimalAndHex(poly.NightColor1));
                        info.AppendLine("NightColor2      (3 Byte):            " + DecimalAndHex(poly.NightColor2));
                        break;

                    case GarminCore.Files.Typ.Polyline.PolylineType.NoBorder_Day2_Night1:
                        info.AppendLine("DayColor1        (3 Byte):            " + DecimalAndHex(poly.DayColor1));
                        info.AppendLine("DayColor2        (3 Byte):            " + DecimalAndHex(poly.DayColor2));
                        info.AppendLine("NightColor1      (3 Byte):            " + DecimalAndHex(poly.NightColor1));
                        break;

                    case GarminCore.Files.Typ.Polyline.PolylineType.NoBorder_Day1:
                        info.AppendLine("DayColor1        (3 Byte):            " + DecimalAndHex(poly.DayColor1));
                        break;

                    case GarminCore.Files.Typ.Polyline.PolylineType.NoBorder_Day1_Night1:
                        info.AppendLine("DayColor1        (3 Byte):            " + DecimalAndHex(poly.DayColor1));
                        info.AppendLine("NightColor1      (3 Byte):            " + DecimalAndHex(poly.NightColor1));
                        break;
                    }

                    if (poly.BitmapHeight == 0)
                    {
                        switch (poly.Polylinetype)
                        {
                        case GarminCore.Files.Typ.Polyline.PolylineType.Day2:
                        case GarminCore.Files.Typ.Polyline.PolylineType.Day2_Night2:
                        case GarminCore.Files.Typ.Polyline.PolylineType.Day1_Night2:
                            info.AppendLine("InnerWidth       (1 Byte):            " + DecimalAndHexAndBinary(poly.InnerWidth));
                            if (poly.InnerWidth > 0)
                            {
                                info.AppendLine("Width            (1 Byte):            " + DecimalAndHexAndBinary(2 * poly.BorderWidth + poly.InnerWidth));
                            }
                            break;

                        case GarminCore.Files.Typ.Polyline.PolylineType.NoBorder_Day2_Night1:
                        case GarminCore.Files.Typ.Polyline.PolylineType.NoBorder_Day1:
                        case GarminCore.Files.Typ.Polyline.PolylineType.NoBorder_Day1_Night1:
                            info.AppendLine("InnerWidth       (1 Byte):            " + DecimalAndHexAndBinary(poly.InnerWidth));
                            break;
                        }
                    }
                    else
                    {
                        info.AppendLine("BitmapDay        (" + DecimalAndHexAndBinary(poly.XBitmapDay.data.rawimgdata.Length) + " Byte):");
                        info.AppendLine("   " + PixMapText(poly.XBitmapDay));
                    }

                    if (poly.WithString)
                    {
                        GarminCore.Files.Typ.MultiText mt = poly.Text;
                        int len = mt.GetIdentificationLength() + mt.GetRealLength();
                        info.AppendLine("Text             (" + DecimalAndHexAndBinary(len) + " Byte):");
                        for (int i = 0; i < mt.Count; i++)
                        {
                            GarminCore.Files.Typ.Text txt = mt.Get(i);
                            info.AppendLine("   " + txt.Language.ToString() + " / " + DecimalAndHexAndBinary((byte)txt.Language) + ": '" + txt.Txt + "'");
                        }
                    }

                    if (poly.WithExtendedOptions)
                    {
                        info.AppendLine("ExtOptions       (1 Byte):            " + DecimalAndHexAndBinary(poly.ExtOptions));
                        info.AppendLine("   FontType              (Bit 0..2):  " + poly.FontType.ToString() + " / " + DecimalAndHexAndBinary((byte)poly.FontType));
                        info.AppendLine("   FontColType           (Bit 3,4):   " + poly.FontColType.ToString() + " / " + DecimalAndHexAndBinary((byte)poly.FontColType));
                        switch (poly.FontColType)
                        {
                        case GarminCore.Files.Typ.GraphicElement.FontColours.Day: // es folgt noch 1 Farbe
                            info.AppendLine("FontColor1       (3 Byte):            " + DecimalAndHex(poly.FontColor1));
                            break;

                        case GarminCore.Files.Typ.GraphicElement.FontColours.Night: // es folgt noch 1 Farbe
                            info.AppendLine("FontColor2       (3 Byte):            " + DecimalAndHex(poly.FontColor2));
                            break;

                        case GarminCore.Files.Typ.GraphicElement.FontColours.DayAndNight: // es folgen noch 2 Farben
                            info.AppendLine("FontColor1       (3 Byte):            " + DecimalAndHex(poly.FontColor1));
                            info.AppendLine("FontColor2       (3 Byte):            " + DecimalAndHex(poly.FontColor2));
                            break;
                        }
                    }
                }
                break;

            case NodeContent.NodeType.TYP_PointTableBlock:
                firsthexadr = 0x15 + 2 + 3 * 8 + 2 * 2; // Daten aus dem Header
                hexlen      = 10;
                if (idx < 0)
                {
                    info.AppendLine("PointTableBlock");
                    info.AppendLine("Offset:              (4 Byte):  " + DecimalAndHexAndBinary(typ.PointTableBlock.Offset));
                    info.AppendLine("Recordsize:          (2 Byte):  " + DecimalAndHexAndBinary(typ.PointTableBlock.Recordsize));
                    info.AppendLine("Length:              (4 Byte):  " + DecimalAndHexAndBinary(typ.PointTableBlock.Length));
                }
                break;

            case NodeContent.NodeType.TYP_PointTable:
                firsthexadr = typ.PointTableBlock.Offset;
                hexlen      = (int)typ.PointTableBlock.Length;
                if (idx < 0)
                {
                    info.AppendLine("PointTableBlock: " + typ.PointTableBlock.ToString());
                }
                else
                {
                    GarminCore.Files.Typ.POI poi = typ.GetPoi(idx);

                    GarminCore.Files.Typ.TableItem ti = typ.PointTableItems[idx];
                    info.AppendLine("TableItem " + idx.ToString() + " at position " + DecimalAndHexAndBinary(typ.PointTableBlock.Offset + idx * typ.PointTableBlock.Recordsize));
                    info.AppendLine("rawtype          (2 Byte):            " + DecimalAndHexAndBinary(ti.rawtype, 16));
                    info.AppendLine("   Subtype               (Bit 0..4):  " + DecimalAndHexAndBinary(ti.Subtype, 5));
                    info.AppendLine("   Type                  (Bit 5..15): " + DecimalAndHexAndBinary(ti.Type, 11));
                    info.AppendLine("Offset           (" + (typ.PointTableBlock.Recordsize - 2).ToString() + " Byte):            " + DecimalAndHexAndBinary(ti.Offset));
                    info.AppendLine();

                    firsthexadr = typ.PointDatablock.Offset + ti.Offset;
                    hexlen      = idx < typ.PoiCount - 1 ? typ.PointTableItems[idx + 1].Offset - ti.Offset :
                                  (int)typ.PointTableBlock.Offset - (ti.Offset + (int)typ.PointDatablock.Offset);

                    info.AppendLine("Point " + idx.ToString() + " at position " + DecimalAndHexAndBinary(firsthexadr));
                    info.AppendLine("Options          (1 Byte):            " + DecimalAndHexAndBinary(poi.Options));
                    info.AppendLine("   NightXpmHasData       (Bit 0):     " + poi.NightXpmHasData.ToString());
                    info.AppendLine("   WithNightXpm          (Bit 1):     " + poi.WithNightXpm.ToString());
                    info.AppendLine("   WithString            (Bit 2):     " + poi.WithString.ToString());
                    info.AppendLine("   WithExtendedOptions   (Bit 3):     " + poi.WithExtendedOptions.ToString());
                    info.AppendLine("Width            (1 Byte):            " + DecimalAndHexAndBinary(poi.Width));
                    info.AppendLine("Height           (1 Byte):            " + DecimalAndHexAndBinary(poi.Height));
                    info.AppendLine("ColorsDay        (1 Byte):            " + DecimalAndHexAndBinary(poi.colsday));
                    info.AppendLine("ColormodeDay     (1 Byte):            " + poi.ColormodeDay.ToString() + " / " + DecimalAndHexAndBinary((byte)poi.ColormodeDay));
                    info.AppendLine("BitmapDay        (" + DecimalAndHexAndBinary(poi.XBitmapDay.data.rawimgdata.Length) + " Byte):");
                    info.AppendLine("   " + PixMapText(poi.XBitmapDay));
                    if (poi.WithNightXpm)
                    {
                        info.AppendLine("ColorsNight      (1 Byte):            " + DecimalAndHexAndBinary(poi.colsnight));
                        info.AppendLine("ColormodeDay     (1 Byte):            " + poi.ColormodeNight.ToString() + " / " + DecimalAndHexAndBinary((byte)poi.ColormodeNight));
                        info.AppendLine("BitmapDay        (" + DecimalAndHexAndBinary(poi.XBitmapDay.data.rawimgdata.Length) + " Byte):");
                        info.AppendLine("   " + PixMapText(poi.XBitmapDay));
                        if (poi.NightXpmHasData)
                        {
                            info.AppendLine("BitmapNight      (" + DecimalAndHexAndBinary(poi.XBitmapNight.data.rawimgdata.Length) + " Byte):");
                        }
                        else
                        {
                            info.AppendLine("BitmapNight:");
                        }
                        info.AppendLine("   " + PixMapText(poi.XBitmapNight));
                    }

                    if (poi.WithString)
                    {
                        GarminCore.Files.Typ.MultiText mt = poi.Text;
                        int len = mt.GetIdentificationLength() + mt.GetRealLength();
                        info.AppendLine("Text             (" + DecimalAndHexAndBinary(len) + " Byte):");
                        for (int i = 0; i < mt.Count; i++)
                        {
                            GarminCore.Files.Typ.Text txt = mt.Get(i);
                            info.AppendLine("   " + txt.Language.ToString() + " / " + DecimalAndHexAndBinary((byte)txt.Language) + ": '" + txt.Txt + "'");
                        }
                    }

                    if (poi.WithExtendedOptions)
                    {
                        info.AppendLine("ExtOptions       (1 Byte):            " + DecimalAndHexAndBinary(poi.ExtOptions));
                        info.AppendLine("   FontType              (Bit 0..2):  " + poi.FontType.ToString() + " / " + DecimalAndHexAndBinary((byte)poi.FontType));
                        info.AppendLine("   FontColType           (Bit 3,4):   " + poi.FontColType.ToString() + " / " + DecimalAndHexAndBinary((byte)poi.FontColType));
                        switch (poi.FontColType)
                        {
                        case GarminCore.Files.Typ.GraphicElement.FontColours.Day: // es folgt noch 1 Farbe
                            info.AppendLine("FontColor1       (3 Byte):            " + DecimalAndHex(poi.FontColor1));
                            break;

                        case GarminCore.Files.Typ.GraphicElement.FontColours.Night: // es folgt noch 1 Farbe
                            info.AppendLine("FontColor2       (3 Byte):            " + DecimalAndHex(poi.FontColor2));
                            break;

                        case GarminCore.Files.Typ.GraphicElement.FontColours.DayAndNight: // es folgen noch 2 Farben
                            info.AppendLine("FontColor1       (3 Byte):            " + DecimalAndHex(poi.FontColor1));
                            info.AppendLine("FontColor2       (3 Byte):            " + DecimalAndHex(poi.FontColor2));
                            break;
                        }
                    }
                }
                break;

            case NodeContent.NodeType.TYP_NT_PointDatabtable:
                firsthexadr = typ.NT_PointTableBlock.Offset;
                hexlen      = (int)typ.NT_PointTableBlock.Length;
                info.AppendLine("NT PointTableBlock: " + typ.NT_PointTableBlock.ToString());
                break;

            case NodeContent.NodeType.TYP_NT_PointDatablock:
                firsthexadr = typ.NT_PointDatablock.Offset;
                hexlen      = (int)typ.NT_PointDatablock.Length;
                info.AppendLine("NT PointDatablock: " + typ.NT_PointDatablock.ToString());
                break;

            case NodeContent.NodeType.TYP_NT_PointLabelblock:
                firsthexadr = typ.NT_PointLabelblock.Offset;
                hexlen      = (int)typ.NT_PointLabelblock.Length;
                info.AppendLine("NT PointLabelblock: " + typ.NT_PointLabelblock.ToString());
                break;

            case NodeContent.NodeType.TYP_NT_LabelblockTable1:
                firsthexadr = typ.NT_LabelblockTable1.Offset;
                hexlen      = (int)typ.NT_LabelblockTable1.Length;
                info.AppendLine("NT LabelblockTable1: " + typ.NT_LabelblockTable1.ToString());
                break;

            case NodeContent.NodeType.TYP_NT_LabelblockTable2:
                firsthexadr = typ.NT_LabelblockTable2.Offset;
                hexlen      = (int)typ.NT_LabelblockTable2.Length;
                info.AppendLine("NT LabelblockTable2: " + typ.NT_LabelblockTable2.ToString());
                break;

            //case NodeContent.NodeType.TRE_CopyrightBlock:
            //   firsthexadr = tre.CopyrightBlock.Offset;
            //   if (idx < 0) {
            //      info.AppendLine("Copyrights: " + tre.CopyrightOffsetsList.Count.ToString());
            //      info.AppendLine("  Block:    " + tre.CopyrightBlock.ToString());
            //      hexlen = (int)tre.CopyrightBlock.Length;
            //   } else {
            //      info.AppendLine("Offset in LBL (" + tre.CopyrightBlock.Recordsize.ToString() + " Byte): " + DecimalAndHexAndBinary(tre.CopyrightOffsetsList[idx]));
            //      lbl = tvd.GetLBL(filedata.Basename);
            //      if (lbl != null)
            //         info.AppendLine("   Text (from LBL): '" + lbl.GetText(tre.CopyrightOffsetsList[idx], true) + "'");
            //      firsthexadr += idx * tre.CopyrightBlock.Recordsize;
            //      hexlen = tre.CopyrightBlock.Recordsize;
            //   }
            //   break;

            //case NodeContent.NodeType.TRE_UnknownBlock_xBC:
            //   if (idx < 0) {
            //      info.AppendLine("UnknownBlock 0xBC: " + tre.UnknownBlock_xBC.ToString());
            //      firsthexadr = tre.UnknownBlock_xAE.Offset;
            //      hexlen = (int)tre.UnknownBlock_xAE.Length;
            //   } else {
            //   }
            //   break;

            default:
                info.AppendLine("internal error: no info for nodetype '" + nodetype.ToString() + "'");
                break;
            }

            if (hexlen > 0)
            {
                hex = HexRange(firsthexadr, filedata.BinaryReader, hexlen);
            }
        }
예제 #9
0
        /// <summary>
        /// Funktion für alle NET-Datei-Infos
        /// </summary>
        /// <param name="info"></param>
        /// <param name="hex"></param>
        /// <param name="firsthexadr"></param>
        /// <param name="filedata"></param>
        /// <param name="nodetype"></param>
        /// <param name="idx"></param>
        /// <param name="tvd"></param>
        public static void SectionAndIndex(StringBuilder info, out byte[] hex, out long firsthexadr, NodeContent.Content4File filedata, NodeContent.NodeType nodetype, int idx, TreeViewData tvd)
        {
            GarminCore.Files.StdFile_NET net = filedata.GetGarminFileAsNET(tvd.GetLBL(filedata.Basename));
            int hexlen = 0;

            firsthexadr = 0;
            hex         = null;
            int tab = 20;

            switch (nodetype)
            {
            case NodeContent.NodeType.RGN_PostHeaderData:
                firsthexadr = net.PostHeaderDataBlock.Offset;
                if (idx < 0)
                {
                    info.AppendLine("PostHeaderDataBlock: " + net.PostHeaderDataBlock.ToString());
                    hexlen = (int)net.PostHeaderDataBlock.Length;
                }
                break;

            case NodeContent.NodeType.NET_RoadDefinitionsBlock:
                firsthexadr = net.RoadDefinitionsBlock.Offset;
                if (idx < 0)
                {
                    tab = 15;
                    info.AppendLine("RoadDefinitionsBlock");
                    info.AppendLine(FillWithSpace("  Block", tab, false, net.RoadDefinitionsBlock.ToString()));
                    info.AppendLine(FillWithSpace("  Roads", tab, false, net.Roaddata.Count.ToString()));
                    hexlen = (int)net.RoadDefinitionsBlock.Length;
                }
                else    // einzelnes Element
                {
                    if ((idx & NET_IDX_ROAD) != 0)
                    {
                        idx &= NET_IDX_MASK;
                        tab  = 25;

                        GarminCore.Files.StdFile_NET.RoadData rd = net.Roaddata[idx];

                        //info.AppendLine(rd.ToString());
                        string labels = rd.LabelInfo.Count.ToString();
                        if (rd.LabelInfo.Count > 0)
                        {
                            labels += " -> ";
                            for (int i = 0; i < rd.LabelInfo.Count; i++)
                            {
                                if (i > 0)
                                {
                                    labels += ", ";
                                }
                                labels += DecimalAndHexAndBinary(rd.LabelInfo[i]);
                            }
                        }
                        info.AppendLine(FillWithSpace("Labels", tab, false, labels));
                        for (int i = 0; i < rd.LabelInfo.Count; i++)
                        {
                            info.AppendLine(FillWithSpace("   Label (LBL)" + i.ToString(), tab, true, rd.GetText(net.Lbl, i, false)));
                        }

                        info.AppendLine(FillWithSpace("Roaddatainfos", tab, false, rd.Roaddatainfos.ToString()));
                        info.AppendLine(FillWithSpace("RoadLength", tab, false, rd.RoadLength.ToString() + "m"));

                        info.AppendLine(FillWithSpace("RgnIndexOverviews", tab, false, rd.RgnIndexOverview.Count.ToString()));
                        for (int i = 0, j = 0; i < rd.RgnIndexOverview.Count; i++)
                        {
                            info.Append(FillWithSpace("   RgnIndexOverview " + i.ToString(), tab, false, rd.RgnIndexOverview[i].ToString()));
                            if (rd.RgnIndexOverview[i] > 0)
                            {
                                info.Append(" -> ");
                                for (int k = 0; k < rd.RgnIndexOverview[i]; k++)
                                {
                                    info.Append(" " + rd.Indexdata[j++].ToString());
                                }
                            }
                            info.AppendLine();
                        }
                        info.AppendLine(FillWithSpace("SegmentedRoadOffsets", tab, false, rd.SegmentedRoadOffsets.Count.ToString()));
                        for (int i = 0; i < rd.SegmentedRoadOffsets.Count; i++)
                        {
                            info.AppendLine(FillWithSpace("   SegmentedRoadOffsets " + i.ToString(), tab, false, DecimalAndHexAndBinary(rd.SegmentedRoadOffsets[i])));
                        }

                        if (rd.HasRoadDataInfo(GarminCore.Files.StdFile_NET.RoadData.RoadDataInfo.has_street_address_info))
                        {
                            // Bit 0..9 'NodeCount', Bits 10,11 für Zip; Bits 12,13 für City; Bits 14,15 für Nummbers
                            info.AppendLine(FillWithSpace("NodeCountAndFlags", tab, false, DecimalAndHexAndBinary(rd.NodeCountAndFlags, 16)));
                            info.AppendLine(FillWithSpace("   NodeCount", tab, false, rd.NodeCount.ToString()));
                            info.AppendLine(FillWithSpace("   ZipFlag", tab, false, DecimalAndHexAndBinary(rd.ZipFlag)));
                            for (int side = 0; side < rd.ZipIndex4Node.Count; side++)
                            {
                                if (rd.ZipIndex4Node[side].Count > 0)
                                {
                                    info.AppendLine(FillWithSpace(side == 0 ?
                                                                  "      Left (LBL)" :
                                                                  "      Right (LBL)", tab, true,
                                                                  rd.GetZipText(net.Lbl,
                                                                                side == 0 ?
                                                                                GarminCore.Files.StdFile_NET.RoadData.Side.Left :
                                                                                GarminCore.Files.StdFile_NET.RoadData.Side.Right,
                                                                                false)));
                                }
                            }
                            info.AppendLine(FillWithSpace("   CityFlag", tab, false, DecimalAndHexAndBinary(rd.CityFlag)));
                            for (int side = 0; side < rd.CityIndex4Node.Count; side++)
                            {
                                if (rd.CityIndex4Node[side].Count > 0)
                                {
                                    info.AppendLine(FillWithSpace(side == 0 ?
                                                                  "      Left (LBL)" :
                                                                  "      Right (LBL)", tab, true,
                                                                  rd.GetCityText(net.Lbl,
                                                                                 tvd.GetRGN(filedata.Basename),
                                                                                 side == 0 ?
                                                                                 GarminCore.Files.StdFile_NET.RoadData.Side.Left :
                                                                                 GarminCore.Files.StdFile_NET.RoadData.Side.Right,
                                                                                 false)));
                                }
                            }

                            string bin = "";
                            for (int i = 0; i < rd.NumberStream.Length; i++)
                            {
                                bin += Binary(rd.NumberStream[i]);
                            }

                            bin = Binary(rd.NumberStream);
                            info.AppendLine(FillWithSpace("   NumberFlag, -stream", tab, false, DecimalAndHexAndBinary(rd.NumberFlag) + "   " + HexString(rd.NumberStream) + "   " + bin));
                            if (rd.NumberStream.Length > 0)
                            {
                                GarminCore.Files.StdFile_NET.RoadData.Housenumbers numbers = new GarminCore.Files.StdFile_NET.RoadData.Housenumbers(rd.NumberStream);
                                for (int n = 0; n < numbers.Numbers.Count; n++)
                                {
                                    info.AppendLine(new string(' ', tab + 3) + numbers.Numbers[n].ToString() + " (raw: " + numbers.Numbers[n].rawdata.ToString() + ")");
                                }
                            }
                        }



                        if (rd.HasRoadDataInfo(GarminCore.Files.StdFile_NET.RoadData.RoadDataInfo.has_nod_info))
                        {
                            info.AppendLine(FillWithSpace("NODFlag", tab, false, rd.NODFlag.ToString()));
                            info.AppendLine(FillWithSpace("NOD_Offset", tab, false, DecimalAndHexAndBinary(rd.NOD_Offset)));
                        }

                        // für die Hex-Anzeige
                        firsthexadr = net.RoadDefinitionsBlock.Offset;
                        for (int i = 0; i < idx; i++)
                        {
                            firsthexadr += net.Roaddata[i].RawBytes;
                        }
                        hexlen = (int)net.Roaddata[idx].RawBytes;
                    }
                }
                break;

            case NodeContent.NodeType.NET_SegmentedRoadsBlock:
                firsthexadr = net.RoadDefinitionsBlock.Offset;
                if (idx < 0)
                {
                    tab = 15;
                    info.AppendLine("SegmentedRoadsBlock");
                    info.AppendLine(FillWithSpace("  Block", tab, false, net.SegmentedRoadsBlock.ToString()));
                    hexlen = (int)net.SegmentedRoadsBlock.Length;
                }
                else    // einzelnes Element



                {
                }
                break;

            case NodeContent.NodeType.NET_SortedRoadsBlock:
                firsthexadr = net.RoadDefinitionsBlock.Offset;
                if (idx < 0)
                {
                    tab = 15;
                    info.AppendLine("SortedRoadsBlock");
                    info.AppendLine(FillWithSpace("  Block", tab, false, net.SortedRoadsBlock.ToString()));
                    info.AppendLine(FillWithSpace("  Offsets", tab, false, net.SortedOffsets.Count.ToString()));
                    hexlen = (int)net.SortedRoadsBlock.Length;

                    List <uint> t1 = new List <uint>(net.SortedOffsets);
                    t1.Sort();
                }
                else    // einzelnes Element
                {
                    tab = 20;
                    if ((idx & NET_IDX_SORTEDOFFSET) != 0)
                    {
                        idx &= NET_IDX_MASK;
                        info.AppendLine(FillWithSpace("Offset", tab, false, DecimalAndHexAndBinary(net.SortedOffsets[idx])));
                        int offs = (int)net.SortedOffsets[idx];
                        for (int i = 0; i < net.Roaddata.Count; i++)
                        {
                            offs -= net.Roaddata[i].RawBytes;
                            if (offs == 0)
                            {
                                info.AppendLine(FillWithSpace("Roaddata-Index", tab, false, i.ToString()));
                                break;
                            }
                            else if (offs < 0)
                            {
                                info.AppendLine("Roaddata-Index not found -> error ?");
                                break;
                            }
                        }
                    }
                }
                break;



            default:
                info.AppendLine("internal error: no info for nodetype '" + nodetype.ToString() + "'");
                break;
            }

            if (hexlen > 0)
            {
                hex = HexRange(firsthexadr, filedata.BinaryReader, hexlen);
            }
        }
예제 #10
0
        /// <summary>
        /// Funktion für alle Datei-Infos
        /// </summary>
        /// <param name="info"></param>
        /// <param name="hex"></param>
        /// <param name="firsthexadr"></param>
        /// <param name="filedata"></param>
        /// <param name="nodetype">"Thema" der Info</param>
        /// <param name="idx">wenn größer oder gleich 0, dann der Index auf ein Objekt einer Tabelle</param>
        /// <param name="tn"></param>
        public static void SectionAndIndex(StringBuilder info, out byte[] hex, out long firsthexadr, NodeContent.Content4File filedata, NodeContent.NodeType nodetype, int idx, TreeViewData tvd)
        {
            GarminCore.Files.StdFile_MDR mdr = filedata.GetGarminFileAsMDR();
            int hexlen = 0;

            firsthexadr = 0;
            hex         = null;

            switch (nodetype)
            {
            case NodeContent.NodeType.MDR_MDR1:
                firsthexadr = mdr.Mdr1.Offset;
                hexlen      = (int)mdr.Mdr1.Length;
                info.AppendLine("Mdr1: " + mdr.Mdr1.ToString());
                break;

            case NodeContent.NodeType.MDR_MDR2:
                firsthexadr = mdr.Mdr2.Offset;
                hexlen      = (int)mdr.Mdr2.Length;
                info.AppendLine("Mdr2: " + mdr.Mdr2.ToString());
                break;

            case NodeContent.NodeType.MDR_MDR3:
                firsthexadr = mdr.Mdr3.Offset;
                hexlen      = (int)mdr.Mdr3.Length;
                info.AppendLine("Mdr3: " + mdr.Mdr3.ToString());
                break;

            case NodeContent.NodeType.MDR_MDR4:
                firsthexadr = mdr.Mdr4.Offset;
                hexlen      = (int)mdr.Mdr4.Length;
                info.AppendLine("Mdr4: " + mdr.Mdr4.ToString());
                break;

            case NodeContent.NodeType.MDR_MDR5:
                firsthexadr = mdr.Mdr5.Offset;
                hexlen      = (int)mdr.Mdr5.Length;
                info.AppendLine("Mdr5: " + mdr.Mdr5.ToString());
                break;

            case NodeContent.NodeType.MDR_MDR6:
                firsthexadr = mdr.Mdr6.Offset;
                hexlen      = (int)mdr.Mdr6.Length;
                info.AppendLine("Mdr6: " + mdr.Mdr6.ToString());
                break;

            case NodeContent.NodeType.MDR_MDR7:
                firsthexadr = mdr.Mdr7.Offset;
                hexlen      = (int)mdr.Mdr7.Length;
                info.AppendLine("Mdr7: " + mdr.Mdr7.ToString());
                break;

            case NodeContent.NodeType.MDR_MDR8:
                firsthexadr = mdr.Mdr8.Offset;
                hexlen      = (int)mdr.Mdr8.Length;
                info.AppendLine("Mdr8: " + mdr.Mdr8.ToString());
                break;

            case NodeContent.NodeType.MDR_MDR9:
                firsthexadr = mdr.Mdr9.Offset;
                hexlen      = (int)mdr.Mdr9.Length;
                info.AppendLine("Mdr9: " + mdr.Mdr9.ToString());
                break;

            case NodeContent.NodeType.MDR_MDR10:
                firsthexadr = mdr.Mdr10.Offset;
                hexlen      = (int)mdr.Mdr10.Length;
                info.AppendLine("Mdr10: " + mdr.Mdr10.ToString());
                break;

            case NodeContent.NodeType.MDR_MDR11:
                firsthexadr = mdr.Mdr11.Offset;
                hexlen      = (int)mdr.Mdr11.Length;
                info.AppendLine("Mdr11: " + mdr.Mdr11.ToString());
                break;

            case NodeContent.NodeType.MDR_MDR12:
                firsthexadr = mdr.Mdr12.Offset;
                hexlen      = (int)mdr.Mdr12.Length;
                info.AppendLine("Mdr12: " + mdr.Mdr12.ToString());
                break;

            case NodeContent.NodeType.MDR_MDR13:
                firsthexadr = mdr.Mdr13.Offset;
                hexlen      = (int)mdr.Mdr13.Length;
                info.AppendLine("Mdr13: " + mdr.Mdr13.ToString());
                break;

            case NodeContent.NodeType.MDR_MDR14:
                firsthexadr = mdr.Mdr14.Offset;
                hexlen      = (int)mdr.Mdr14.Length;
                info.AppendLine("Mdr14: " + mdr.Mdr14.ToString());
                break;

            case NodeContent.NodeType.MDR_MDR15:
                firsthexadr = mdr.Mdr15.Offset;
                hexlen      = (int)mdr.Mdr15.Length;
                info.AppendLine("Mdr15: " + mdr.Mdr15.ToString());
                break;

            case NodeContent.NodeType.MDR_MDR16:
                firsthexadr = mdr.Mdr16.Offset;
                hexlen      = (int)mdr.Mdr16.Length;
                info.AppendLine("Mdr16: " + mdr.Mdr16.ToString());
                break;

            case NodeContent.NodeType.MDR_MDR17:
                firsthexadr = mdr.Mdr17.Offset;
                hexlen      = (int)mdr.Mdr17.Length;
                info.AppendLine("Mdr17: " + mdr.Mdr17.ToString());
                break;

            case NodeContent.NodeType.MDR_MDR18:
                firsthexadr = mdr.Mdr18.Offset;
                hexlen      = (int)mdr.Mdr18.Length;
                info.AppendLine("Mdr18: " + mdr.Mdr18.ToString());
                break;



            default:
                info.AppendLine("internal error: no info for nodetype '" + nodetype.ToString() + "'");
                break;
            }

            if (hexlen > 0)
            {
                hex = HexRange(firsthexadr, filedata.BinaryReader, hexlen);
            }
        }
예제 #11
0
        /// <summary>
        /// Daten für den akt. Node anzeigen
        /// <para>aus dem akt. und ev. den darüber liegenden Nodes wird bestimmt, welche Daten anzuzeigen sind</para>
        /// </summary>
        /// <param name="tn"></param>
        /// <param name="tpd"></param>
        void ShowData4Node(TreeNode tn, TabPageData tpd)
        {
            byte[] hex         = null;
            long   firsthexadr = 0;

            tpd.Hexwin.ClearContent();
            tpd.Info.Clear();
            StringBuilder info = new StringBuilder();

            NodeContent  nc  = Data.NodeContent4TreeNode(tn);
            TreeViewData tvd = TreeViewData.GetTreeViewData(tn);

            switch (nc.Type)
            {
            case NodeContent.NodeType.PhysicalFile:
                if (nc.Data is NodeContent.Content4PhysicalFile)
                {
                    Data.RegisterCoreFiles(tvd, (nc.Data as NodeContent.Content4PhysicalFile).Filename);
                    Data.ShowData4Node_PhysicalFile(info, out hex, out firsthexadr, nc.Data as NodeContent.Content4PhysicalFile, tvd);
                }
                break;

            case NodeContent.NodeType.SimpleFilesystem:
                nc = Data.NodeContent4TreeNode(tn.Parent); // es muss eine physische Datei übergeordnet sein
                if (nc.Data is NodeContent.Content4PhysicalFile)
                {
                    DataSimpleFilesystem.ShowData(info, out hex, out firsthexadr, nc.Data as NodeContent.Content4PhysicalFile, tvd);
                }
                break;

            case NodeContent.NodeType.LogicalFile:
                if (nc.Data is NodeContent.Content4LogicalFile)
                {
                    Data.RegisterCoreFiles(tvd, (nc.Data as NodeContent.Content4LogicalFile).Filename);
                    Data.ShowData4Node_LogicalFile(info, out hex, out firsthexadr, nc.Data as NodeContent.Content4LogicalFile, tvd);
                }
                break;

            case NodeContent.NodeType.GarminCommonHeader:
                nc = Data.NodeContent4TreeNode(tn.Parent); // es muss eine physische oder logische Datei übergeordnet sein
                if (nc.Data is NodeContent.Content4File)
                {
                    Data.ShowData4Node_GarminCommonHeader(info, out hex, out firsthexadr, nc.Data as NodeContent.Content4File, tvd);
                }
                break;

            case NodeContent.NodeType.GarminSpecialHeader:
                nc = Data.NodeContent4TreeNode(tn.Parent); // es muss eine physische oder logische Datei übergeordnet sein
                if (nc.Data is NodeContent.Content4File)
                {
                    Data.ShowData4Node_GarminSpecialHeader(info, out hex, out firsthexadr, nc.Data as NodeContent.Content4File, tvd);
                }
                break;

            case NodeContent.NodeType.Index:
                if (tn.Parent != null)
                {
                    Data.ShowData4Node_GarminStdFile(info, out hex, out firsthexadr, Data.GetNextContent4File(tn), Data.NodeContent4TreeNode(tn.Parent).Type, (int)nc.Data, tvd);
                }
                break;

            case NodeContent.NodeType.DataRange:
                NodeContent.Content4DataRange c4dr = nc.Data as NodeContent.Content4DataRange;
                info.AppendLine(c4dr.Info);
                hex         = c4dr.Bytes;
                firsthexadr = c4dr.FirstAdr;
                break;

            default:
                NodeContent.Content4File c4f = Data.GetNextContent4File(tn);
                Data.RegisterCoreFiles(tvd, c4f.Filename);
                Data.ShowData4Node_GarminStdFile(info, out hex, out firsthexadr, c4f, nc.Type, -1, tvd);
                break;
            }

            tpd.Info.AppendText(info.ToString());
            tpd.Info.Select(0, 0);
            tpd.Info.ScrollToCaret();

            if (hex != null)
            {
                tpd.Hexwin.SetContent(hex, (ulong)firsthexadr);
            }
        }
예제 #12
0
        /// <summary>
        /// Funktion für alle Datei-Infos
        /// </summary>
        /// <param name="info"></param>
        /// <param name="hex"></param>
        /// <param name="firsthexadr"></param>
        /// <param name="filedata"></param>
        /// <param name="nodetype">"Thema" der Info</param>
        /// <param name="idx">wenn größer oder gleich 0, dann der Index auf ein Objekt einer Tabelle</param>
        /// <param name="tn"></param>
        public static void SectionAndIndex(StringBuilder info, out byte[] hex, out long firsthexadr, NodeContent.Content4File filedata, NodeContent.NodeType nodetype, int idx, TreeViewData tvd)
        {
            GarminCore.Files.StdFile_DEM dem = filedata.GetGarminFileAsDEM();
            int hexlen = 0;

            firsthexadr = 0;
            hex         = null;

            switch (nodetype)
            {
            case NodeContent.NodeType.DEM_Zoomlevel:
                firsthexadr = dem.PtrZoomlevel;
                if (idx < 0)
                {
                    info.AppendLine("ZoomlevelCount:       " + DecimalAndHexAndBinary(dem.ZoomlevelCount));
                    info.AppendLine("ZoomlevelRecordSize:  " + DecimalAndHexAndBinary(dem.ZoomlevelRecordSize));
                    hexlen = dem.ZoomlevelRecordSize * dem.ZoomlevelCount;
                }
                else
                {
                    GarminCore.Files.DEM.ZoomlevelTableitem record = dem.ZoomLevel[idx].ZoomlevelItem;

                    info.AppendLine("SpecType                (1 Byte): " + DecimalAndHexAndBinary(record.SpecType));
                    info.AppendLine("Number                  (1 Byte): " + DecimalAndHexAndBinary(record.No));
                    info.AppendLine("Tilesize horizontal     (4 Byte): " + DecimalAndHexAndBinary(record.PointsHoriz));
                    info.AppendLine("Tilesize vertical       (4 Byte): " + DecimalAndHexAndBinary(record.PointsVert));
                    info.AppendLine("LastRowHeight           (4 Byte): " + DecimalAndHexAndBinary(record.LastRowHeight));
                    info.AppendLine("LastColWidth            (4 Byte): " + DecimalAndHexAndBinary(record.LastColWidth));
                    info.AppendLine("Unknown12               (2 Byte): " + DecimalAndHexAndBinary(record.Unknown12));
                    info.AppendLine("MaxIdxHoriz             (4 Byte): " + DecimalAndHexAndBinary(record.MaxIdxHoriz));
                    info.AppendLine("MaxIdxVert              (4 Byte): " + DecimalAndHexAndBinary(record.MaxIdxVert));
                    info.AppendLine("Structure               (2 Byte): " + DecimalAndHexAndBinary(record.Structure, 16));
                    info.AppendLine("   OffsetSize              (Bit 0,1) +1: " + record.Structure_OffsetSize + " Byte");
                    info.AppendLine("   BaseheightSize          (Bit 2) +1:   " + record.Structure_BaseheightSize + " Byte");
                    info.AppendLine("   DiffSize                (Bit 3) +1:   " + record.Structure_DiffSize + " Byte");
                    info.AppendLine("   CodingtypeSize          (Bit 4):      " + record.Structure_CodingtypeSize + " Byte");
                    info.AppendLine("SubtileTableitemSize    (2 Byte): " + DecimalAndHexAndBinary(record.SubtileTableitemSize));
                    info.AppendLine("SubtileTableOffset      (4 Byte): " + DecimalAndHexAndBinary(record.PtrSubtileTable));
                    info.AppendLine("HeightdataOffset        (4 Byte): " + DecimalAndHexAndBinary(record.PtrHeightdata));
                    info.AppendLine("Left                    (4 Byte): " + DecimalAndHexAndBinary(record.west) + "; " + record.West.ToString() + "°");
                    info.AppendLine("Top                     (4 Byte): " + DecimalAndHexAndBinary(record.north) + "; " + record.North.ToString() + "°");
                    info.AppendLine("PointDistanceVertical   (4 Byte): " + DecimalAndHexAndBinary(record.pointDistanceVert) + "; " + record.PointDistanceVert.ToString() + "°");
                    info.AppendLine("PointDistanceHorizontal (4 Byte): " + DecimalAndHexAndBinary(record.pointDistanceHoriz) + "; " + record.PointDistanceHoriz.ToString() + "°");
                    info.AppendLine("MinHeight               (2 Byte): " + DecimalAndHexAndBinary(record.MinHeight));
                    info.AppendLine("MaxHeight               (2 Byte): " + DecimalAndHexAndBinary(record.MaxHeight));

                    firsthexadr += idx * dem.ZoomlevelRecordSize;
                    hexlen       = dem.ZoomlevelRecordSize;
                }
                break;

            case NodeContent.NodeType.Index:
                // etwas tricky, aber nc.Data des übergeordneten Knotens ist der ZoomLevel-Index
                if (tvd.TreeView.SelectedNode != null)
                {
                    int         zoomlevelidxidx = -1;
                    NodeContent nc = NodeContent4TreeNode(tvd.TreeView.SelectedNode.Parent);
                    if (nc.Type == NodeContent.NodeType.Index)
                    {
                        zoomlevelidxidx = (int)nc.Data;
                    }
                    if (zoomlevelidxidx >= 0)
                    {
                        GarminCore.Files.DEM.ZoomlevelTableitem zoomlevel = dem.ZoomLevel[zoomlevelidxidx].ZoomlevelItem;
                        GarminCore.Files.DEM.SubtileTableitem   subtile   = dem.ZoomLevel[zoomlevelidxidx].Subtiles[idx].Tableitem;
                        info.AppendLine("Offset     (" + zoomlevel.Structure_OffsetSize + " Byte): " + DecimalAndHexAndBinary(subtile.Offset));
                        info.AppendLine("Baseheight (" + zoomlevel.Structure_BaseheightSize + " Byte): " + DecimalAndHexAndBinary(subtile.Baseheight));
                        info.AppendLine("Diff       (" + zoomlevel.Structure_DiffSize + " Byte): " + DecimalAndHexAndBinary(subtile.Diff));
                        if (zoomlevel.Structure_CodingtypeSize > 0)
                        {
                            info.AppendLine("Type       (" + zoomlevel.Structure_CodingtypeSize + " Byte): " + DecimalAndHexAndBinary(subtile.Type));
                        }
                        info.AppendLine();
                        info.AppendLine("coded data (" + DecimalAndHexAndBinary(dem.ZoomLevel[zoomlevelidxidx].Subtiles[idx].DataLength) + " Bytes):");

                        firsthexadr = zoomlevel.PtrHeightdata + subtile.Offset;
                        hexlen      = dem.ZoomLevel[zoomlevelidxidx].Subtiles[idx].DataLength;
                    }
                }
                break;

            default:
                info.AppendLine("internal error: no info for nodetype '" + nodetype.ToString() + "'");
                break;
            }

            if (hexlen > 0)
            {
                hex = HexRange(firsthexadr, filedata.BinaryReader, hexlen);
            }
        }
예제 #13
0
        /// <summary>
        /// Funktion für alle Datei-Infos
        /// </summary>
        /// <param name="info"></param>
        /// <param name="hex"></param>
        /// <param name="firsthexadr"></param>
        /// <param name="filedata"></param>
        /// <param name="nodetype">"Thema" der Info</param>
        /// <param name="idx">wenn größer oder gleich 0, dann der Index auf ein Objekt einer Tabelle</param>
        /// <param name="tn"></param>
        public static void SectionAndIndex(StringBuilder info, out byte[] hex, out long firsthexadr, NodeContent.Content4File filedata, NodeContent.NodeType nodetype, int idx, TreeViewData tvd)
        {
            GarminCore.Files.StdFile_SRT srt = filedata.GetGarminFileAsSRT();
            int hexlen = 0;

            firsthexadr = 0;
            hex         = null;

            switch (nodetype)
            {
            case NodeContent.NodeType.SRT_ContentsBlock:
                firsthexadr = srt.ContentsBlock.Offset;
                hexlen      = srt.ContentsBlock.Length;
                info.AppendLine("ContentsBlock:                (6 Byte): " + srt.ContentsBlock.ToString());
                info.AppendLine("   DescriptionBlock:                    " + srt.DescriptionBlock.ToString());
                info.AppendLine("   CharacterLookupTableBlock:           " + srt.CharacterLookupTableBlock.ToString());
                break;

            case NodeContent.NodeType.SRT_DescriptionBlock:
                firsthexadr = srt.DescriptionBlock.Offset;
                hexlen      = (int)srt.DescriptionBlock.Length;
                info.AppendLine("Description: (" + srt.DescriptionBlock.Length.ToString() + " Byte): '" + srt.Description + "'");
                break;

            case NodeContent.NodeType.SRT_CharacterLookupTableBlock:
                firsthexadr = srt.CharacterLookupTableBlock.Offset;
                hexlen      = (int)srt.CharacterLookupTableBlock.Length;
                info.AppendLine("Headerlength    (2 Byte): " + DecimalAndHexAndBinary(srt.Sortheader.Headerlength));
                info.AppendLine("Id1             (2 Byte): " + DecimalAndHexAndBinary(srt.Sortheader.Id1));
                info.AppendLine("Id2             (2 Byte): " + DecimalAndHexAndBinary(srt.Sortheader.Id2));
                info.AppendLine("Codepage        (2 Byte): " + DecimalAndHexAndBinary(srt.Sortheader.Codepage));
                info.AppendLine("Unknown1        (" + srt.Sortheader.Unknown1.Length.ToString() + " Byte): " + HexString(srt.Sortheader.Unknown1));
                info.AppendLine("Unknown2        (" + srt.Sortheader.Unknown2.Length.ToString() + " Byte): " + HexString(srt.Sortheader.Unknown2));
                info.AppendLine("CharTabBlock    (10 Byte): " + srt.Sortheader.CharTabBlock.ToString());
                info.AppendLine("Unknown3        (" + srt.Sortheader.Unknown3.Length.ToString() + " Byte): " + HexString(srt.Sortheader.Unknown3));
                info.AppendLine("ExpansionsBlock (10 Byte): " + srt.Sortheader.ExpansionsBlock.ToString());
                info.AppendLine("Unknown4        (" + srt.Sortheader.Unknown4.Length.ToString() + " Byte): " + HexString(srt.Sortheader.Unknown4));
                info.AppendLine("CharTabOffset   (4 Byte): " + DecimalAndHexAndBinary(srt.Sortheader.CharTabOffset));
                info.AppendLine("Unknown5        (" + srt.Sortheader.Unknown5.Length.ToString() + " Byte): " + HexString(srt.Sortheader.Unknown5));
                info.AppendLine("Unknown6        (" + srt.Sortheader.Unknown6.Length.ToString() + " Byte): " + HexString(srt.Sortheader.Unknown6));
                break;

            case NodeContent.NodeType.SRT_CharTabBlock:
                firsthexadr = srt.Sortheader.CharTabBlock.Offset;
                hexlen      = (int)srt.Sortheader.CharTabBlock.Length;
                if (idx < 0)
                {
                    info.AppendLine("Count: " + (srt.Sortheader.CharTabBlock.Length / srt.Sortheader.CharTabBlock.Recordsize).ToString());
                }
                else
                {
                    hexlen      = srt.Sortheader.CharTabBlock.Recordsize;
                    firsthexadr = srt.Sortheader.CharTabBlock.Offset + idx * hexlen;
                }
                break;

            case NodeContent.NodeType.SRT_ExpansionsBlock:
                firsthexadr = srt.Sortheader.ExpansionsBlock.Offset;
                hexlen      = (int)srt.Sortheader.ExpansionsBlock.Length;
                if (idx < 0)
                {
                    info.AppendLine("Count: " + (srt.Sortheader.ExpansionsBlock.Length / srt.Sortheader.ExpansionsBlock.Recordsize).ToString());
                }
                else
                {
                    hexlen      = srt.Sortheader.ExpansionsBlock.Recordsize;
                    firsthexadr = srt.Sortheader.ExpansionsBlock.Offset + idx * hexlen;
                }
                break;

            default:
                info.AppendLine("internal error: no info for nodetype '" + nodetype.ToString() + "'");
                break;
            }

            if (hexlen > 0)
            {
                hex = HexRange(firsthexadr, filedata.BinaryReader, hexlen);
            }
        }