Exemple #1
0
        public override void Write(BinaryReaderWriter bw, uint headeroffset = 0, UInt16 headerlength = 0x5B, uint gapoffset = 0, uint dataoffset = 0, bool setsectiondata = true)
        {
            HeaderOffset = headeroffset;
            if (headerlength > 0)
            {
                Headerlength = headerlength;
            }

            CreationDate = DateTime.Now;

            GapOffset  = gapoffset;
            DataOffset = dataoffset;

            bw.SetEncoding(Codepage);
            bw.Seek(Headerlength);

            Encode_PolygoneData(bw);
            Encode_PolylineData(bw);
            Encode_POIData(bw);
            Encode_Draworder(bw);

            SetSectionsAlign();

            Encode_Header(bw); // Header mit den akt. Offsets neu erzeugen

            Filesections.WriteSections(bw);
        }
Exemple #2
0
        protected override void DecodeSections()
        {
            RawRead = true; // besser geht es noch nicht

            if (Locked != 0)
            {
                RawRead = true;
                return;
            }

            // Datenblöcke "interpretieren"
            int filesectiontype;

            filesectiontype = (int)InternalFileSections.Mdr1;
            if (Filesections.GetLength(filesectiontype) > 0)
            {
                DataBlockWithRecordsize bl = new DataBlockWithRecordsize(Filesections.GetPosition(filesectiontype));
                bl.Offset = 0;
                //Decode_Mdr1(Filesections.GetSectionDataReader(filesectiontype), bl);
                //Filesections.RemoveSection(filesectiontype);
            }

            // usw.

            filesectiontype = (int)InternalFileSections.Mdr10;
            if (Filesections.GetLength(filesectiontype) > 0)
            {
                //Decode_Mdr10(Filesections.GetSectionDataReader(filesectiontype), new DataBlock(0, Filesections.GetLength(filesectiontype)));
                //Filesections.RemoveSection(filesectiontype);
            }

            // usw.
        }
Exemple #3
0
        protected override void ReadSections(BinaryReaderWriter br)
        {
            // --------- Dateiabschnitte für die Rohdaten bilden ---------
            Filesections.AddSection((int)InternalFileSections.Mdr1, new DataBlockWithRecordsize(Mdr1));
            Filesections.AddSection((int)InternalFileSections.Mdr2, new DataBlockWithRecordsize(Mdr2));
            Filesections.AddSection((int)InternalFileSections.Mdr3, new DataBlockWithRecordsize(Mdr3));
            Filesections.AddSection((int)InternalFileSections.Mdr4, new DataBlockWithRecordsize(Mdr4));
            Filesections.AddSection((int)InternalFileSections.Mdr5, new DataBlockWithRecordsize(Mdr5));
            Filesections.AddSection((int)InternalFileSections.Mdr6, new DataBlockWithRecordsize(Mdr6));
            Filesections.AddSection((int)InternalFileSections.Mdr7, new DataBlockWithRecordsize(Mdr7));
            Filesections.AddSection((int)InternalFileSections.Mdr8, new DataBlockWithRecordsize(Mdr8));
            Filesections.AddSection((int)InternalFileSections.Mdr9, new DataBlockWithRecordsize(Mdr9));
            Filesections.AddSection((int)InternalFileSections.Mdr10, new DataBlock(Mdr10));
            Filesections.AddSection((int)InternalFileSections.Mdr11, new DataBlockWithRecordsize(Mdr11));
            Filesections.AddSection((int)InternalFileSections.Mdr12, new DataBlockWithRecordsize(Mdr12));
            Filesections.AddSection((int)InternalFileSections.Mdr13, new DataBlockWithRecordsize(Mdr13));
            Filesections.AddSection((int)InternalFileSections.Mdr14, new DataBlockWithRecordsize(Mdr14));
            Filesections.AddSection((int)InternalFileSections.Mdr15, new DataBlock(Mdr15));
            Filesections.AddSection((int)InternalFileSections.Mdr16, new DataBlockWithRecordsize(Mdr16));
            Filesections.AddSection((int)InternalFileSections.Mdr17, new DataBlock(Mdr17));
            Filesections.AddSection((int)InternalFileSections.Mdr18, new DataBlockWithRecordsize(Mdr18));

            // GapOffset und DataOffset setzen
            SetSpecialOffsetsFromSections((int)InternalFileSections.PostHeaderData);

            if (GapOffset > HeaderOffset + Headerlength) // nur möglich, wenn extern z.B. auf den nächsten Header gesetzt
            {
                PostHeaderDataBlock = new DataBlock(HeaderOffset + Headerlength, GapOffset - (HeaderOffset + Headerlength));
                Filesections.AddSection((int)InternalFileSections.PostHeaderData, PostHeaderDataBlock);
            }

            // Datenblöcke einlesen
            Filesections.ReadSections(br);
        }
