/// <summary>
        /// Checks that templates are valid for blocks.
        /// </summary>
        /// <param name="blockTemplateTable">Table of templates.</param>
        /// <param name="nodeTemplateTable">Table of templates with all frames.</param>
        public virtual bool IsBlockValid(FrameTemplateReadOnlyDictionary blockTemplateTable, FrameTemplateReadOnlyDictionary nodeTemplateTable)
        {
            Contract.RequireNotNull(blockTemplateTable, out FrameTemplateReadOnlyDictionary BlockTemplateTable);
            Contract.RequireNotNull(nodeTemplateTable, out FrameTemplateReadOnlyDictionary NodeTemplateTable);

            IList <Type> BlockKeys = NodeHelper.GetNodeKeys();

            FrameTemplateDictionary DefaultDictionary = CreateEmptyTemplateDictionary();

            foreach (Type Key in BlockKeys)
            {
                AddBlockNodeTypes(DefaultDictionary, Key);
            }

            bool IsValid = true;

            foreach (KeyValuePair <Type, IFrameTemplate> Entry in DefaultDictionary)
            {
                IsValid &= BlockTemplateTable.ContainsKey(Entry.Key);
            }

            foreach (KeyValuePair <Type, IFrameTemplate> Entry in BlockTemplateTable)
            {
                Type           NodeType          = Entry.Key;
                IFrameTemplate Template          = Entry.Value;
                int            CommentFrameCount = 0;

                IsValid &= NodeTreeHelper.IsBlockInterfaceType(NodeType);
                IsValid &= Template.IsValid;
                IsValid &= Template.Root.IsValid(NodeType, NodeTemplateTable, ref CommentFrameCount);
            }

            Debug.Assert(IsValid);
            return(IsValid);
        }
 /// <summary>
 /// Creates a IxxxTemplateSet object.
 /// </summary>
 private protected virtual IFrameTemplateSet CreateDefaultTemplateSet(FrameTemplateReadOnlyDictionary nodeTemplateTable, FrameTemplateReadOnlyDictionary blockTemplateTable)
 {
     ControllerTools.AssertNoOverride(this, Type.FromTypeof <FrameTemplateSet>());
     return(new FrameTemplateSet(nodeTemplateTable, blockTemplateTable));
 }
Ejemplo n.º 3
0
 public bool IsValid(Type nodeType, FrameTemplateReadOnlyDictionary nodeTemplateTable, ref int commentFrameCount)
 {
     return(false);
 }