Exemple #1
0
        public static BlockMetadata ToMetadata(this IBlock block)
        {
            if (block == null) throw new ArgumentNullException(nameof(block));

            var blockMetadata = new BlockMetadata()
            {
                Id = block.Id,
                Data = block.GetData(),
                Elements = block.Elements.ToMetadata(),
                Parameters = block.Parameters.ToMetadata()
            };

            return blockMetadata;
        }
Exemple #2
0
        private static void FixBlock(BlockMetadata blockMetadata)
        {
            if (blockMetadata == null) throw new ArgumentNullException(nameof(blockMetadata));

            if (blockMetadata.Next != null)
            {
                //Convert to a list
                blockMetadata.Elements = EnumerateElementsWhileFixingBlocks(blockMetadata.Next)
                    .ToArray();

                //Ditch the next pointer
                blockMetadata.Next = null;
            }
        }