Пример #1
0
        internal CFStream(CompoundFile sectorManager, IDirectoryEntry dirEntry)
            : base(sectorManager)
        {
            if (dirEntry == null || dirEntry.SID < 0)
                throw new CFException("Attempting to add a CFStream using an unitialized directory");

            DirEntry = dirEntry;
        }
 /// <summary>
 /// 
 /// </summary>
 /// <param name="directoryEntry">
 /// </param>
 /// <param name="sizeLimit">
 /// </param>
 /// <param name="pageSize">
 /// </param>
 public DirectorySearcherWrap(IDirectoryEntry directoryEntry,
                              int sizeLimit,
                              int? pageSize)
 {
     this.directorySearcher = new DirectorySearcher(directoryEntry.GetDirectoryEntry())
                                  {
                                      SizeLimit = sizeLimit,
                                  };
     if (pageSize.HasValue)
     {
         this.directorySearcher.PageSize = pageSize.Value;
     }
 }
Пример #3
0
        /// <summary>
        /// Get a named storage contained in the current one if existing.
        /// </summary>
        /// <param name="storageName">Name of the storage to look for</param>
        /// <returns>A storage reference if existing.</returns>
        /// <exception cref="T:Workshell.OpenMcdf.CFDisposedException">Raised if trying to delete item from a closed compound file</exception>
        /// <exception cref="T:Workshell.OpenMcdf.CFItemNotFound">Raised if item to delete is not found</exception>
        /// <example>
        /// <code>
        ///
        /// String FILENAME = "MultipleStorage2.cfs";
        /// CompoundFile cf = new CompoundFile(FILENAME, UpdateMode.ReadOnly, false, false);
        ///
        /// CFStorage st = cf.RootStorage.GetStorage("MyStorage");
        ///
        /// Assert.IsNotNull(st);
        /// cf.Close();
        /// </code>
        /// </example>
        public CFStorage GetStorage(String storageName)
        {
            CheckDisposed();

            IDirectoryEntry template = DirectoryEntry.Mock(storageName, StgType.StgInvalid);
            IRBNode         outDe    = null;

            if (Children.TryLookup(template, out outDe) && ((IDirectoryEntry)outDe).StgType == StgType.StgStorage)
            {
                return(new CFStorage(this.CompoundFile, outDe as IDirectoryEntry));
            }
            else
            {
                throw new CFItemNotFound("Cannot find item [" + storageName + "] within the current storage");
            }
        }
Пример #4
0
        public CFStorage TryGetStorage(String storageName)
        {
            CheckDisposed();

            IDirectoryEntry template = DirectoryEntry.Mock(storageName, StgType.StgInvalid);
            IRBNode         outDe    = null;

            if (Children.TryLookup(template, out outDe) && ((IDirectoryEntry)outDe).StgType == StgType.StgStorage)
            {
                return(new CFStorage(this.CompoundFile, outDe as IDirectoryEntry));
            }
            else
            {
                return(null);
            }
        }
Пример #5
0
 private void AddDirEntries(BlockDirectoryData[] entries, Dictionary <string, DirEntry> target)
 {
     foreach (var entry in entries)
     {
         IDirectoryEntry dirEntry = entry as IDirectoryEntry;
         if (dirEntry == null)
         {
             continue;
         }
         var name = Context.Options.FileNameEncoding.GetString(dirEntry.Name);
         if (name == "." || name == "..")
         {
             continue;
         }
         target.Add(name, new DirEntry(dirEntry, Context));
     }
 }
Пример #6
0
        private IFabricPrincipal CreateUserPrincipal(IDirectoryEntry userEntry)
        {
            var subjectId = GetSubjectId(userEntry.SamAccountName);
            var principal = new FabricPrincipal
            {
                SubjectId        = subjectId,
                DisplayName      = $"{userEntry.FirstName} {userEntry.LastName}",
                FirstName        = userEntry.FirstName,
                LastName         = userEntry.LastName,
                MiddleName       = userEntry.MiddleName,
                IdentityProvider = IdentityProviders.ActiveDirectory,
                PrincipalType    = PrincipalType.User,
                IdentityProviderUserPrincipalName = subjectId
            };

            principal.DisplayName = $"{principal.FirstName} {principal.LastName}";
            return(principal);
        }
