Пример #1
0
        protected virtual IEnumerable <FolderReference> GetUploadFolderPaths()
        {
            var paths = new List <FolderReference>();

            if (folderSource == null)
            {
                throw new NullReferenceException("folderSource is null");
            }
            //return new FolderPair[0];

            var gpp = new List <FileSystemRoot>(folderSource.GetUploadFoldersForAllSites());            // non-lazy easier to debug :-)

            if (gpp == null)
            {
                throw new NullReferenceException("folderSource.GetUploadFoldersForAllSites() returned null");
            }

            // configured folders to the root node
            foreach (var folder in gpp)
            {
                var parent = persister.Get(folder.GetParentID());
                if (parent == null)
                {
                    break;
                }

                var pair = new FolderReference(parent.ID, parent.Path, parent.Path + folder.GetName() + "/", folder);
                paths.Add(pair);
            }

            return(paths);
        }
        private FolderPair[] GetUploadFolderPaths()
        {
            var paths = new List <FolderPair>();

            // configured folders to the root node
            foreach (var folder in folderSource.GetUploadFoldersForAllSites())
            {
                var parent = persister.Get(folder.GetParentID());
                var pair   = new FolderPair(parent.ID, parent.Path, parent.Path + folder.GetName() + "/", folder);
                paths.Add(pair);
            }

            return(paths.ToArray());
        }
Пример #3
0
        public string CopyToDb()
        {
            if (fs.GetType() != typeof(DatabaseFileSystem))
            {
                throw new Exception("Database filesystem not configured");
            }

            var uploadFolders = folderSource.GetUploadFoldersForAllSites();

            foreach (var uploadFolder in uploadFolders)
            {
                CopyFilesInDirectoryRecursively(webContext.MapPath(uploadFolder));
            }

            return(returnValue);
        }