/// <summary>
        /// Create a new Block model from raw memory card data
        /// </summary>
        /// <param name="data">An 8192-length byte array</param>
        /// <returns></returns>
        public static Block Parse(byte[] data)
        {
            Block parsedBlock = null;

            try
            {
                parsedBlock = new Block();

                // Sanity checks
                Contract.Requires<ArgumentNullException>(data != null);
                Contract.Requires<ArgumentException>(data.Length == Constants.BlockLength);

                int frameBytesOffset = 0;

                parsedBlock.IsLinkBlock = !HasMagicValues(data.SubArray(0, 2));
                parsedBlock.BlocksUsed = ParseBlocksUsed(data[3]);
                parsedBlock.Title = ParseSaveTitle(data.SubArray(4, 64));

                if (!parsedBlock.IsLinkBlock)
                {
                    parsedBlock.IconFrames = ParseIconFrameCount(data[2]);
                }

                if (parsedBlock.IconFrames > 0 && !parsedBlock.IsLinkBlock)
                {
                    parsedBlock.Icon = new BlockIcon();
                    parsedBlock.Icon.Colors.AddRange(ParseColorData(data.SubArray(96, 32)));
                    parsedBlock.Icon.Frames.AddRange(ParseIconFrameData(data.SubArray(128, 128 * parsedBlock.IconFrames)));

                    frameBytesOffset = 128 * parsedBlock.IconFrames;
                }

                parsedBlock.SaveData = data.SubArray(128 + frameBytesOffset, (int)Constants.BlockLength - 128 - frameBytesOffset);
            }
            catch (ArgumentException ex)
            {
                Console.WriteLine("Invalid raw block data passed to parser.");
                Console.WriteLine(ex.Message);
                throw ex;
            }
            catch (Exception ex)
            {
                Console.WriteLine("Error in parsing raw block data.");
                Console.WriteLine(ex.Message);
                throw ex;
            }

            return parsedBlock;
        }
 private string FormatBlockTitle(Block b)
 {
     if (b.IsLinkBlock)
     {
         return "Link block of block #" + _memoryCard.Blocks.IndexOf(b);
     }
     else
     {
         return b.Title;
     }
 }