Пример #1
0
        /// <summary>
        /// Поиск свободных имен.
        /// </summary>
        public void SearchFreeNames(SearchFreeNamesParams searchParams)
        {
            for (var i = searchParams.CounterFrom; i <= searchParams.CounterTo; i++)
            {
                var name = searchParams.NameTemplate.Replace("[C]", i.ToString().PadLeft((int)searchParams.CounterLength, '0'));

                if (ExistsInDNS(name + "." + searchParams.Domain))
                {
                    continue;
                }

                if (ExistsInAD(name, searchParams.Domain))
                {
                    continue;
                }

                searchParams.Dispatcher.BeginInvoke(searchParams.Callback, name);
            }
        }
Пример #2
0
 /// <summary>
 /// Асинхронный поиск свободных имен.
 /// </summary>
 public Task SearchFreeNamesAsync(SearchFreeNamesParams searchParams)
 {
     return(Task.Factory.StartNew(() => SearchFreeNames(searchParams)));
 }