Пример #7
0
        /// <summary>
        /// Visit all entities contained in the storage applying a user provided action
        /// </summary>
        /// <exception cref="T:OpenMcdf.CFDisposedException">Raised when visiting items of a closed compound file</exception>
        /// <param name="action">User <see cref="T:OpenMcdf.VisitedEntryAction">action</see> to apply to visited entities</param>
        /// <param name="recursive"> Visiting recursion level. True means substorages are visited recursively, false indicates that only the direct children of this storage are visited</param>
        /// <example>
        /// <code>
        /// const String STORAGE_NAME = "report.xls";
        /// CompoundFile cf = new CompoundFile(STORAGE_NAME);
        ///
        /// FileStream output = new FileStream("LogEntries.txt", FileMode.Create);
        /// TextWriter tw = new StreamWriter(output);
        ///
        /// VisitedEntryAction va = delegate(CFItem item)
        /// {
        ///     tw.WriteLine(item.Name);
        /// };
        ///
        /// cf.RootStorage.VisitEntries(va, true);
        ///
        /// tw.Close();
        /// </code>
        /// </example>
        public void VisitEntries(Action <ReadonlyCompoundFileItem> action, bool recursive)
        {
            CheckDisposed();

            if (action == null)
            {
                return;
            }

            List <IRBNode> subStorages
                = new List <IRBNode>();

            void InternalAction(IRBNode targetNode)
            {
                IDirectoryEntry d = targetNode as IDirectoryEntry;

                if (d.StgType == StgType.StgStream)
                {
                    action(new ReadonlyCompoundFileStream(this.CompoundFile, d));
                }
                else
                {
                    action(new ReadonlyCompoundFileStorage(this.CompoundFile, d));
                }

                if (d.Child != DirectoryEntry.NOSTREAM)
                {
                    subStorages.Add(targetNode);
                }

                return;
            }

            this.Children.VisitTreeNodes(InternalAction);

            if (recursive && subStorages.Count > 0)
            {
                foreach (IRBNode n in subStorages)
                {
                    IDirectoryEntry d = n as IDirectoryEntry;
                    (new ReadonlyCompoundFileStorage(this.CompoundFile, d)).VisitEntries(action, recursive);
                }
            }
        }
Пример #8
0
        public int CompareTo(object obj)
        {
            IDirectoryEntry otherDir = obj as IDirectoryEntry;

            if (otherDir == null)
            {
                throw new CFException("Invalid casting: compared object does not implement IDirectorEntry interface");
            }

            if (this.NameLength > otherDir.NameLength)
            {
                return(THIS_IS_GREATER);
            }
            else if (this.NameLength < otherDir.NameLength)
            {
                return(OTHER_IS_GREATER);
            }
            else
            {
                String thisName  = Encoding.Unicode.GetString(this.EntryName, 0, this.NameLength);
                String otherName = Encoding.Unicode.GetString(otherDir.EntryName, 0, otherDir.NameLength);

                for (int z = 0; z < thisName.Length; z++)
                {
                    char thisChar  = char.ToUpperInvariant(thisName[z]);
                    char otherChar = char.ToUpperInvariant(otherName[z]);

                    if (thisChar > otherChar)
                    {
                        return(THIS_IS_GREATER);
                    }
                    else if (thisChar < otherChar)
                    {
                        return(OTHER_IS_GREATER);
                    }
                }

                return(0);
            }

            //   return String.Compare(Encoding.Unicode.GetString(this.EntryName).ToUpper(), Encoding.Unicode.GetString(other.EntryName).ToUpper());
        }
Пример #9
0
        public CFStream TryGetStream(String streamName)
        {
            CheckDisposed();

            IDirectoryEntry tmp = DirectoryEntry.Mock(streamName, StgType.StgStream);

            //if (children == null)
            //{
            //    children = compoundFile.GetChildrenTree(SID);
            //}

            if (Children.TryLookup(tmp, out IRBNode outDe) && (((IDirectoryEntry)outDe).StgType == StgType.StgStream))
            {
                return(new CFStream(this.CompoundFile, (IDirectoryEntry)outDe));
            }
            else
            {
                return(null);
            }
        }
