Пример #1
0
 public DirectorySearcherImpl(DirectoryEntryImpl directoryEntry, string filter, ArrayImpl propsToLoad, SearchScopeImpl searchScope)
 {
     _directorySearcher = new DirectorySearcher(directoryEntry._directoryEntry, filter, propsToLoad.Select(p => p.AsString()).ToArray(), SearchScopeConverter.ToSearchScope(searchScope));
     SearchRoot         = directoryEntry;
     PropertiesToLoad   = propsToLoad;
     SearchScope        = searchScope;
 }
Пример #2
0
        /// <summary>
        /// Конвертирует значение Oscript в значение C#
        /// </summary>
        /// <param name="searchScope"></param>
        /// <returns></returns>
        public static SearchScope ToSearchScope(SearchScopeImpl searchScope)
        {
            switch (searchScope)
            {
            case SearchScopeImpl.Base:
                return(SearchScope.Base);

            case SearchScopeImpl.OneLevel:
                return(SearchScope.OneLevel);

            case SearchScopeImpl.Subtree:
                return(SearchScope.Subtree);

            default:
                throw RuntimeException.InvalidArgumentType();
            }
        }
Пример #3
0
        public static DirectorySearcherImpl Constructor(IValue searchRoot = null, string filter = "(objectClass=*)", IValue propertiesToLoad = null, SearchScopeImpl searchScope = SearchScopeImpl.Subtree)
        {
            DirectoryEntryImpl dirEntry    = null;
            ArrayImpl          propsToLoad = new ArrayImpl();

            if (searchRoot?.GetRawValue() is DirectoryEntryImpl val_de)
            {
                dirEntry = val_de;
            }
            else if (searchRoot != null)
            {
                throw RuntimeException.InvalidArgumentType();
            }

            if (propertiesToLoad?.GetRawValue() is ArrayImpl val_ptl)
            {
                propsToLoad = val_ptl;
            }
            else if (propertiesToLoad != null)
            {
                throw RuntimeException.InvalidArgumentType();
            }

            var dirseacrh = new DirectorySearcherImpl(dirEntry, filter, propsToLoad, searchScope);

            return(dirseacrh);
        }