public static bool Exists(string listName) { #region Preconditions if (String.IsNullOrEmpty(listName)) { throw new ArgumentException("listName cannot be null or empty"); } #endregion return(ListManager.ListExists(listName)); }
public static int Count(string listName) { #region Preconditions if (String.IsNullOrEmpty(listName)) { throw new ArgumentException("listName cannot be null or empty"); } #endregion return(ListManager.GetList(listName).Count); }
/// <summary> /// Execute the task. /// </summary> protected override void ExecuteTask() { IList <string> list = ListManager.GetList(ListName); foreach (string val in list) { if (ValueProperty != null) { NAntUtility.AddOrOverwriteProperty(Project, ValueProperty, val); } // Base execute handles executing all child tasks. base.ExecuteTask(); } }
public static bool Contains(string listName, string val) { #region Preconditions if (String.IsNullOrEmpty(listName)) { throw new ArgumentException("listName cannot be null or empty"); } if (String.IsNullOrEmpty(val)) { throw new ArgumentException("val cannot be null or empty"); } #endregion return(ListManager.GetList(listName).Contains(val)); }
public static bool IsEmpty(string listName) { #region Preconditions if (String.IsNullOrEmpty(listName)) { throw new ArgumentException("listName cannot be null or empty"); } #endregion if (!ListManager.ListExists(listName)) { return(true); } return(ListManager.GetList(listName).Count == 0); }
/// <summary> /// Execute the task. /// </summary> protected override void ExecuteTask() { base.ExecuteTask(); if (ListManager.ListExists(NewListName)) { throw new BuildException(string.Format("List with name [{0}] already exists.", NewListName)); } IList <string> newList = ListManager.GetList(NewListName); foreach (string val in List) { newList.Add(val); } }
public static string GetValue(string listName, int position) { #region Preconditions if (String.IsNullOrEmpty(listName)) { throw new ArgumentException("listName cannot be null or empty"); } #endregion IList <string> list = ListManager.GetList(listName); if (position < 0 || position >= list.Count) { throw new BuildException(string.Format("List [{0}] does not have a position [{1}]", list, position)); } return((string)list[position]); }
public static string Shift(string listName) { #region Preconditions if (String.IsNullOrEmpty(listName)) { throw new ArgumentException("listName cannot be null or empty"); } #endregion IList <string> list = ListManager.GetList(listName); if (ListFunctions.IsEmpty(listName)) { throw new BuildException(string.Format("List [{0}] is empty", listName)); } string itemVal = list[0]; list.RemoveAt(0); return(itemVal); }
/// <summary> /// Execute the task. /// </summary> protected override void ExecuteTask() { _list = ListManager.GetList(ListName); }