Beispiel #1
0
        /// <summary>
        /// Add a codeblock to the end of the current block
        /// </summary>
        /// <param name="theBlock">The program we want to append data to</param>
        /// <param name="blk">the block to add</param>
        /// <returns>Reference to the given program</returns>
        public static ProgramBlock operator +(ProgramBlock theProg, CodeBlock blk)
        {
            // If the given program is illegal - go to hell
            if (theProg == null)
            {
                throw new PanicException();
            }

            // else, if the given program is empty, lets create an empty block, starting at 0. Default Behavior
            if (theProg._theProgram.Count == 0)
            {
                theProg.AddBlock(new CodeBlock(), 0, 0);
            }

            // Add the new block to the end of the last block.
            BlockContainer tmp = (BlockContainer)theProg._theProgram[theProg._theProgram.Count - 1];

            tmp.Append(blk);

            return(theProg);
        }