Exemple #4
0
 void Encode_ContentsBlock(BinaryReaderWriter bw)
 {
     if (bw != null)
     {
         (Filesections.GetPosition((int)InternalFileSections.DescriptionBlock) as DataBlock).Write(bw);
         (Filesections.GetPosition((int)InternalFileSections.CharacterLookupTableBlock) as DataBlock).Write(bw);
     }
 }
Exemple #5
0
        public override void ReadHeader(BinaryReaderWriter br)
        {
            base.ReadCommonHeader(br, Type);

            Filesections.ClearSections();

            Codepage = br.Read2AsUShort();
            br.SetEncoding(Codepage);

            SortId1 = br.Read2AsUShort();
            SortId2 = br.Read2AsUShort();
            br.ReadBytes(Unknown_x1B);
            Mdr1 = new DataBlockWithRecordsize(br);
            br.ReadBytes(Unknown_x27);
            Mdr2 = new DataBlockWithRecordsize(br);
            br.ReadBytes(Unknown_x35);
            Mdr3 = new DataBlockWithRecordsize(br);
            br.ReadBytes(Unknown_x43);
            Mdr4 = new DataBlockWithRecordsize(br);
            br.ReadBytes(Unknown_x51);
            Mdr5 = new DataBlockWithRecordsize(br);
            br.ReadBytes(Unknown_x5F);
            Mdr6 = new DataBlockWithRecordsize(br);
            br.ReadBytes(Unknown_x6D);
            Mdr7 = new DataBlockWithRecordsize(br);
            br.ReadBytes(Unknown_x7B);
            Mdr8 = new DataBlockWithRecordsize(br);
            br.ReadBytes(Unknown_x89);
            Mdr9 = new DataBlockWithRecordsize(br);
            br.ReadBytes(Unknown_x97);
            Mdr10 = new DataBlock(br);
            br.ReadBytes(Unknown_xA3);
            Mdr11 = new DataBlockWithRecordsize(br);
            br.ReadBytes(Unknown_xB1);
            Mdr12 = new DataBlockWithRecordsize(br);
            br.ReadBytes(Unknown_xBF);
            Mdr13 = new DataBlockWithRecordsize(br);
            br.ReadBytes(Unknown_xCD);
            Mdr14 = new DataBlockWithRecordsize(br);
            br.ReadBytes(Unknown_xDB);
            Mdr15       = new DataBlock(br);
            Unknown_xE7 = br.ReadByte();
            Mdr16       = new DataBlockWithRecordsize(br);
            br.ReadBytes(Unknown_xF2);
            Mdr17 = new DataBlock(br);
            br.ReadBytes(Unknown_xFE);
            Mdr18 = new DataBlockWithRecordsize(br);
            br.ReadBytes(Unknown_x10C);

            if (Headerlength > 0x110)
            {
                Unknown_x110 = new byte[Headerlength - 0x110];
                br.ReadBytes(Unknown_x110);
            }
        }
