/// <summary>Creates a SystemTag for the given input data.</summary> /// <param name="dat">The tag data.</param> /// <param name="input">The text input.</param> /// <returns>A valid SystemTag.</returns> public static SystemTag CreateFor(TemplateObject input, TagData dat) { return(input switch { SystemTag stag => stag, DynamicTag dtag => CreateFor(dtag.Internal, dat), _ => For(dat, input.ToString()), });
public static bool TryForeachCILNoDebug(CommandQueue queue, int entry_ind, DynamicTag listItem) { ForeachCommandData dat = queue.CurrentRunnable.EntryData[entry_ind] as ForeachCommandData; if (++dat.Index < dat.List.Count) { listItem.Internal = dat.List[dat.Index]; return(true); } return(false); }
public void UpdateTags() { autoGenerated.Clear(); List <Type> types = typeof(DynamicTag).Assembly.GetTypes().Where(type => type.IsSubclassOf(typeof(DynamicTag))).ToList(); foreach (Type type in types) { DynamicTag dynTag = (DynamicTag)Activator.CreateInstance(type); autoGenerated.Add(dynTag.ObtainTag()); } }
/// <summary>Executes the callback part of the foreach command.</summary> /// <param name="queue">The command queue involved.</param> /// <param name="entry">Entry to be executed.</param> /// <param name="listItem">Dynamic tag to hold the item in the list.</param> public static bool TryForeachCIL(CommandQueue queue, CommandEntry entry, DynamicTag listItem) { ForeachCommandData dat = queue.CurrentRunnable.EntryData[entry.BlockStart - 1] as ForeachCommandData; if (++dat.Index < dat.List.Count) { listItem.Internal = dat.List[dat.Index]; if (entry.ShouldShowGood(queue)) { entry.GoodOutput(queue, "Looping...: " + TextStyle.Separate + dat.Index + TextStyle.Base + "/" + TextStyle.Separate + dat.List.Count); } return(true); } if (entry.ShouldShowGood(queue)) { entry.GoodOutput(queue, "Foreach stopping."); } return(false); }
/// <summary>Executes the list input part of the foreached command.</summary> /// <param name="queue">The command queue involved.</param> /// <param name="entry">Entry to be executed.</param> /// <param name="listItem">Dynamic tag to hold the item in the list.</param> public static bool TryForeachNumberedCIL(CommandQueue queue, CommandEntry entry, DynamicTag listItem) { ListTag list = ListTag.CreateFor(entry.GetArgumentObject(queue, 1)); if (list.Internal.Count == 0) { if (entry.ShouldShowGood(queue)) { entry.GoodOutput(queue, "Not looping."); } return(false); } entry.SetData(queue, new ForeachCommandData() { Index = 0, List = list.Internal }); listItem.Internal = list.Internal[0]; if (entry.ShouldShowGood(queue)) { entry.GoodOutput(queue, "Looping " + TextStyle.Separate + list.Internal.Count + TextStyle.Base + " times..."); } return(true); }
/// <summary>Executes the list input part of the foreached command, without debug.</summary> /// <param name="queue">The command queue involved.</param> /// <param name="entry">Entry to be executed.</param> /// <param name="listItem">Dynamic tag to hold the item in the list.</param> public static bool TryForeachNumberedCIL_NoDebug(CommandQueue queue, CommandEntry entry, DynamicTag listItem) { ListTag list = ListTag.CreateFor(entry.GetArgumentObject(queue, 1)); if (list.Internal.Count == 0) { return(false); } entry.SetData(queue, new ForeachCommandData() { Index = 0, List = list.Internal }); listItem.Internal = list.Internal[0]; return(true); }
/// <summary>Handles the base input for a tag.</summary> /// <param name="data">The tag data.</param> /// <returns>The correct object.</returns> public static DynamicTag HandleOne(TagData data) { return(DynamicTag.CreateFor(data.GetModifierObjectCurrent(), data)); }