internal void RemoveEntry(int index) { if (RefIList.IsFixedSize) { if (this.FallbackType.IsArray) { var array = Value as Array; Resize(ref array, RefIList.Count - 1, index); Value = array; RefIList = Value as IList; } else { SL.LogWarning("Cannot remove from this type: " + FallbackType.GetType()); return; } } else { RefIList.RemoveAt(index); } ApplyFromRefIList(); }
internal void AddEntry() { if (m_typeToAdd == null) { SL.LogWarning("No type selected!"); return; } if (RefIList == null) { SL.LogWarning("Cannot add to " + this.Value.GetType()); return; } object newValue = At.TryCreateDefault(m_typeToAdd); if (RefIList.IsFixedSize) { if (this.FallbackType.IsArray) { var array = Value as Array; Resize(ref array, RefIList.Count + 1, -1); Value = array; RefIList = Value as IList; RefIList[RefIList.Count - 1] = newValue; } else { SL.LogWarning("Cannot add to this type: " + FallbackType.GetType()); return; } } else { RefIList.Add(newValue); } ApplyFromRefIList(); }
/// <summary> /// Declares a method as a failed command handler based on <paramref name="type">the given type</paramref>. /// </summary> /// <param name="type">The type of <see cref="CommandParent.FailedCommand">failed command</see> event to handle</param> public CommandFallbackAttribute(FallbackType type) =>
/// <summary> /// Initializes a new instance of <see cref="FailedCommandEvent" />. /// </summary> /// <param name="context">The the root-level command that was used</param> /// <param name="commandName">The name of the command that was used</param> /// <param name="arguments">The array of string arguments that were given to the command</param> /// <param name="type">The type of the event that occurred</param> public FailedCommandEvent(RootCommandEvent context, string commandName, IEnumerable <string> arguments, FallbackType type) : base(context, commandName, arguments) =>