Exemple #6
0
 void Decode_ContentsBlock(BinaryReaderWriter br, DataBlock block)
 {
     if (br != null && block != null && block.Length > 0)
     {
         br.Seek(block.Offset);
         DescriptionBlock          = new DataBlock(br);
         CharacterLookupTableBlock = new DataBlock(br);
         Filesections.AddSection((int)InternalFileSections.DescriptionBlock, DescriptionBlock);
         Filesections.AddSection((int)InternalFileSections.CharacterLookupTableBlock, CharacterLookupTableBlock);
     }
 }
Exemple #7
0
        protected override void DecodeSections()
        {
            // Datenblöcke "interpretieren"
            int filesectiontype;

            filesectiontype = (int)InternalFileSections.NT_PointDatabtable;
            if (Filesections.GetLength(filesectiontype) > 0)
            {
                //Decode_NT_PointDatabtable(Filesections.GetSectionDataReader(filesectiontype), new DataBlock(0, Filesections.GetLength(filesectiontype)));
                //Filesections.RemoveSection(filesectiontype);
            }
            // usw.
        }
Exemple #8
0
        public override void SetSectionsAlign()
        {
            // durch Pseudo-Offsets die Reihenfolge der Abschnitte festlegen
            uint pos = 0;

            Filesections.SetOffset((int)InternalFileSections.PostHeaderData, pos++);
            Filesections.SetOffset((int)InternalFileSections.RawData, pos++);

            // endgültige Offsets der Datenabschnitte setzen
            Filesections.AdjustSections(GapOffset, DataOffset, (int)InternalFileSections.PostHeaderData);  // lückenlos ausrichten

            // Offsets für den Header setzen

            // Das wird bei einer Veränderung sicher nicht fkt., da vermutlich auch Pointer im Header ex. die angepasst werden müssten!!
        }
Exemple #9
0
        protected override void ReadSections(BinaryReaderWriter br)
        {
            // --------- Dateiabschnitte für die Rohdaten bilden ---------
            // der gesamte Rest der Datei sind MAR-Daten
            Filesections.AddSection((int)InternalFileSections.RawData, new DataBlock(DataOffset, (uint)br.Length - DataOffset));
            if (GapOffset > HeaderOffset + Headerlength) // nur möglich, wenn extern z.B. auf den nächsten Header gesetzt
            {
                Filesections.AddSection((int)InternalFileSections.PostHeaderData, HeaderOffset + Headerlength, GapOffset - (HeaderOffset + Headerlength));
            }

            // Datenblöcke einlesen
            Filesections.ReadSections(br);

            SetSpecialOffsetsFromSections((int)InternalFileSections.PostHeaderData);
        }
Exemple #10
0
        public override void ReadHeader(BinaryReaderWriter br)
        {
            base.ReadCommonHeader(br, Type);

            Filesections.ClearSections();

            br.ReadBytes(Unknown_x15);
            ContentsBlock = new ShortDataBlock(br);

            if (Headerlength > 0x1D)      // i.A. 0x001D; auch 0x25 gesehen mit 8 zusätzlichen Byte: 00 00 35 00 00 00 10 00

            {
                Unknown_x1D = new byte[Headerlength - 0x1D];
                br.ReadBytes(Unknown_x1D);
            }
        }
