protected override ExitCode ExecuteFileTask() { VolumeInformation info = ExtendedFileService.GetVolumeInformation(Arguments.Target); Table table = Table.Create(new ColumnFormat(1, ContentVisibility.ShowAll, Justification.Right), new ColumnFormat(1)); table.HasHeader = false; table.AddRow("Volume Name", info.VolumeName); table.AddRow("Serial Number", info.VolumeSerialNumber.ToString()); table.AddRow("Max Component Length", info.MaximumComponentLength.ToString()); table.AddRow("File System Name", info.FileSystemName.ToString()); foreach (var value in Enum.GetValues(typeof(FileSystemFeature))) { FileSystemFeature feature = (FileSystemFeature)value; if ((feature & info.FileSystemFlags) == feature) { table.AddRow(feature.ToString(), "true"); } else { table.AddRow(feature.ToString(), "false"); } } ResultLog.Write(table); return(ExitCode.Success); }
protected override ExitCode ExecuteFileTask() { string path = GetFullTargetPath(); var fileInfo = FileService.GetFileInfo(path); var extendedInfo = fileInfo as IExtendedFileSystemInformation; Table table = Table.Create(new ColumnFormat(1, ContentVisibility.ShowAll, Justification.Right), new ColumnFormat(1)); table.HasHeader = false; table.AddRow("Name", fileInfo.Name); table.AddRow("Path", fileInfo.Path); table.AddRow("Length", fileInfo.Length.ToString()); table.AddRow("Attributes", fileInfo.Attributes.ToString()); table.AddRow("Creation Time", fileInfo.CreationTime.ToString()); table.AddRow("Last Write Time", fileInfo.LastWriteTime.ToString()); table.AddRow("Last Access Time", fileInfo.LastAccessTime.ToString()); table.AddRow("Volume Serial Number", extendedInfo.VolumeSerialNumber.ToString()); table.AddRow("File Index", extendedInfo.FileIndex.ToString()); table.AddRow("Number of Links", extendedInfo.NumberOfLinks.ToString()); ResultLog.Write(table); return(ExitCode.Success); }
protected override ExitCode ExecuteFileTask() { var fileService = GetService <IFileService>(); Table output = Table.Create( new ColumnFormat(1), new ColumnFormat(1), new ColumnFormat(1, ContentVisibility.Default, Justification.Right), new ColumnFormat(4)); output.HasHeader = false; int directoryCount = 0; int fileCount = 0; ulong totalSize = 0; IDirectoryInformation directory = fileService.GetDirectoryInfo(GetFullTargetPath()); foreach (var subdir in directory.EnumerateDirectories().OrderBy(i => i.Name)) { directoryCount++; AddToTable(output, subdir); } foreach (var file in directory.EnumerateFiles().OrderBy(i => i.Name)) { fileCount++; totalSize += file.Length; AddToTable(output, file); } StatusLog.WriteLine($" Directory of {directory.Path}"); StatusLog.WriteLine(); ResultLog.Write(output); StatusLog.WriteLine(); StatusLog.WriteLine($" {directoryCount} Dir(s) {fileCount} File(s) {totalSize:N0} bytes"); return(ExitCode.Success); }