Пример #10
0
        /// <summary>
        /// Get a named <see cref="T:OpenMcdf.CFStream">stream</see> contained in the current storage if existing.
        /// </summary>
        /// <param name="streamName">Name of the stream to look for</param>
        /// <returns>A stream reference if existing</returns>
        /// <exception cref="T:OpenMcdf.CFDisposedException">Raised if trying to delete item from a closed compound file</exception>
        /// <exception cref="T:OpenMcdf.CFItemNotFound">Raised if item to delete is not found</exception>
        /// <example>
        /// <code>
        /// String filename = "report.xls";
        ///
        /// CompoundFile cf = new CompoundFile(filename);
        /// CFStream foundStream = cf.RootStorage.GetStream("Workbook");
        ///
        /// byte[] temp = foundStream.GetData();
        ///
        /// Assert.IsNotNull(temp);
        ///
        /// cf.Close();
        /// </code>
        /// </example>
        public CFStream GetStream(String streamName)
        {
            CheckDisposed();

            IDirectoryEntry tmp = DirectoryEntry.Mock(streamName, StgType.StgStream);

            //if (children == null)
            //{
            //    children = compoundFile.GetChildrenTree(SID);
            //}

            if (Children.TryLookup(tmp, out IRBNode outDe) && (((IDirectoryEntry)outDe).StgType == StgType.StgStream))
            {
                return(new CFStream(this.CompoundFile, (IDirectoryEntry)outDe));
            }
            else
            {
                throw new CFItemNotFound("Cannot find item [" + streamName + "] within the current storage");
            }
        }
Пример #11
0
        public int CompareTo(object obj)
        {
            const int       THIS_IS_GREATER  = 1;
            const int       OTHER_IS_GREATER = -1;
            IDirectoryEntry otherDir         = obj as IDirectoryEntry;

            if (otherDir == null)
            {
                throw new CFException("Invalid casting: compared object does not implement IDirectorEntry interface");
            }

            if (this.NameLength > otherDir.NameLength)
            {
                return(THIS_IS_GREATER);
            }
            else if (this.NameLength < otherDir.NameLength)
            {
                return(OTHER_IS_GREATER);
            }
            else
            {
                String thisName  = Encoding.Unicode.GetString(this.EntryName, 0, this.NameLength).ToUpper(CultureInfo.InvariantCulture);
                String otherName = Encoding.Unicode.GetString(otherDir.EntryName, 0, otherDir.NameLength).ToUpper(CultureInfo.InvariantCulture);

                for (int z = 0; z < thisName.Length; z++)
                {
                    if (BitConverter.ToInt16(BitConverter.GetBytes(thisName[z]), 0) > BitConverter.ToInt16(BitConverter.GetBytes(otherName[z]), 0))
                    {
                        return(THIS_IS_GREATER);
                    }
                    else if (BitConverter.ToInt16(BitConverter.GetBytes(thisName[z]), 0) < BitConverter.ToInt16(BitConverter.GetBytes(otherName[z]), 0))
                    {
                        return(OTHER_IS_GREATER);
                    }
                }

                return(0);
            }

            //   return String.Compare(Encoding.Unicode.GetString(this.EntryName).ToUpper(), Encoding.Unicode.GetString(other.EntryName).ToUpper());
        }
Пример #12
0
        /// <summary>
        /// Rename a Stream or Storage item in the current storage
        /// </summary>
        /// <param name="oldItemName">The item old name to lookup</param>
        /// <param name="newItemName">The new name to assign</param>
        public void RenameItem(string oldItemName, string newItemName)
        {
            IDirectoryEntry template = DirectoryEntry.Mock(oldItemName, StgType.StgInvalid);
            IRBNode         item;

            if (Children.TryLookup(template, out item))
            {
                ((DirectoryEntry)item).SetEntryName(newItemName);
            }
            else
            {
                throw new CFItemNotFound("Item " + oldItemName + " not found in Storage");
            }

            children = null;
            children = LoadChildren(this.DirEntry.SID); //Rethread

            if (children == null)
            {
                children = this.CompoundFile.CreateNewTree();
            }
        }
Пример #13
0
 protected override void InstantiateMocks()
 {
     base.InstantiateMocks();
     this.InjectedDirectoryEntry = new DirectoryEntryWrap("GC://liebherr.i");
 }