Exemple #11
0
        public override void SetSectionsAlign()
        {
            // durch Pseudo-Offsets die Reihenfolge der Abschnitte festlegen
            uint pos = 0;

            Filesections.SetOffset((int)InternalFileSections.PostHeaderData, pos++);
            Filesections.SetOffset((int)InternalFileSections.Mdr1, pos++);
            Filesections.SetOffset((int)InternalFileSections.Mdr2, pos++);
            Filesections.SetOffset((int)InternalFileSections.Mdr3, pos++);
            Filesections.SetOffset((int)InternalFileSections.Mdr4, pos++);
            Filesections.SetOffset((int)InternalFileSections.Mdr5, pos++);
            Filesections.SetOffset((int)InternalFileSections.Mdr6, pos++);
            Filesections.SetOffset((int)InternalFileSections.Mdr7, pos++);
            Filesections.SetOffset((int)InternalFileSections.Mdr8, pos++);
            Filesections.SetOffset((int)InternalFileSections.Mdr9, pos++);
            Filesections.SetOffset((int)InternalFileSections.Mdr10, pos++);
            Filesections.SetOffset((int)InternalFileSections.Mdr11, pos++);
            Filesections.SetOffset((int)InternalFileSections.Mdr12, pos++);
            Filesections.SetOffset((int)InternalFileSections.Mdr13, pos++);
            Filesections.SetOffset((int)InternalFileSections.Mdr14, pos++);
            Filesections.SetOffset((int)InternalFileSections.Mdr15, pos++);
            Filesections.SetOffset((int)InternalFileSections.Mdr16, pos++);
            Filesections.SetOffset((int)InternalFileSections.Mdr17, pos++);
            Filesections.SetOffset((int)InternalFileSections.Mdr18, pos++);

            Filesections.AdjustSections(DataOffset);  // lückenlos ausrichten

            Mdr1  = new DataBlockWithRecordsize(Filesections.GetPosition((int)InternalFileSections.Mdr1));
            Mdr2  = new DataBlockWithRecordsize(Filesections.GetPosition((int)InternalFileSections.Mdr2));
            Mdr3  = new DataBlockWithRecordsize(Filesections.GetPosition((int)InternalFileSections.Mdr3));
            Mdr4  = new DataBlockWithRecordsize(Filesections.GetPosition((int)InternalFileSections.Mdr4));
            Mdr5  = new DataBlockWithRecordsize(Filesections.GetPosition((int)InternalFileSections.Mdr5));
            Mdr6  = new DataBlockWithRecordsize(Filesections.GetPosition((int)InternalFileSections.Mdr6));
            Mdr7  = new DataBlockWithRecordsize(Filesections.GetPosition((int)InternalFileSections.Mdr7));
            Mdr8  = new DataBlockWithRecordsize(Filesections.GetPosition((int)InternalFileSections.Mdr8));
            Mdr9  = new DataBlockWithRecordsize(Filesections.GetPosition((int)InternalFileSections.Mdr9));
            Mdr10 = new DataBlock(Filesections.GetPosition((int)InternalFileSections.Mdr10));
            Mdr11 = new DataBlockWithRecordsize(Filesections.GetPosition((int)InternalFileSections.Mdr11));
            Mdr12 = new DataBlockWithRecordsize(Filesections.GetPosition((int)InternalFileSections.Mdr12));
            Mdr13 = new DataBlockWithRecordsize(Filesections.GetPosition((int)InternalFileSections.Mdr13));
            Mdr14 = new DataBlockWithRecordsize(Filesections.GetPosition((int)InternalFileSections.Mdr14));
            Mdr15 = new DataBlock(Filesections.GetPosition((int)InternalFileSections.Mdr15));
            Mdr16 = new DataBlockWithRecordsize(Filesections.GetPosition((int)InternalFileSections.Mdr16));
            Mdr17 = new DataBlock(Filesections.GetPosition((int)InternalFileSections.Mdr17));
            Mdr18 = new DataBlockWithRecordsize(Filesections.GetPosition((int)InternalFileSections.Mdr18));
        }
Exemple #12
0
        protected override void DecodeSections()
        {
            // Datenblöcke "interpretieren"
            int filesectiontype;

            filesectiontype = (int)InternalFileSections.DescriptionBlock;
            if (Filesections.GetLength(filesectiontype) > 0)
            {
                Decode_DescriptionBlock(Filesections.GetSectionDataReader(filesectiontype), new DataBlock(0, Filesections.GetLength(filesectiontype)));
            }

            filesectiontype = (int)InternalFileSections.CharacterLookupTableBlock;
            if (Filesections.GetLength(filesectiontype) > 0)
            {
                Decode_CharacterLookupTableBlock(Filesections.GetSectionDataReader(filesectiontype), new DataBlock(0, Filesections.GetLength(filesectiontype)));
            }
        }
