//读取目录 下的所有非隐藏文件夹或文件 public List<FileItem> GetList(string path) { int i; string[] folders = Directory.GetDirectories(path); string[] files = Directory.GetFiles(path); List<FileItem> list = new List<FileItem>(); foreach (string s in folders) { FileItem item = new FileItem(); DirectoryInfo di = new DirectoryInfo(s); string[] w = di.Name.Split(new char[] { '#' }); if (w.Length == 1) { item.Name = di.Name; } else { item.Name=""; for(i=1;i<w.Length;i++) item.Name=item.Name+w[i]; } item.FullName =rlocaltourlconver(di.FullName); item.CreationDate = di.CreationTime; item.Size =(float)FileSize(s)/(1024); item.IsFolder = true; if ((new FileInfo(s).Attributes & FileAttributes.Hidden) ==0)//过滤隐藏文件夹 { list.Add(item); } } foreach (string s in files) { FileItem item = new FileItem(); FileInfo fi = new FileInfo(s); string[] w = fi.Name.Split(new char[] { '#' }); if (w.Length == 1) { item.Name = fi.Name; } else { item.Name = ""; for (i = 1; i < w.Length; i++) item.Name = item.Name + w[i]; } item.FullName = rlocaltourlconver(fi.FullName); item.CreationDate = fi.CreationTime; item.IsFolder = true; item.Size = (float)fi.Length/(1024); item.FileCount = 0; if ((new FileInfo(s).Attributes & FileAttributes.Hidden) == 0)//过滤隐藏文件 { list.Add(item); } } return list; }