예제 #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));
        }
예제 #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);
        }
예제 #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();
            }
        }
예제 #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));
        }
예제 #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);
        }
예제 #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);
            }
        }
예제 #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]);
        }
예제 #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);
        }
예제 #9
0
 /// <summary>
 /// Execute the task.
 /// </summary>
 protected override void ExecuteTask()
 {
     _list = ListManager.GetList(ListName);
 }