Пример #14
0
        /// <summary>
        /// Remove an entry from the current storage and compound file.
        /// </summary>
        /// <param name="entryName">The name of the entry in the current storage to delete</param>
        /// <example>
        /// <code>
        /// cf = new CompoundFile("A_FILE_YOU_CAN_CHANGE.cfs", UpdateMode.Update, true, false);
        /// cf.RootStorage.Delete("AStream"); // AStream item is assumed to exist.
        /// cf.Commit(true);
        /// cf.Close();
        /// </code>
        /// </example>
        /// <exception cref="T:OpenMcdf.CFDisposedException">Raised if trying to delete item from a closed compound file</exception>
        /// <exception cref="T:OpenMcdf.CFItemNotFound">Raised if item to delete is not found</exception>
        /// <exception cref="T:OpenMcdf.CFException">Raised if trying to delete root storage</exception>
        public void Delete(String entryName)
        {
            CheckDisposed();

            // Find entry to delete
            IDirectoryEntry tmp = DirectoryEntry.Mock(entryName, StgType.StgInvalid);

            IRBNode foundObj = null;

            this.Children.TryLookup(tmp, out foundObj);

            if (foundObj == null)
            {
                throw new CFItemNotFound("Entry named [" + entryName + "] was not found");
            }

            //if (foundObj.GetType() != typeCheck)
            //    throw new CFException("Entry named [" + entryName + "] has not the correct type");

            if (((IDirectoryEntry)foundObj).StgType == StgType.StgRoot)
            {
                throw new CFException("Root storage cannot be removed");
            }


            IRBNode altDel = null;

            switch (((IDirectoryEntry)foundObj).StgType)
            {
            case StgType.StgStorage:

                CFStorage temp = new CFStorage(this.CompoundFile, ((IDirectoryEntry)foundObj));

                // This is a storage. we have to remove children items first
                foreach (IRBNode de in temp.Children)
                {
                    IDirectoryEntry ded = de as IDirectoryEntry;
                    temp.Delete(ded.Name);
                }



                // ...then we need to rethread the root of siblings tree...
                if (this.Children.Root != null)
                {
                    this.DirEntry.Child = (this.Children.Root as IDirectoryEntry).SID;
                }
                else
                {
                    this.DirEntry.Child = DirectoryEntry.NOSTREAM;
                }

                // ...and finally Remove storage item from children tree...
                this.Children.Delete(foundObj, out altDel);

                // ...and remove directory (storage) entry

                if (altDel != null)
                {
                    foundObj = altDel;
                }

                this.CompoundFile.InvalidateDirectoryEntry(((IDirectoryEntry)foundObj).SID);

                break;

            case StgType.StgStream:

                // Free directory associated data stream.
                CompoundFile.FreeAssociatedData((foundObj as IDirectoryEntry).SID);

                // Remove item from children tree
                this.Children.Delete(foundObj, out altDel);

                // Rethread the root of siblings tree...
                if (this.Children.Root != null)
                {
                    this.DirEntry.Child = (this.Children.Root as IDirectoryEntry).SID;
                }
                else
                {
                    this.DirEntry.Child = DirectoryEntry.NOSTREAM;
                }

                // Delete operation could possibly have cloned a directory, changing its SID.
                // Invalidate the ACTUALLY deleted directory.
                if (altDel != null)
                {
                    foundObj = altDel;
                }

                this.CompoundFile.InvalidateDirectoryEntry(((IDirectoryEntry)foundObj).SID);



                break;
            }

            //// Refresh recursively all SIDs (invariant for tree sorting)
            //VisitedEntryAction action = delegate(CFSItem target)
            //{
            //    if( ((IDirectoryEntry)target).SID>foundObj.SID )
            //    {
            //        ((IDirectoryEntry)target).SID--;
            //    }


            //    ((IDirectoryEntry)target).LeftSibling--;
            //};
        }
Пример #15
0
        /// <summary>
        /// Create a CFStorage using an existing directory (previously loaded).
        /// </summary>
        /// <param name="compFile">The Storage Owner - CompoundFile</param>
        /// <param name="dirEntry">An existing Directory Entry</param>
        internal CFStorage(CompoundFile compFile, IDirectoryEntry dirEntry)
            : base(compFile)
        {
            if (dirEntry == null || dirEntry.SID < 0)
                throw new CFException("Attempting to create a CFStorage using an unitialized directory");

            this.DirEntry = dirEntry;
        }
Пример #16
0
 public virtual IEnumerable<ISearchResult> FindAll(IDirectoryEntry searchRoot, string filter)
 {
     return this.FindAll(new ValueContainer<IDirectoryEntry>(searchRoot), new ValueContainer<string>(filter), null, null, null);
 }
