Beispiel #1
0
        public void Merge(CodeBlock mergeBlock)
        {
            bool AllBlank(String[] lines)
            {
                foreach (String line in lines)
                {
                    if (line.Trim().Length > 0)
                    {
                        return(false);
                    }
                }
                return(true);
            }

            CodeBlockNested mergeBlockNested = mergeBlock as CodeBlockNested;

            if (mergeBlockNested == null)
            {
                if (AllBlank(mergeBlock.AllLines()) == false)
                {
                    throw new Exception($"Base merge block must be of type MergeBlockNested");
                }
                return;
            }

            CodeBlockNested codeBlockNested = this.code.Blocks.Find(mergeBlockNested.Name);

            if (codeBlockNested == null)
            {
                throw new Exception($"Base code editor does not contain a top level block named {mergeBlockNested.Name}");
            }
            this.Merge(codeBlockNested, mergeBlockNested);
        }