Exemple #13
0
        public override void SetSectionsAlign()
        {
            // durch Pseudo-Offsets die Reihenfolge der Abschnitte festlegen
            uint pos = 0;

            Filesections.SetOffset((int)InternalFileSections.ContentsBlock, pos++);
            Filesections.SetOffset((int)InternalFileSections.DescriptionBlock, pos++);
            Filesections.SetOffset((int)InternalFileSections.CharacterLookupTableBlock, pos++);

            Filesections.AdjustSections(DataOffset);  // lückenlos ausrichten

            // mit den endgültigen Offsets setzen
            SetData2Filesection((int)InternalFileSections.ContentsBlock, true);

            DataBlockWithRecordsize tmp = Filesections.GetPosition((int)InternalFileSections.ContentsBlock);

            ContentsBlock = new ShortDataBlock(tmp.Offset, (ushort)tmp.Length);
        }
Exemple #14
0
        protected override void ReadSections(BinaryReaderWriter br)
        {
            // --------- Dateiabschnitte für die Rohdaten bilden ---------
            Filesections.AddSection((int)InternalFileSections.Nod1, Nod1Nodes);
            Filesections.AddSection((int)InternalFileSections.Nod2, Nod2RoadData);
            Filesections.AddSection((int)InternalFileSections.Nod3, Nod3BoundaryNodes);
            Filesections.AddSection((int)InternalFileSections.Nod4, Nod4HighClassBoundary);
            Filesections.AddSection((int)InternalFileSections.Nod5, Nod5);
            Filesections.AddSection((int)InternalFileSections.Nod6, Nod6);
            if (GapOffset > HeaderOffset + Headerlength) // nur möglich, wenn extern z.B. auf den nächsten Header gesetzt
            {
                Filesections.AddSection((int)InternalFileSections.PostHeaderData, HeaderOffset + Headerlength, GapOffset - (HeaderOffset + Headerlength));
            }

            // Datenblöcke einlesen
            Filesections.ReadSections(br);

            SetSpecialOffsetsFromSections((int)InternalFileSections.PostHeaderData);
        }
Exemple #15
0
        public override void SetSectionsAlign()
        {
            // durch Pseudo-Offsets die Reihenfolge der Abschnitte festlegen
            uint pos = 0;

            Filesections.SetOffset((int)InternalFileSections.NT_PointDatablock, pos++);
            Filesections.SetOffset((int)InternalFileSections.NT_PointDatabtable, pos++);
            Filesections.SetOffset((int)InternalFileSections.NT_PointLabelblock, pos++);
            Filesections.SetOffset((int)InternalFileSections.NT_LabelblockTable1, pos++);
            Filesections.SetOffset((int)InternalFileSections.NT_LabelblockTable2, pos++);

            Filesections.AdjustSections(DataOffset);  // lückenlos ausrichten

            NT_PointTableBlock  = new TypDataBlockWithRecordsize(Filesections.GetPosition((int)InternalFileSections.NT_PointDatabtable));
            NT_PointDatablock   = new DataBlock(Filesections.GetPosition((int)InternalFileSections.NT_PointDatablock));
            NT_PointLabelblock  = new DataBlock(Filesections.GetPosition((int)InternalFileSections.NT_PointLabelblock));
            NT_LabelblockTable1 = new DataBlock(Filesections.GetPosition((int)InternalFileSections.NT_LabelblockTable1));
            NT_LabelblockTable2 = new DataBlock(Filesections.GetPosition((int)InternalFileSections.NT_LabelblockTable2));
        }
