Ejemplo n.º 1
0
        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));
        }
Ejemplo n.º 2
0
        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);
        }
Ejemplo n.º 3
0
        /// <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();
            }
        }
Ejemplo n.º 4
0
        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));
        }
Ejemplo n.º 5
0
        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);
        }
Ejemplo n.º 6
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);
            }
        }
Ejemplo n.º 7
0
        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]);
        }
Ejemplo n.º 8
0
        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);
        }
Ejemplo n.º 9
0
 /// <summary>
 /// Execute the task.
 /// </summary>
 protected override void ExecuteTask()
 {
     _list = ListManager.GetList(ListName);
 }