public static long CalcTotalFileSize(FSDirectory dir) { long totalFileSize = 0; foreach (string file in dir.ListAll()) { totalFileSize += dir.FileLength(file); // FileInfo fi = new FileInfo(file); // totalFileSize += fi.Length; } return(totalFileSize); }
public void ShowFiles(FSDirectory dir) { String[] files = dir.ListAll(); listIndexFiles.Items.Clear(); foreach (string file in files) { // FileInfo fi = new FileInfo(file); ListViewItem row = new ListViewItem( new string[] { file, //fi.Name, NormalizeSize(dir.FileLength(file)), NormalizeUnit(dir.FileLength(file)) }); listIndexFiles.Items.Add(row); } long totalFileSize = CalcTotalFileSize(dir); lblFileSize.Text = NormalizeSize(totalFileSize) + NormalizeUnit(totalFileSize); }
private IEnumerable <IndexFile> GetIndexFiles() { var indexFiles = new List <IndexFile>(); if (_directory != null) { var files = _directory.ListAll(); foreach (var file in files) { var indexfile = new IndexFile { FileName = file }; var fileLength = _directory.FileLength(file); indexfile.FileSize = fileLength; indexFiles.Add(indexfile); } } return(indexFiles); }
/// <summary>Returns the length of a file in the directory. </summary> public override long FileLength(string name) { //always from the real dir return(_realDirectory.FileLength(name)); }