Example #1
0
        private void WriteSector(uint sectorIndex, Span <byte> s0, Span <byte> s1, Span <byte> s2, Span <byte> s3)
        {
            var p0 = new CoinPack(s0)
            {
                LayerIndex  = 0, SectorIndex = sectorIndex, Version = CoinPack.CurrentVersion,
                SizeInBytes = _fixture.SectorsSize[0]
            };
            var p1 = new CoinPack(s1)
            {
                LayerIndex  = 1, SectorIndex = sectorIndex, Version = CoinPack.CurrentVersion,
                SizeInBytes = _fixture.SectorsSize[1]
            };
            var p2 = new CoinPack(s2)
            {
                LayerIndex  = 2, SectorIndex = sectorIndex, Version = CoinPack.CurrentVersion,
                SizeInBytes = _fixture.SectorsSize[2]
            };

            var collection = new ShortCoinPackCollection(p0);

            collection.Add(p1);
            collection.Add(p2);

            if (!s3.IsEmpty)
            {
                var p3 = new CoinPack(s3)
                {
                    LayerIndex  = 3, SectorIndex = sectorIndex, Version = CoinPack.CurrentVersion,
                    SizeInBytes = s3.Length
                };
                collection.Add(p3);
            }

            try
            {
                _fixture.CreateStore();
                _fixture.Store.Write(collection);
            }
            finally
            {
                _fixture.CloseStore();
            }
        }