コード例 #1
0
        static void Main(string[] args)
        {
            Directory.CreateDirectory("output");

            Encoding.RegisterProvider(CodePagesEncodingProvider.Instance);

            var node1Record = new RoadNodeChangeDbaseRecord();

            node1Record.TYPE.Value       = (short)RoadNodeType.EndNode.Translation.Identifier;
            node1Record.RECORDTYPE.Value = (short)RecordType.Added.Translation.Identifier;
            node1Record.WEGKNOOPID.Value = 1;
            var node1Shape = new PointShapeContent(new Point(0.0, 0.0));

            var node2Record = new RoadNodeChangeDbaseRecord();

            node2Record.TYPE.Value       = (short)RoadNodeType.EndNode.Translation.Identifier;
            node2Record.RECORDTYPE.Value = (short)RecordType.Added.Translation.Identifier;
            node2Record.WEGKNOOPID.Value = 2;
            var node2Shape = new PointShapeContent(new Point(0.0, 1.0));

            var segment1Record = new RoadSegmentChangeDbaseRecord();

            segment1Record.WS_OIDN.Value    = 1;
            segment1Record.B_WK_OIDN.Value  = 1;
            segment1Record.E_WK_OIDN.Value  = 2;
            segment1Record.TGBEP.Value      = (short)RoadSegmentAccessRestriction.PublicRoad.Translation.Identifier;
            segment1Record.STATUS.Value     = RoadSegmentStatus.InUse.Translation.Identifier;
            segment1Record.WEGCAT.Value     = RoadSegmentCategory.SecondaryRoad.Translation.Identifier;
            segment1Record.METHODE.Value    = (short)RoadSegmentGeometryDrawMethod.Measured.Translation.Identifier;
            segment1Record.MORFOLOGIE.Value = (short)RoadSegmentMorphology.Motorway.Translation.Identifier;
            segment1Record.LSTRNMID.Value   = 123;
            segment1Record.RSTRNMID.Value   = 456;
            segment1Record.BEHEERDER.Value  = "-8";
            segment1Record.RECORDTYPE.Value = (short)RecordType.Added.Translation.Identifier;
            var segmentShape = new PolyLineMShapeContent(GeometryTranslator.FromGeometryMultiLineString(new NetTopologySuite.Geometries.MultiLineString(new NetTopologySuite.Geometries.LineString[]
            {
                new NetTopologySuite.Geometries.LineString(new NetTopologySuite.Geometries.Implementation.CoordinateArraySequence(new[]
                {
                    new NetTopologySuite.Geometries.CoordinateM(0.0, 0.0, 0.0),
                    new NetTopologySuite.Geometries.CoordinateM(0.0, 1.0, 1.0)
                }), GeometryConfiguration.GeometryFactory)
            })));

            var laneRecord = new RoadSegmentLaneChangeDbaseRecord();

            laneRecord.RS_OIDN.Value    = 1;
            laneRecord.WS_OIDN.Value    = 1;
            laneRecord.RICHTING.Value   = (short)RoadSegmentLaneDirection.Independent.Translation.Identifier;
            laneRecord.AANTAL.Value     = 2;
            laneRecord.VANPOSITIE.Value = 0.0;
            laneRecord.TOTPOSITIE.Value = 1.0;
            laneRecord.RECORDTYPE.Value = (short)RecordType.Added.Translation.Identifier;

            var surfaceRecord = new RoadSegmentSurfaceChangeDbaseRecord();

            surfaceRecord.WV_OIDN.Value    = 1;
            surfaceRecord.WS_OIDN.Value    = 1;
            surfaceRecord.TYPE.Value       = (short)RoadSegmentSurfaceType.SolidSurface.Translation.Identifier;
            surfaceRecord.VANPOSITIE.Value = 0.0;
            surfaceRecord.TOTPOSITIE.Value = 1.0;
            surfaceRecord.RECORDTYPE.Value = (short)RecordType.Added.Translation.Identifier;

            var widthRecord = new RoadSegmentWidthChangeDbaseRecord();

            widthRecord.WB_OIDN.Value    = 1;
            widthRecord.WS_OIDN.Value    = 1;
            widthRecord.BREEDTE.Value    = 1;
            widthRecord.VANPOSITIE.Value = 0.0;
            widthRecord.TOTPOSITIE.Value = 1.0;
            widthRecord.RECORDTYPE.Value = (short)RecordType.Added.Translation.Identifier;

            var nodeDbaseHeader = new DbaseFileHeader(
                DateTime.Now,
                DbaseCodePage.Western_European_ANSI,
                new DbaseRecordCount(2),
                new RoadNodeChangeDbaseSchema());
            var nodeShapeHeader = new ShapeFileHeader(
                ShapeFileHeader.Length.Plus(node1Shape.ContentLength).Plus(node2Shape.ContentLength),
                ShapeType.Point,
                BoundingBox3D
                .FromGeometry(node1Shape.Shape)
                .ExpandWith(
                    BoundingBox3D.FromGeometry(node2Shape.Shape)
                    )
                );

            // node

            using (var nodeDbaseFile = new BinaryWriter(File.OpenWrite("output/WEGKNOOP_ALL.dbf")))
                using (var nodeDbaseWriter = new DbaseBinaryWriter(nodeDbaseHeader, nodeDbaseFile))
                {
                    nodeDbaseWriter.Write(node1Record);
                    nodeDbaseWriter.Write(node2Record);
                }
            using (var nodeShapeIndexFile = new BinaryWriter(File.OpenWrite("output/WEGKNOOP_ALL.shx")))
                using (var nodeShapeFile = new BinaryWriter(File.OpenWrite("output/WEGKNOOP_ALL.shp")))
                    using (var nodeShapeWriter = new ShapeBinaryWriter(nodeShapeHeader, nodeShapeFile))
                        using (var nodeShapeIndexWriter =
                                   new ShapeIndexBinaryWriter(nodeShapeHeader.ForIndex(new ShapeRecordCount(2)), nodeShapeIndexFile))
                        {
                            var node1ShapeRecord = node1Shape.RecordAs(RecordNumber.Initial);
                            nodeShapeWriter.Write(node1ShapeRecord);
                            var node2ShapeRecord = node2Shape.RecordAs(RecordNumber.Initial.Next());
                            nodeShapeWriter.Write(node2ShapeRecord);

                            var offset = ShapeIndexRecord.InitialOffset;
                            var node1ShapeIndexRecord = node1ShapeRecord.IndexAt(offset);
                            var node2ShapeIndexRecord = node2ShapeRecord.IndexAt(offset.Plus(node1ShapeRecord.Length));
                            nodeShapeIndexWriter.Write(node1ShapeIndexRecord);
                            nodeShapeIndexWriter.Write(node2ShapeIndexRecord);
                        }

            // segment

            var segmentDbaseHeader = new DbaseFileHeader(
                DateTime.Now,
                DbaseCodePage.Western_European_ANSI,
                new DbaseRecordCount(1),
                new RoadSegmentChangeDbaseSchema());
            var segmentShapeHeader = new ShapeFileHeader(
                ShapeFileHeader.Length.Plus(segmentShape.ContentLength),
                ShapeType.PolyLineM,
                BoundingBox3D
                .FromGeometry(segmentShape.Shape)
                );

            using (var segmentDbaseFile = new BinaryWriter(File.OpenWrite("output/WEGSEGMENT_ALL.dbf")))
                using (var segmentDbaseWriter = new DbaseBinaryWriter(segmentDbaseHeader, segmentDbaseFile))
                {
                    segmentDbaseWriter.Write(segment1Record);
                }
            using (var segmentShapeIndexFile = new BinaryWriter(File.OpenWrite("output/WEGSEGMENT_ALL.shx")))
                using (var segmentShapeFile = new BinaryWriter(File.OpenWrite("output/WEGSEGMENT_ALL.shp")))
                    using (var segmentShapeWriter = new ShapeBinaryWriter(segmentShapeHeader, segmentShapeFile))
                        using (var segmentShapeIndexWriter =
                                   new ShapeIndexBinaryWriter(segmentShapeHeader.ForIndex(new ShapeRecordCount(2)), segmentShapeIndexFile))
                        {
                            var segment1ShapeRecord = segmentShape.RecordAs(RecordNumber.Initial);
                            segmentShapeWriter.Write(segment1ShapeRecord);

                            var offset = ShapeIndexRecord.InitialOffset;
                            var segment1ShapeIndexRecord = segment1ShapeRecord.IndexAt(offset);
                            segmentShapeIndexWriter.Write(segment1ShapeIndexRecord);
                        }

            // lane
            var laneDbaseHeader = new DbaseFileHeader(
                DateTime.Now,
                DbaseCodePage.Western_European_ANSI,
                new DbaseRecordCount(1),
                new RoadSegmentLaneChangeDbaseSchema());

            using (var laneDbaseFile = new BinaryWriter(File.OpenWrite("output/ATTRIJSTROKEN_ALL.DBF")))
                using (var laneDbaseWriter = new DbaseBinaryWriter(laneDbaseHeader, laneDbaseFile))
                {
                    laneDbaseWriter.Write(laneRecord);
                }

            // width
            var widthDbaseHeader = new DbaseFileHeader(
                DateTime.Now,
                DbaseCodePage.Western_European_ANSI,
                new DbaseRecordCount(1),
                new RoadSegmentWidthChangeDbaseSchema());

            using (var widthDbaseFile = new BinaryWriter(File.OpenWrite("output/ATTWEGBREEDTE_ALL.DBF")))
                using (var widthDbaseWriter = new DbaseBinaryWriter(widthDbaseHeader, widthDbaseFile))
                {
                    widthDbaseWriter.Write(widthRecord);
                }

            // surface
            var surfaceDbaseHeader = new DbaseFileHeader(
                DateTime.Now,
                DbaseCodePage.Western_European_ANSI,
                new DbaseRecordCount(1),
                new RoadSegmentSurfaceChangeDbaseSchema());

            using (var surfaceDbaseFile = new BinaryWriter(File.OpenWrite("output/ATTWEGVERHARDING_ALL.DBF")))
                using (var surfaceDbaseWriter = new DbaseBinaryWriter(surfaceDbaseHeader, surfaceDbaseFile))
                {
                    surfaceDbaseWriter.Write(surfaceRecord);
                }

            // european road
            var europeanRoadRecord = new EuropeanRoadChangeDbaseRecord();

            europeanRoadRecord.EU_OIDN.Value    = 1;
            europeanRoadRecord.WS_OIDN.Value    = 1;
            europeanRoadRecord.EUNUMMER.Value   = EuropeanRoadNumber.E40.ToString();
            europeanRoadRecord.RECORDTYPE.Value = (short)RecordType.Added.Translation.Identifier;

            var europeanDbaseHeader = new DbaseFileHeader(
                DateTime.Now,
                DbaseCodePage.Western_European_ANSI,
                new DbaseRecordCount(1),
                new EuropeanRoadChangeDbaseSchema());

            using (var europeanDbaseFile = new BinaryWriter(File.OpenWrite("output/ATTEUROPWEG_ALL.DBF")))
                using (var europeanDbaseWriter = new DbaseBinaryWriter(europeanDbaseHeader, europeanDbaseFile))
                {
                    europeanDbaseWriter.Write(europeanRoadRecord);
                }

            // national road
            var nationalRoadRecord = new NationalRoadChangeDbaseRecord();

            nationalRoadRecord.NW_OIDN.Value    = 1;
            nationalRoadRecord.WS_OIDN.Value    = 1;
            nationalRoadRecord.IDENT2.Value     = NationalRoadNumber.All[5].ToString();
            nationalRoadRecord.RECORDTYPE.Value = (short)RecordType.Added.Translation.Identifier;

            var nationalDbaseHeader = new DbaseFileHeader(
                DateTime.Now,
                DbaseCodePage.Western_European_ANSI,
                new DbaseRecordCount(1),
                new NationalRoadChangeDbaseSchema());

            using (var nationalDbaseFile = new BinaryWriter(File.OpenWrite("output/ATTNATIONWEG_ALL.DBF")))
                using (var nationalDbaseWriter = new DbaseBinaryWriter(nationalDbaseHeader, nationalDbaseFile))
                {
                    nationalDbaseWriter.Write(nationalRoadRecord);
                }

            // numbered road
            var numberedRoadRecord = new NumberedRoadChangeDbaseRecord();

            numberedRoadRecord.GW_OIDN.Value    = 1;
            numberedRoadRecord.WS_OIDN.Value    = 1;
            numberedRoadRecord.IDENT8.Value     = NumberedRoadNumber.Parse("A0001231").ToString();
            numberedRoadRecord.RICHTING.Value   = (short)RoadSegmentNumberedRoadDirection.Backward.Translation.Identifier;
            numberedRoadRecord.VOLGNUMMER.Value = 1;
            numberedRoadRecord.RECORDTYPE.Value = (short)RecordType.Added.Translation.Identifier;

            var numberedDbaseHeader = new DbaseFileHeader(
                DateTime.Now,
                DbaseCodePage.Western_European_ANSI,
                new DbaseRecordCount(1),
                new NumberedRoadChangeDbaseSchema());

            using (var numberedDbaseFile = new BinaryWriter(File.OpenWrite("output/ATTGENUMWEG_ALL.DBF")))
                using (var numberedDbaseWriter = new DbaseBinaryWriter(numberedDbaseHeader, numberedDbaseFile))
                {
                    numberedDbaseWriter.Write(numberedRoadRecord);
                }

            // grade separated junction
            var gradeSeparatedJunctionRecord = new GradeSeparatedJunctionChangeDbaseRecord();

            gradeSeparatedJunctionRecord.OK_OIDN.Value    = 1;
            gradeSeparatedJunctionRecord.BO_WS_OIDN.Value = 1;
            gradeSeparatedJunctionRecord.ON_WS_OIDN.Value = 1;
            gradeSeparatedJunctionRecord.TYPE.Value       = (short)GradeSeparatedJunctionType.Unknown.Translation.Identifier;
            gradeSeparatedJunctionRecord.RECORDTYPE.Value = (short)RecordType.Added.Translation.Identifier;

            var gradeSeparatedJunctionDbaseHeader = new DbaseFileHeader(
                DateTime.Now,
                DbaseCodePage.Western_European_ANSI,
                new DbaseRecordCount(1),
                new GradeSeparatedJunctionChangeDbaseSchema());

            using (var gradeSeparatedJunctionDbaseFile = new BinaryWriter(File.OpenWrite("output/RLTOGKRUISING_ALL.DBF")))
                using (var gradeSeparatedJunctionDbaseWriter = new DbaseBinaryWriter(gradeSeparatedJunctionDbaseHeader, gradeSeparatedJunctionDbaseFile))
                {
                    gradeSeparatedJunctionDbaseWriter.Write(gradeSeparatedJunctionRecord);
                }


            // transaction zone
            var transactionZoneRecord = new TransactionZoneDbaseRecord();

            transactionZoneRecord.ORG.Value        = "11053";
            transactionZoneRecord.OPERATOR.Value   = "Yves Reynhout";
            transactionZoneRecord.TYPE.Value       = 1;
            transactionZoneRecord.SOURCE_ID.Value  = 1;
            transactionZoneRecord.BESCHRIJV.Value  = "Nieuwe wijk";
            transactionZoneRecord.APPLICATIE.Value = "Wegenregister BLL";

            var transactionZoneDbaseHeader = new DbaseFileHeader(
                DateTime.Now,
                DbaseCodePage.Western_European_ANSI,
                new DbaseRecordCount(1),
                TransactionZoneDbaseRecord.Schema);

            using (var transactionZoneDbaseFile = new BinaryWriter(File.OpenWrite("output/TRANSACTIEZONE.DBF")))
                using (var transactionZoneDbaseWriter = new DbaseBinaryWriter(transactionZoneDbaseHeader, transactionZoneDbaseFile))
                {
                    transactionZoneDbaseWriter.Write(transactionZoneRecord);
                }

            var suffix =
                DateTimeOffset.UtcNow.ToString("yyyyMMdd") + "-" +
                Convert.ToInt32(DateTimeOffset.UtcNow.TimeOfDay.TotalSeconds);

            using (var archiveStream = File.OpenWrite($"output/oplading-{suffix}.zip"))
                using (var archive = new ZipArchive(archiveStream, ZipArchiveMode.Create))
                {
                    foreach (var file in Directory.EnumerateFiles("output"))
                    {
                        if (file.ToLowerInvariant().EndsWith(".dbf") ||
                            file.ToLowerInvariant().EndsWith(".shp") ||
                            file.ToLowerInvariant().EndsWith(".shx"))
                        {
                            var entry = archive.CreateEntry(Path.GetFileName(file));
                            using (var fileStream = File.OpenRead(file))
                                using (var entryStream = entry.Open())
                                {
                                    fileStream.CopyTo(entryStream);
                                }
                        }
                    }
                }
        }
