Exemple #1
0
        /// <summary>
        /// Run scripts through the "run" command.  Each element
        /// in the args list is a reference to either a script name
        /// or the command itself.  If an arg begins with the '@' symbol,
        /// it is the name of a scirpt otherwise, it;s a command
        /// </summary>
        /// <param name="args">argument list</param>
        /// <returns>true on success</returns>
        private bool run(List <String> args)
        {
            if (args.Count == 0)
            {
                return(false);
            }

            foreach (String scriptName in args)
            {
                if (scriptName[0] != '@')
                {
                    if (_scripts.ContainsKey(scriptName))
                    {
                        var pCode = (PCode)_scripts[scriptName];
                        if (pCode != null)
                        {
                            return(Execute(pCode));
                        }
                    }
                    else
                    {
                        EvtRun(this, new InterpreterRunEventArgs(scriptName));
                    }
                }
                else
                {
                    EvtRun(this, new InterpreterRunEventArgs(scriptName));
                }
            }

            return(true);
        }
Exemple #2
0
        /// <summary>
        /// Runs scripts through the "run" command.  Each element
        /// in the args list is a reference to either a script name
        /// or the command itself.  If an arg begins with the '@' symbol,
        /// it is the name of a scirpt otherwise, it;s a command
        /// </summary>
        /// <param name="args">argument list</param>
        /// <returns>true on success</returns>
        private bool run(List <String> args)
        {
            if (args.Count == 0)
            {
                return(false);
            }

            foreach (String scriptName in args)
            {
                if (scriptName[0] != '@')
                {
                    if (_scripts.ContainsKey(scriptName))
                    {
                        var pCode = (PCode)_scripts[scriptName];
                        if (pCode != null)
                        {
                            return(Execute(pCode));
                        }
                    }
                    else
                    {
                        EvtRun(this, new InterpreterRunEventArgs(scriptName));
                    }
                }
                else
                {
                    // first notify the hook subscribers.  If none of them handled it
                    // then invoke the event

                    bool handled = false;
                    notifyRunCommandHookSubscribers(new InterpreterRunEventArgs(scriptName), ref handled);

                    if (!handled)
                    {
                        EvtRun(this, new InterpreterRunEventArgs(scriptName));
                    }
                }
            }

            return(true);
        }