Пример #17
0
 public virtual ISearchResult FindOne(IDirectoryEntry searchRoot, string filter, IEnumerable<string> propertiesToLoad, SearchScope scope, IDirectorySearcherOptions directorySearcherOptions)
 {
     return this.FindOne(new ValueContainer<IDirectoryEntry>(searchRoot), new ValueContainer<string>(filter), new ValueContainer<IEnumerable<string>>(propertiesToLoad), new ValueContainer<SearchScope>(scope), new ValueContainer<IDirectorySearcherOptions>(directorySearcherOptions));
 }
        private void DoLoadChildren(ICollection<CFItem> bst, IDirectoryEntry directoryEntry)
        {
            if (directoryEntry.Child == DirectoryEntry.Nostream) return;
            if (_directoryEntries[directoryEntry.Child].StgType == StgType.StgInvalid) return;

            if (_directoryEntries[directoryEntry.Child].StgType == StgType.StgStream)
                bst.Add(new CFStream(this, _directoryEntries[directoryEntry.Child]));
            else
                bst.Add(new CFStorage(this, _directoryEntries[directoryEntry.Child]));

            LoadSiblings(bst, _directoryEntries[directoryEntry.Child]);
        }
 public MyFirstClass(IDirectoryEntry entryAccessor)
 {
     _entryAccessor = entryAccessor;
 }
Пример #20
0
		public virtual IDirectoryEntry GetDirectoryEntry() {
			return internalEntry ?? (internalEntry = searchResult.GetDirectoryEntry().Wrap());
		}
Пример #21
0
 public void Add(IDirectoryEntry dirEntry)
 {
     list.Add(dirEntry);
 }
Пример #22
0
 public virtual ISearchResult FindOne(IDirectoryEntry searchRoot, string filter, IDirectorySearcherOptions directorySearcherOptions)
 {
     return this.FindOne(new ValueContainer<IDirectoryEntry>(searchRoot), new ValueContainer<string>(filter), null, null, new ValueContainer<IDirectorySearcherOptions>(directorySearcherOptions));
 }
Пример #23
0
 public virtual ISearchResult FindOne(IDirectoryEntry searchRoot, string filter, IEnumerable<string> propertiesToLoad)
 {
     return this.FindOne(new ValueContainer<IDirectoryEntry>(searchRoot), new ValueContainer<string>(filter), new ValueContainer<IEnumerable<string>>(propertiesToLoad), null, null);
 }
        private void DoLoadSiblings(ICollection<CFItem> binarySearchTree, IDirectoryEntry directoryEntry)
        {
            while (true)
            {
                if (ValidateSibling(directoryEntry.LeftSibling))
                {
                    // If there're more left siblings load them...
                    DoLoadSiblings(binarySearchTree, _directoryEntries[directoryEntry.LeftSibling]);
                }

                switch (_directoryEntries[directoryEntry.SID].StgType)
                {
                    case StgType.StgStream:
                        binarySearchTree.Add(new CFStream(this, _directoryEntries[directoryEntry.SID]));
                        break;
                    case StgType.StgStorage:
                        binarySearchTree.Add(new CFStorage(this, _directoryEntries[directoryEntry.SID]));
                        break;
                }

                if (ValidateSibling(directoryEntry.RightSibling))
                {
                    // If there're more right siblings load them...
                    directoryEntry = _directoryEntries[directoryEntry.RightSibling];
                    continue;
                }
                break;
            }
        }
