void StoreFileInformation(System.IO.DirectoryInfo di) { System.IO.FileInfo[] fileNames = di.GetFiles("*.*"); System.IO.DirectoryInfo[] Directories = di.GetDirectories("*.*"); long totallength = 0; List <FileInform> FilesInDir = new List <FileInform>(); foreach (System.IO.FileInfo fi in fileNames) { System.IO.DirectoryInfo parent = fi.Directory; string FileSize = GetFileSize(fi.Length); FileInform Info = new FileInform(fi.Name, fi.Extension, FileSize, fi.LastWriteTime.ToString()); totallength = totallength + fi.Length; FilesInDir.Add(Info); } DirInfo NewDir = new DirInfo(di.Name, totallength.ToString(), FilesInDir); FileInf.Add(di.Name, NewDir); System.IO.DirectoryInfo[] dirInfos = di.GetDirectories("*.*"); foreach (System.IO.DirectoryInfo d in dirInfos) { StoreFileInformation(d); } }
int GetColumnText(DirInfo Content, int RowValue, Grid DynamicGrid) { foreach (FileInform FilContent in Content._files) { RowDefinition gridRow = new RowDefinition(); gridRow.Height = new GridLength(20); DynamicGrid.RowDefinitions.Add(gridRow); TextBlock NameText = new TextBlock(); NameText.Text = FilContent._filename; NameText.FontSize = 10; NameText.TextAlignment = TextAlignment.Center; Grid.SetRow(NameText, RowValue); Grid.SetColumn(NameText, 0); DynamicGrid.Children.Add(NameText); TextBlock ExtText = new TextBlock(); ExtText.Text = FilContent._extension; ExtText.FontSize = 10; ExtText.TextAlignment = TextAlignment.Center; Grid.SetRow(ExtText, RowValue); Grid.SetColumn(ExtText, 1); DynamicGrid.Children.Add(ExtText); TextBlock SizeText = new TextBlock(); SizeText.Text = FilContent._size; SizeText.FontSize = 10; SizeText.TextAlignment = TextAlignment.Center; Grid.SetRow(SizeText, RowValue); Grid.SetColumn(SizeText, 2); DynamicGrid.Children.Add(SizeText); TextBlock ChangedText = new TextBlock(); ChangedText.Text = FilContent._lastchanged; ChangedText.FontSize = 10; ChangedText.TextAlignment = TextAlignment.Center; Grid.SetRow(ChangedText, RowValue); Grid.SetColumn(ChangedText, 3); DynamicGrid.Children.Add(ChangedText); RowValue++; } return(RowValue); }