Example #1
0
        public static IList <string> GetCommandList(MenuResource resource)
        {
            List <string>  commands = new List <string>();
            CommandVisitor visitor  = new CommandVisitor(commands);

            visitor.Visit(resource.Menu);
            return(commands);
        }
Example #2
0
        internal bool RenderCommand(HScriptParser.CommandContext Context, CommandVisitor Processor)
        {

            // Consume //
            CommandPlan plan;
            try
            {
                plan = Processor.Visit(Context);
            }
            catch (HScriptCompileException hce)
            {
                this.Home.IO.Communicate(string.Format("Compile Error for statement {0}", this._CompileCount));
                this.Home.IO.Communicate(Context.GetText());
                this.Home.IO.Communicate(hce.Message);
                return false;
            }

            // Add the header to the plan buffer //
            if (!this.Home.SupressIO)
                this.Home.IO.Communicate();

            // Execute //
            try
            {
                plan.Execute();
            }
            catch (HorseDataException hde)
            {

                this.Home.IO.Communicate(string.Format("Compile Error for statement {0}", this._CompileCount));
                this.Home.IO.Communicate(hde.Message);
                return false;

            }

            // Communicate //
            if (!this.Home.SupressIO)
            {

                // Append the write stack //
                this.Home.IO.Communicate(plan.MessageText());

                // Dump the buffer //
                this.Home.IO.FlushStringBuffer();
                this.Home.IO.FlushRecordBuffer();

            }

            return true;

        }