Esempio n. 1
0
 /// <summary>
 /// Constructs the tag information container.
 /// </summary>
 /// <param name="_system">The command system to use.</param>
 /// <param name="_input">The input tag pieces.</param>
 /// <param name="_basecolor">The default color to use for output.</param>
 /// <param name="_vars">Any variables involved in the queue.</param>
 /// <param name="_mode">What debug mode to use.</param>
 public TagData(TagParser _system, List<string> _input, string _basecolor, Dictionary<string, TemplateObject> _vars, DebugMode _mode)
 {
     TagSystem = _system;
     Input = _input;
     BaseColor = _basecolor;
     Variables = _vars;
     mode = _mode;
     Modifiers = new List<string>();
     for (int x = 0; x < Input.Count; x++)
     {
         Input[x] = Input[x].Replace("&dot", ".").Replace("&amp", "&");
         if (Input[x].Length > 1 && Input[x].Contains('[') && Input[x][Input[x].Length - 1] == ']')
         {
             int index = Input[x].IndexOf('[');
             Modifiers.Add(Input[x].Substring(index + 1, Input[x].Length - (index + 2)));
             Input[x] = Input[x].Substring(0, index).ToLower();
         }
         else
         {
             Input[x] = Input[x].ToLower();
             Modifiers.Add("");
         }
     }
 }
Esempio n. 2
0
        /// <summary>
        /// Prepares the command system, registering all base commands.
        /// </summary>
        public void Init()
        {
            PlaceholderQueue = new CommandQueue(new CommandScript("PLACEHOLDER_QUEUE", new List<CommandEntry>()), new List<CommandEntry>(), this);
            RegisteredCommands = new Dictionary<string, AbstractCommand>(30);
            RegisteredCommandList = new List<AbstractCommand>(30);
            Scripts = new Dictionary<string, CommandScript>(30);
            Functions = new Dictionary<string, CommandScript>(30);
            Events = new Dictionary<string, ScriptEvent>(30);
            Queues = new List<CommandQueue>(20);
            TagSystem = new TagParser();
            TagSystem.Init(this);

            // Common Commands
            RegisterCommand(new CleanmemCommand());
            RegisterCommand(new CvarinfoCommand());
            RegisterCommand(new EchoCommand());
            RegisterCommand(new NoopCommand());
            RegisterCommand(new SetCommand());
            RegisterCommand(new ToggleCommand());

            // Queue-related Commands
            RegisterCommand(new BreakCommand());
            RegisterCommand(new CallCommand());
            RegisterCommand(new DebugCommand());
            RegisterCommand(new DefineCommand());
            RegisterCommand(new DetermineCommand());
            RegisterCommand(new ElseCommand());
            RegisterCommand(new EventCommand());
            RegisterCommand(new ForeachCommand());
            RegisterCommand(new FunctionCommand());
            RegisterCommand(new GotoCommand());
            RegisterCommand(new IfCommand());
            RegisterCommand(new InsertCommand());
            RegisterCommand(new MarkCommand());
            RegisterCommand(new ParsingCommand());
            RegisterCommand(new RepeatCommand());
            RegisterCommand(TheRunCommand = new RunCommand());
            RegisterCommand(new ScriptCacheCommand());
            RegisterCommand(new StopCommand());
            RegisterCommand(new UndefineCommand());
            RegisterCommand(new WaitCommand());
            RegisterCommand(new WhileCommand());

            // Register debug command
            RegisterCommand(DebugInvalidCommand = new DebugOutputInvalidCommand());

            // Command-Related Events
            RegisterEvent(new ScriptRanPreScriptEvent(this));
            RegisterEvent(new ScriptRanScriptEvent(this));
            RegisterEvent(new ScriptRanPostScriptEvent(this));
        }