Пример #25
0
 public virtual IEnumerable<ISearchResult> FindAll(IDirectoryEntry searchRoot, IDirectorySearcherOptions directorySearcherOptions)
 {
     return this.FindAll(new ValueContainer<IDirectoryEntry>(searchRoot), null, null, null, new ValueContainer<IDirectorySearcherOptions>(directorySearcherOptions));
 }
        /// <summary>
        ///     Doubling methods allows iterative behavior while avoiding to insert duplicate items
        /// </summary>
        /// <param name="binarySearchTree"></param>
        /// <param name="directoryEntry"></param>
        private void LoadSiblings(ICollection<CFItem> binarySearchTree, IDirectoryEntry directoryEntry)
        {
            if (directoryEntry.LeftSibling != DirectoryEntry.Nostream)
            {
                // If there're more left siblings load them...
                DoLoadSiblings(binarySearchTree, _directoryEntries[directoryEntry.LeftSibling]);
            }

            if (directoryEntry.RightSibling != DirectoryEntry.Nostream)
            {
                // If there're more right siblings load them...
                DoLoadSiblings(binarySearchTree, _directoryEntries[directoryEntry.RightSibling]);
            }
        }
 private static bool IsDirectoryEntryAUser(IDirectoryEntry entryResult)
 {
     // TODO: Add to constants file
     return(entryResult.SchemaClassName.Equals("user"));
 }
        /// <summary>
        ///     Inserts a new <see cref="directoryEntry" />
        /// </summary>
        /// <param name="directoryEntry"></param>
        internal void InsertNewDirectoryEntry(IDirectoryEntry directoryEntry)
        {
            // If we are not adding an invalid dirEntry as
            // in a normal loading from file (invalid dirs MAY pad a sector)
            if (directoryEntry != null)
            {
                // Find first available invalid slot (if any) to reuse it
                for (var i = 0; i < _directoryEntries.Count; i++)
                {
                    if (_directoryEntries[i].StgType == StgType.StgInvalid)
                    {
                        _directoryEntries[i] = directoryEntry;
                        directoryEntry.SID = i;
                        return;
                    }
                }
            }

            // No invalid directory entry found
            _directoryEntries.Add(directoryEntry);
            if (directoryEntry != null) directoryEntry.SID = _directoryEntries.Count - 1;
        }
 /// <summary>
 ///
 /// </summary>
 /// <param name="directoryEntry">
 /// </param>
 /// <param name="pageSize">
 /// </param>
 /// <param name="sizeLimit">
 /// </param>
 /// <returns>
 /// </returns>
 public IDirectorySearcher Create(IDirectoryEntry directoryEntry,
                                  int sizeLimit = 20,
                                  int?pageSize  = null)
 {
     return(new DirectorySearcherWrap(directoryEntry, sizeLimit, pageSize));
 }
Пример #30
0
 public virtual IDirectoryEntry GetDirectoryEntry()
 {
     return(internalEntry ?? (internalEntry = searchResult.GetDirectoryEntry().Wrap()));
 }
Пример #31
0
 public virtual IEnumerable<ISearchResult> FindAll(IDirectoryEntry searchRoot, string filter, IEnumerable<string> propertiesToLoad, IDirectorySearcherOptions directorySearcherOptions)
 {
     return this.FindAll(new ValueContainer<IDirectoryEntry>(searchRoot), new ValueContainer<string>(filter), new ValueContainer<IEnumerable<string>>(propertiesToLoad), null, new ValueContainer<IDirectorySearcherOptions>(directorySearcherOptions));
 }
Пример #32
0
 public virtual IEnumerable<ISearchResult> FindAll(IDirectoryEntry searchRoot, string filter, IEnumerable<string> propertiesToLoad, SearchScope scope)
 {
     return this.FindAll(new ValueContainer<IDirectoryEntry>(searchRoot), new ValueContainer<string>(filter), new ValueContainer<IEnumerable<string>>(propertiesToLoad), new ValueContainer<SearchScope>(scope), null);
 }
 public virtual void Remove(IDirectoryEntry entry)
 {
     throw new NotImplementedException("Don't know how to implement this yet.");
 }
Пример #34
0
 public virtual ISearchResult FindOne(IDirectoryEntry searchRoot)
 {
     return this.FindOne(new ValueContainer<IDirectoryEntry>(searchRoot), null, null, null, null);
 }
Пример #35
0
 public DirEntry(IDirectoryEntry entry, Context context) : this(context)
 {
     _entry = entry;
     _name  = _context.Options.FileNameEncoding.GetString(_entry.Name);
     Inode  = _context.GetInode(_entry.Inode);
 }
 /// <summary>
 /// 
 /// </summary>
 /// <param name="directoryEntry">
 /// </param>
 /// <param name="pageSize">
 /// </param>
 /// <param name="sizeLimit">
 /// </param>
 /// <returns>
 /// </returns>
 public IDirectorySearcher Create(IDirectoryEntry directoryEntry,
                                  int sizeLimit = 20,
                                  int? pageSize = null)
 {
     return new DirectorySearcherWrap(directoryEntry, sizeLimit, pageSize);
 }