Exemplo n.º 1
0
        /// <summary>
        /// Manage the root folder case, depending on the scope.
        /// </summary>
        /// <param name="searchEntity"></param>
        /// <param name="scope"></param>
        /// <returns></returns>
        private bool ManageRootFolderCase(SearchEntity searchEntity, SearchFolderScope scope)
        {
            if (scope == SearchFolderScope.Defined)
            {
                // nothing to do, the user should define source folder
                return(true);
            }

            // get the root folder
            Folder rootFolder = _reposit.Finder.GetRootFolder();

            // go inside sub-folders
            if (scope == SearchFolderScope.All)
            {
                // add it to search object
                searchEntity.AddSourceFolder(rootFolder, true);
                return(true);
            }

            // doesn't go inside sub-folders
            if (scope == SearchFolderScope.RootOnly)
            {
                // add it to search object
                searchEntity.AddSourceFolder(rootFolder, false);
                return(true);
            }

            // error?
            return(false);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Add a source folder to the search, and set the option: go inside folders childs or not.
        /// (only direct childs).
        /// </summary>
        /// <param name="searchEntitu"></param>
        /// <param name="sourceFolder"></param>
        /// <param name="goInsideFolderChilds"></param>
        /// <returns></returns>
        public bool AddSourceFolder(SearchEntity searchEntity, Folder sourceFolder, bool goInsideFolderChilds)
        {
            // only if the scope autorize it
            if (searchEntity.SearchFolderScope != SearchFolderScope.Defined)
            {
                return(false);
            }

            // check the folder
            // TODO: notNull, pas déjà ajouté, lien entre dossier!

            // add it to search object
            return(searchEntity.AddSourceFolder(sourceFolder, goInsideFolderChilds));
        }