Пример #1
0
        /// <summary>
        /// Creats a list of chunks given a list of cumulative chunk sizes.
        /// </summary>
        /// <param name="cumulativeSizes">List of cumulative chunk sizes.</param>
        /// <param name="transform">The transform applied to all chunks.</param>
        /// <returns>A list of chunks.</returns>
        public static List <NefsDataChunk> CreateChunkList(
            IReadOnlyList <UInt32> cumulativeSizes,
            NefsDataTransform transform)
        {
            var chunks = new List <NefsDataChunk>();

            for (var i = 0; i < cumulativeSizes.Count; ++i)
            {
                var size = cumulativeSizes[i];

                // Get individual size by subtracting previous cumulative size
                if (i > 0)
                {
                    size -= cumulativeSizes[i - 1];
                }

                var chunk = new NefsDataChunk(size, cumulativeSizes[i], transform);
                chunks.Add(chunk);
            }

            return(chunks);
        }
Пример #2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="NefsDataChunk"/> class.
 /// </summary>
 /// <param name="size">The size of the data chunk.</param>
 /// <param name="cumulativeSize">The cumulative size of the data chunk.</param>
 /// <param name="transform">The transform that has been applied to this chunk.</param>
 public NefsDataChunk(UInt32 size, UInt32 cumulativeSize, NefsDataTransform transform)
 {
     this.Size           = size;
     this.CumulativeSize = cumulativeSize;
     this.Transform      = transform ?? throw new ArgumentNullException(nameof(transform));
 }