Exemple #16
0
        protected override void ReadSections(BinaryReaderWriter br)
        {
            // --------- Dateiabschnitte für die Rohdaten bilden (nur NT) ---------
            Filesections.AddSection((int)InternalFileSections.NT_PointDatablock, new DataBlock(NT_PointDatablock));
            Filesections.AddSection((int)InternalFileSections.NT_PointDatabtable, new DataBlock(NT_PointTableBlock));
            Filesections.AddSection((int)InternalFileSections.NT_PointLabelblock, new DataBlock(NT_PointLabelblock));
            Filesections.AddSection((int)InternalFileSections.NT_LabelblockTable1, new DataBlock(NT_LabelblockTable1));
            Filesections.AddSection((int)InternalFileSections.NT_LabelblockTable2, new DataBlock(NT_LabelblockTable2));
            if (GapOffset > HeaderOffset + Headerlength) // nur möglich, wenn extern z.B. auf den nächsten Header gesetzt
            {
                Filesections.AddSection((int)InternalFileSections.PostHeaderData, HeaderOffset + Headerlength, GapOffset - (HeaderOffset + Headerlength));
            }

            // Datenblöcke einlesen
            Filesections.ReadSections(br);

            SetSpecialOffsetsFromSections((int)InternalFileSections.PostHeaderData);

            br.SetEncoding(Codepage);
        }
Exemple #17
0
        public override void SetSectionsAlign()
        {
            // durch Pseudo-Offsets die Reihenfolge der Abschnitte festlegen
            uint pos = 0;

            Filesections.SetOffset((int)InternalFileSections.PostHeaderData, pos++);
            Filesections.SetOffset((int)InternalFileSections.Nod1, pos++);
            Filesections.SetOffset((int)InternalFileSections.Nod2, pos++);
            Filesections.SetOffset((int)InternalFileSections.Nod3, pos++);
            Filesections.SetOffset((int)InternalFileSections.Nod4, pos++);
            Filesections.SetOffset((int)InternalFileSections.Nod5, pos++);
            Filesections.SetOffset((int)InternalFileSections.Nod6, pos++);

            Filesections.AdjustSections(DataOffset);  // lückenlos ausrichten

            Nod1Nodes             = new DataBlock(Filesections.GetPosition((int)InternalFileSections.Nod1));
            Nod2RoadData          = new DataBlock(Filesections.GetPosition((int)InternalFileSections.Nod2));
            Nod3BoundaryNodes     = new DataBlockWithRecordsize(Filesections.GetPosition((int)InternalFileSections.Nod3));
            Nod4HighClassBoundary = new DataBlock(Filesections.GetPosition((int)InternalFileSections.Nod4));
            Nod5 = new DataBlock(Filesections.GetPosition((int)InternalFileSections.Nod5));
            Nod6 = new DataBlockWithRecordsize(Filesections.GetPosition((int)InternalFileSections.Nod6));
        }
Exemple #18
0
        protected override void ReadSections(BinaryReaderWriter br)
        {
            // --------- Dateiabschnitte für die Rohdaten bilden ---------
            Filesections.AddSection((int)InternalFileSections.ContentsBlock, new DataBlock(ContentsBlock));

            // GapOffset und DataOffset setzen
            SetSpecialOffsetsFromSections((int)InternalFileSections.PostHeaderData);

            if (GapOffset > HeaderOffset + Headerlength) // nur möglich, wenn extern z.B. auf den nächsten Header gesetzt
            {
                PostHeaderDataBlock = new DataBlock(HeaderOffset + Headerlength, GapOffset - (HeaderOffset + Headerlength));
                Filesections.AddSection((int)InternalFileSections.PostHeaderData, PostHeaderDataBlock);
            }

            // Datenblöcke einlesen
            Filesections.ReadSections(br);

            // Pos. der anderen beiden Datenblöcke ermitteln ...
            Decode_ContentsBlock(Filesections.GetSectionDataReader((int)InternalFileSections.ContentsBlock), new DataBlock(0, Filesections.GetLength((int)InternalFileSections.ContentsBlock)));
            // ... und einlesen
            Filesections.Read((int)InternalFileSections.DescriptionBlock, br);
            Filesections.Read((int)InternalFileSections.CharacterLookupTableBlock, br);
        }