Esempio n. 1
0
        /// <summary>
        /// Gets a nest from the nests list by name
        /// </summary>
        /// <param name="nestsList"></param>
        /// <param name="nestName"></param>
        /// <returns></returns>
        public static ISNNestObj GetByName(this ISNNestsList nestsList, string nestName)
        {
            nestsList.Reset();

            while (!nestsList.EndOfList)
            {
                var nest = nestsList.Current;

                if (nest.ProgramName.Equals(nestName, StringComparison.InvariantCultureIgnoreCase))
                {
                    return(nest);
                }

                nestsList.MoveNext();
            }
            return(null);
        }
Esempio n. 2
0
        /// <summary>
        /// Removes a nest from the nests list by name
        /// </summary>
        /// <param name="nestsList"></param>
        /// <param name="nestName"></param>
        /// <returns></returns>
        public static bool RemoveByName(this ISNNestsList nestsList, string nestName)
        {
            nestsList.Reset();

            while (!nestsList.EndOfList)
            {
                var nest = nestsList.Current;

                if (nest.ProgramName.Equals(nestName, StringComparison.InvariantCultureIgnoreCase))
                {
                    nestsList.Remove();
                    return(true);
                }

                nestsList.MoveNext();
            }
            return(false);
        }