コード例 #2
0
        public async Task WriteAsync(ZipArchive archive, BackOfficeContext context, CancellationToken cancellationToken)
        {
            if (archive == null)
            {
                throw new ArgumentNullException(nameof(archive));
            }
            if (context == null)
            {
                throw new ArgumentNullException(nameof(context));
            }

            var count = await context.RoadNodes.CountAsync(cancellationToken);

            var dbfEntry  = archive.CreateEntry("Wegknoop.dbf");
            var dbfHeader = new DbaseFileHeader(
                DateTime.Now,
                DbaseCodePage.Western_European_ANSI,
                new DbaseRecordCount(count),
                RoadNodeDbaseRecord.Schema
                );

            using (var dbfEntryStream = dbfEntry.Open())
                using (var dbfWriter =
                           new DbaseBinaryWriter(
                               dbfHeader,
                               new BinaryWriter(dbfEntryStream, _encoding, true)))
                {
                    var dbfRecord = new RoadNodeDbaseRecord();
                    foreach (var data in context.RoadNodes.OrderBy(_ => _.Id).Select(_ => _.DbaseRecord))
                    {
                        dbfRecord.FromBytes(data, _manager, _encoding);
                        dbfWriter.Write(dbfRecord);
                    }
                    dbfWriter.Writer.Flush();
                    await dbfEntryStream.FlushAsync(cancellationToken);
                }

            var shpBoundingBox =
                (await context.RoadNodeBoundingBox.SingleOrDefaultAsync(cancellationToken))?.ToBoundingBox3D()
                ?? new BoundingBox3D(0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
            var info = await context.RoadNetworkInfo.SingleAsync(cancellationToken);

            var shpEntry  = archive.CreateEntry("Wegknoop.shp");
            var shpHeader = new ShapeFileHeader(
                new WordLength(info.TotalRoadNodeShapeLength),
                ShapeType.Point,
                shpBoundingBox);

            using (var shpEntryStream = shpEntry.Open())
                using (var shpWriter =
                           new ShapeBinaryWriter(
                               shpHeader,
                               new BinaryWriter(shpEntryStream, _encoding, true)))
                {
                    var number = RecordNumber.Initial;
                    foreach (var data in context.RoadNodes.OrderBy(_ => _.Id).Select(_ => _.ShapeRecordContent))
                    {
                        shpWriter.Write(
                            ShapeContentFactory
                            .FromBytes(data, _manager, _encoding)
                            .RecordAs(number)
                            );
                        number = number.Next();
                    }
                    shpWriter.Writer.Flush();
                    await shpEntryStream.FlushAsync(cancellationToken);
                }

            var shxEntry  = archive.CreateEntry("Wegknoop.shx");
            var shxHeader = shpHeader.ForIndex(new ShapeRecordCount(count));

            using (var shxEntryStream = shxEntry.Open())
                using (var shxWriter =
                           new ShapeIndexBinaryWriter(
                               shxHeader,
                               new BinaryWriter(shxEntryStream, _encoding, true)))
                {
                    var offset = ShapeIndexRecord.InitialOffset;
                    var number = RecordNumber.Initial;
                    foreach (var data in context.RoadNodes.OrderBy(_ => _.Id).Select(_ => _.ShapeRecordContent))
                    {
                        var shpRecord = ShapeContentFactory
                                        .FromBytes(data, _manager, _encoding)
                                        .RecordAs(number);
                        shxWriter.Write(shpRecord.IndexAt(offset));
                        number = number.Next();
                        offset = offset.Plus(shpRecord.Length);
                    }
                    shxWriter.Writer.Flush();
                    await shxEntryStream.FlushAsync(cancellationToken);
                }
        }
コード例 #3
0
        private static ZipArchive CreateArchiveWithEmptyFiles()
        {
            var fixture = CreateFixture();

            var roadSegmentShapeChangeStream = new MemoryStream();

            using (var writer = new ShapeBinaryWriter(
                       new ShapeFileHeader(
                           ShapeFileHeader.Length,
                           ShapeType.PolyLineM,
                           BoundingBox3D.Empty),
                       new BinaryWriter(
                           roadSegmentShapeChangeStream,
                           Encoding.UTF8,
                           true)))
            {
                writer.Write(new ShapeRecord[0]);
            }

            var roadSegmentDbaseChangeStream = new MemoryStream();

            using (var writer = new DbaseBinaryWriter(
                       new DbaseFileHeader(
                           fixture.Create <DateTime>(),
                           DbaseCodePage.Western_European_ANSI,
                           new DbaseRecordCount(0),
                           RoadSegmentChangeDbaseRecord.Schema),
                       new BinaryWriter(
                           roadSegmentDbaseChangeStream,
                           Encoding.UTF8,
                           true)))
            {
                writer.Write(new RoadSegmentChangeDbaseRecord[0]);
            }

            var europeanRoadChangeStream = new MemoryStream();

            using (var writer = new DbaseBinaryWriter(
                       new DbaseFileHeader(
                           fixture.Create <DateTime>(),
                           DbaseCodePage.Western_European_ANSI,
                           new DbaseRecordCount(0),
                           EuropeanRoadChangeDbaseRecord.Schema),
                       new BinaryWriter(
                           europeanRoadChangeStream,
                           Encoding.UTF8,
                           true)))
            {
                writer.Write(new EuropeanRoadChangeDbaseRecord[0]);
            }

            var nationalRoadChangeStream = new MemoryStream();

            using (var writer = new DbaseBinaryWriter(
                       new DbaseFileHeader(
                           fixture.Create <DateTime>(),
                           DbaseCodePage.Western_European_ANSI,
                           new DbaseRecordCount(0),
                           NationalRoadChangeDbaseRecord.Schema),
                       new BinaryWriter(
                           nationalRoadChangeStream,
                           Encoding.UTF8,
                           true)))
            {
                writer.Write(new NationalRoadChangeDbaseRecord[0]);
            }

            var numberedRoadChangeStream = new MemoryStream();

            using (var writer = new DbaseBinaryWriter(
                       new DbaseFileHeader(
                           fixture.Create <DateTime>(),
                           DbaseCodePage.Western_European_ANSI,
                           new DbaseRecordCount(1),
                           NumberedRoadChangeDbaseRecord.Schema),
                       new BinaryWriter(
                           numberedRoadChangeStream,
                           Encoding.UTF8,
                           true)))
            {
                writer.Write(new NumberedRoadChangeDbaseRecord[0]);
            }

            var laneChangeStream = new MemoryStream();

            using (var writer = new DbaseBinaryWriter(
                       new DbaseFileHeader(
                           fixture.Create <DateTime>(),
                           DbaseCodePage.Western_European_ANSI,
                           new DbaseRecordCount(0),
                           RoadSegmentLaneChangeDbaseRecord.Schema),
                       new BinaryWriter(
                           laneChangeStream,
                           Encoding.UTF8,
                           true)))
            {
                writer.Write(new RoadSegmentLaneChangeDbaseRecord[0]);
            }

            var widthChangeStream = new MemoryStream();

            using (var writer = new DbaseBinaryWriter(
                       new DbaseFileHeader(
                           fixture.Create <DateTime>(),
                           DbaseCodePage.Western_European_ANSI,
                           new DbaseRecordCount(0),
                           RoadSegmentWidthChangeDbaseRecord.Schema),
                       new BinaryWriter(
                           widthChangeStream,
                           Encoding.UTF8,
                           true)))
            {
                writer.Write(new RoadSegmentWidthChangeDbaseRecord[0]);
            }

            var surfaceChangeStream = new MemoryStream();

            using (var writer = new DbaseBinaryWriter(
                       new DbaseFileHeader(
                           fixture.Create <DateTime>(),
                           DbaseCodePage.Western_European_ANSI,
                           new DbaseRecordCount(1),
                           RoadSegmentSurfaceChangeDbaseRecord.Schema),
                       new BinaryWriter(
                           surfaceChangeStream,
                           Encoding.UTF8,
                           true)))
            {
                writer.Write(new RoadSegmentSurfaceChangeDbaseRecord[0]);
            }

            var roadNodeShapeChangeStream = new MemoryStream();

            using (var writer = new ShapeBinaryWriter(
                       new ShapeFileHeader(
                           ShapeFileHeader.Length,
                           ShapeType.Point,
                           BoundingBox3D.Empty),
                       new BinaryWriter(
                           roadNodeShapeChangeStream,
                           Encoding.UTF8,
                           true)))
            {
                writer.Write(new ShapeRecord[0]);
            }

            var roadNodeDbaseChangeStream = new MemoryStream();

            using (var writer = new DbaseBinaryWriter(
                       new DbaseFileHeader(
                           fixture.Create <DateTime>(),
                           DbaseCodePage.Western_European_ANSI,
                           new DbaseRecordCount(0),
                           RoadNodeChangeDbaseRecord.Schema),
                       new BinaryWriter(
                           roadNodeDbaseChangeStream,
                           Encoding.UTF8,
                           true)))
            {
                writer.Write(new RoadNodeChangeDbaseRecord[0]);
            }

            var gradeSeparatedJunctionChangeStream = new MemoryStream();

            using (var writer = new DbaseBinaryWriter(
                       new DbaseFileHeader(
                           fixture.Create <DateTime>(),
                           DbaseCodePage.Western_European_ANSI,
                           new DbaseRecordCount(0),
                           GradeSeparatedJunctionChangeDbaseRecord.Schema),
                       new BinaryWriter(
                           gradeSeparatedJunctionChangeStream,
                           Encoding.UTF8,
                           true)))
            {
                writer.Write(new GradeSeparatedJunctionChangeDbaseRecord[0]);
            }

            var transactionZoneStream = new MemoryStream();

            using (var writer = new DbaseBinaryWriter(
                       new DbaseFileHeader(
                           fixture.Create <DateTime>(),
                           DbaseCodePage.Western_European_ANSI,
                           new DbaseRecordCount(0),
                           TransactionZoneDbaseRecord.Schema),
                       new BinaryWriter(
                           transactionZoneStream,
                           Encoding.UTF8,
                           true)))
            {
                writer.Write(new TransactionZoneDbaseRecord[0]);
            }

            roadSegmentShapeChangeStream.Position       = 0;
            roadSegmentDbaseChangeStream.Position       = 0;
            europeanRoadChangeStream.Position           = 0;
            nationalRoadChangeStream.Position           = 0;
            numberedRoadChangeStream.Position           = 0;
            laneChangeStream.Position                   = 0;
            widthChangeStream.Position                  = 0;
            surfaceChangeStream.Position                = 0;
            roadNodeShapeChangeStream.Position          = 0;
            roadNodeDbaseChangeStream.Position          = 0;
            gradeSeparatedJunctionChangeStream.Position = 0;
            transactionZoneStream.Position              = 0;

            var errors        = ZipArchiveProblems.None;
            var archiveStream = new MemoryStream();

            using (var createArchive =
                       new ZipArchive(archiveStream, ZipArchiveMode.Create, true, Encoding.UTF8))
            {
                using (var entryStream =
                           createArchive.CreateEntry("WEGSEGMENT_ALL.SHP").Open())
                {
                    roadSegmentShapeChangeStream.CopyTo(entryStream);
                }

                using (var entryStream =
                           createArchive.CreateEntry("WEGSEGMENT_ALL.DBF").Open())
                {
                    roadSegmentDbaseChangeStream.CopyTo(entryStream);
                }

                using (var entryStream =
                           createArchive.CreateEntry("WEGKNOOP_ALL.SHP").Open())
                {
                    roadNodeShapeChangeStream.CopyTo(entryStream);
                }

                using (var entryStream =
                           createArchive.CreateEntry("WEGKNOOP_ALL.DBF").Open())
                {
                    roadNodeDbaseChangeStream.CopyTo(entryStream);
                }

                using (var entryStream =
                           createArchive.CreateEntry("ATTEUROPWEG_ALL.DBF").Open())
                {
                    europeanRoadChangeStream.CopyTo(entryStream);
                }

                using (var entryStream =
                           createArchive.CreateEntry("ATTGENUMWEG_ALL.DBF").Open())
                {
                    numberedRoadChangeStream.CopyTo(entryStream);
                }

                using (var entryStream =
                           createArchive.CreateEntry("ATTNATIONWEG_ALL.DBF").Open())
                {
                    nationalRoadChangeStream.CopyTo(entryStream);
                }

                using (var entryStream =
                           createArchive.CreateEntry("ATTRIJSTROKEN_ALL.DBF").Open())
                {
                    laneChangeStream.CopyTo(entryStream);
                }

                using (var entryStream =
                           createArchive.CreateEntry("ATTWEGBREEDTE_ALL.DBF").Open())
                {
                    widthChangeStream.CopyTo(entryStream);
                }

                using (var entryStream =
                           createArchive.CreateEntry("ATTWEGVERHARDING_ALL.DBF").Open())
                {
                    surfaceChangeStream.CopyTo(entryStream);
                }

                using (var entryStream =
                           createArchive.CreateEntry("RLTOGKRUISING_ALL.DBF").Open())
                {
                    gradeSeparatedJunctionChangeStream.CopyTo(entryStream);
                }

                using (var entryStream =
                           createArchive.CreateEntry("TRANSACTIEZONE.DBF").Open())
                {
                    transactionZoneStream.CopyTo(entryStream);
                }
            }

            archiveStream.Position = 0;

            return(new ZipArchive(archiveStream, ZipArchiveMode.Read, false, Encoding.UTF8));
        }