Пример #1
0
        public RDirectoryItem GetFolderName(string folderPath)
        {
            if (!DriveExist)
            {
                throw new DriveDoesNotExistException();
            }

            if (folderPath.Trim() != string.Empty)
            {
                string         drivepath = Path.Combine(MemberDataAbsPath, folderPath);
                DirectoryInfo  i         = new DirectoryInfo(drivepath);
                RDirectoryItem rdi       = new RDirectoryItem();
                rdi.ID             = Guid.NewGuid();
                rdi.CreateDate     = i.CreationTime;
                rdi.LastAccessDate = i.LastAccessTime;

                rdi.Location   = i.FullName.Replace(string.Format("{0}\\", MemberDataAbsPath), string.Empty);
                rdi.ModifyDate = i.LastWriteTime;
                rdi.Name       = i.Name;

                rdi.Contains = ""; // string.Format("{0} Folders, {1} Files", i.EnumerateDirectories().Count(), i.EnumerateFileSystemInfos().Count());

                rdi.ThumbNail = string.Format("{0}/bootstrap/img/drive/folder-data-icon.png", Utility.SiteURL);

                return(rdi);
            }
            else
            {
                return(new RDirectoryItem());
            }
        }
Пример #2
0
        public List <RDirectoryItem> GetDirectoryItemList(string folderpath)
        {
            if (!DriveExist)
            {
                throw new DriveDoesNotExistException();
            }
            bool folderDeletable       = true;
            List <RDirectoryItem> list = new List <RDirectoryItem>();
            string drivepath           = Path.Combine(MemberDataAbsPath, folderpath);

            folderDeletable = ItemDeletable;

            if (folderpath == string.Empty)
            {
                folderDeletable = false;
            }

            DirectoryInfo di = new DirectoryInfo(drivepath);

            if (di.Exists)
            {
                foreach (DirectoryInfo i in di.EnumerateDirectories())
                {
                    RDirectoryItem rdi = new RDirectoryItem();
                    rdi.ID             = Guid.NewGuid();
                    rdi.CreateDate     = i.CreationTime;
                    rdi.LastAccessDate = i.LastAccessTime;
                    rdi.Location       = i.FullName.Replace(string.Format("{0}\\", MemberDataAbsPath), string.Empty);
                    rdi.ModifyDate     = i.LastWriteTime;
                    rdi.Name           = i.Name;
                    rdi.Deletable      = folderDeletable;
                    rdi.Editable       = true;
                    rdi.Contains       = "";// string.Format("{0} Folders, {1} Files", i.EnumerateDirectories().Count(), i.EnumerateFiles().Count());
                    //if (i.GetDirectories().Length > 0 || i.GetFiles().Length > 0)
                    //{
                    rdi.ThumbNail = string.Format("{0}/bootstrap/img/drive/folder-data-icon.png", Utility.SiteURL);
                    //}
                    //else
                    //{
                    //    rdi.ThumbNail = string.Format("{0}/bootstrap/img/drive/folder-empty-icon.png", Utility.SiteURL);
                    //}
                    list.Add(rdi);
                }
            }
            else
            {
                throw new DriveDoesNotExistException();
            }

            return(list);
        }