Exemplo n.º 1
0
        private ArrayList GetListFolderUser(string path, string type, bool allowUpload = false)
        {
            var lst = new ArrayList();

            string fixPath = FixPath(path);

            DirectoryInfo d = new DirectoryInfo(fixPath);

            if (!d.Exists)
            {
                d = Directory.CreateDirectory(fixPath);
            }

            string[] dirs = Directory.GetDirectories(fixPath);

            var dirv = new FileManagerForderInfoViewModel
            {
                Path        = path,
                CountFile   = GetFiles(fixPath, type).Count,
                CountFoder  = dirs.Length,
                AllowUpload = allowUpload
            };

            lst.Add(dirv);

            string localPath = Server.MapPath("~/");

            localPath = localPath.Substring(0, localPath.Length - 1);

            foreach (var dir in dirs)
            {
                var pth = dir.Replace(localPath, "").Replace("\\", "/");

                var name = pth.Substring(pth.LastIndexOf("/") + 1);

                try
                {
                    var guid = new Guid(name);
                    if (LoggedOnReadOnlyUser.Id == guid)
                    {
                        continue;
                    }

                    var mem = MembershipService.Get(guid);
                    if (mem != null)
                    {
                        name = mem.UserName;
                    }
                }
                catch { }


                lst.AddRange(GetListFolder(name, pth, type, allowUpload));
            }

            return(lst);
        }
Exemplo n.º 2
0
        private ArrayList GetListFolder(string name, string path, string type, bool allowUpload = false)
        {
            var lst = new ArrayList();

            string fixPath = FixPath(path);

            DirectoryInfo d = new DirectoryInfo(fixPath);

            if (!d.Exists)
            {
                d = Directory.CreateDirectory(fixPath);
            }

            string[] dirs = Directory.GetDirectories(fixPath);

            var dirv = new FileManagerForderInfoViewModel {
                Name        = name,
                Path        = path,
                CountFile   = GetFiles(fixPath, type).Count,
                CountFoder  = dirs.Length,
                AllowUpload = allowUpload
            };

            lst.Add(dirv);

            string localPath = Server.MapPath("~/");

            localPath = localPath.Substring(0, localPath.Length - 1);

            foreach (var dir in dirs)
            {
                var pth = dir.Replace(localPath, "").Replace("\\", "/");

                lst.AddRange(GetListFolder("", pth, type, allowUpload));
            }

            return(lst);
        }