Example #1
0
        public Block CreateBlock(Memento storage)
        {
            Block b = InstantiateBlock(storage);

            if (b == null)
            {
                return(null);
            }
            b.ReadFromMemento(storage);

            if (storage.Children.Count != 0)
            {
                if (b.Root != null)
                {
                    using (b.Transaction())
                    {
                        b.AddChildren(CreateChildren(storage));
                    }
                }
                else
                {
                    b.AddChildren(CreateChildren(storage));
                }
            }
            return(b);
        }