/// <summary>Executes the command via CIL.</summary> /// <param name="queue">The command queue involved.</param> /// <param name="entry">Entry to be executed.</param> public static bool TryIfCIL(CommandQueue queue, CommandEntry entry) { entry.SetData(queue, new IfCommandData() { Result = 0 }); bool success = TryIf(queue, entry, new List <Argument>(entry.Arguments)); if (success) { if (entry.ShouldShowGood(queue)) { entry.GoodOutput(queue, "If is true, executing..."); } ((IfCommandData)entry.GetData(queue)).Result = 1; } else { if (entry.ShouldShowGood(queue)) { entry.GoodOutput(queue, "If is false, doing nothing!"); } } return(success); }
/// <summary>Executes the command.</summary> /// <param name="queue">The command queue involved.</param> /// <param name="entry">Entry to be executed.</param> public static void Execute(CommandQueue queue, CommandEntry entry) { if (entry.ShouldShowGood(queue)) { entry.GoodOutput(queue, "Reloading..."); } queue.Engine.Reload(); if (entry.ShouldShowGood(queue)) { entry.GoodOutput(queue, "Reloaded!"); } }
/// <summary>Helper to output debug message informing of debug mode change.</summary> /// <param name="queue">The relevant queue.</param> /// <param name="entry">The relevant entry.</param> public static void DebugOutput(CommandQueue queue, CommandEntry entry) { if (entry.ShouldShowGood(queue)) { entry.GoodOutput(queue, "Debug mode set to " + TextStyle.Separate + entry.DBMode + TextStyle.Outgood + "."); } }
/// <summary>Executes the command.</summary> /// <param name="queue">The command queue involved.</param> /// <param name="entry">Entry to be executed.</param> public static void Execute(CommandQueue queue, CommandEntry entry) { if (entry.IsCallback) { if (entry.ShouldShowGood(queue)) { entry.GoodOutput(queue, "Block completed successfully!"); } } else { if (entry.ShouldShowGood(queue)) { entry.GoodOutput(queue, "Trying block..."); } } }
/// <summary>Helps debug output for the var command.</summary> /// <param name="res">The object saved as a var.</param> /// <param name="varName">The variable name stored into.</param> /// <param name="typeName">The variable type name.</param> /// <param name="queue">The queue.</param> /// <param name="entry">The entry.</param> public static void DebugHelper(TemplateObject res, string varName, string typeName, CommandQueue queue, CommandEntry entry) { if (entry.ShouldShowGood(queue)) { entry.GoodOutput(queue, "Stored variable '" + TextStyle.Separate + varName + TextStyle.Base + "' with value: '" + TextStyle.Separate + res.GetDebugString() + TextStyle.Base + "' as type: '" + TextStyle.Separate + typeName + TextStyle.Base + "'."); } }
/// <summary>Executes the command.</summary> /// <param name="queue">The command queue involved.</param> /// <param name="entry">Entry to be executed.</param> public static void Execute(CommandQueue queue, CommandEntry entry) { TemplateObject arg1 = entry.GetArgumentObject(queue, 0); BooleanTag bt = BooleanTag.TryFor(arg1); if (bt == null || !bt.Internal) { queue.HandleError(entry, "Assertion failed: " + entry.GetArgument(queue, 1)); return; } entry.GoodOutput(queue, "Assert command passed, assertion valid!"); }