mirror of
https://github.com/QL-Win/QuickLook.git
synced 2025-09-11 17:59:17 +00:00
do not show useless texts e.g. "... and 0 files"
This commit is contained in:
@@ -42,23 +42,33 @@ namespace QuickLook.Plugin.ArchiveViewer
|
|||||||
{
|
{
|
||||||
LoadItemsFromArchive(path);
|
LoadItemsFromArchive(path);
|
||||||
|
|
||||||
var folder = 0;
|
var folders = -1; // do not count root node
|
||||||
var files = 0;
|
var files = 0;
|
||||||
ulong sizeU = 0L;
|
ulong sizeU = 0L;
|
||||||
_fileEntries.ForEach(e =>
|
_fileEntries.ForEach(e =>
|
||||||
{
|
{
|
||||||
if (e.Value.IsFolder)
|
if (e.Value.IsFolder)
|
||||||
folder++;
|
folders++;
|
||||||
else
|
else
|
||||||
files++;
|
files++;
|
||||||
|
|
||||||
sizeU += e.Value.Size;
|
sizeU += e.Value.Size;
|
||||||
});
|
});
|
||||||
|
|
||||||
var s = _solid ? " solid," : "";
|
var s = _solid ? ", solid" : "";
|
||||||
|
|
||||||
|
string t;
|
||||||
|
var d = folders != 0 ? $"{folders} folders" : string.Empty;
|
||||||
|
var f = files != 0 ? $"{files} files" : string.Empty;
|
||||||
|
if (!string.IsNullOrEmpty(d) && !string.IsNullOrEmpty(f))
|
||||||
|
t = $", {d} and {f}";
|
||||||
|
else if (string.IsNullOrEmpty(d) && string.IsNullOrEmpty(f))
|
||||||
|
t = string.Empty;
|
||||||
|
else
|
||||||
|
t = $", {d}{f}";
|
||||||
|
|
||||||
archiveCount.Content =
|
archiveCount.Content =
|
||||||
$"{_type} archive,{s} {folder - 1} folders and {files} files"; // do not count root node
|
$"{_type} archive{s}{t}";
|
||||||
archiveSizeC.Content = $"Compressed size {_totalZippedSize.ToPrettySize(2)}";
|
archiveSizeC.Content = $"Compressed size {_totalZippedSize.ToPrettySize(2)}";
|
||||||
archiveSizeU.Content = $"Uncompressed size {sizeU.ToPrettySize(2)}";
|
archiveSizeU.Content = $"Uncompressed size {sizeU.ToPrettySize(2)}";
|
||||||
}
|
}
|
||||||
|
@@ -71,17 +71,24 @@ namespace QuickLook.Plugin.InfoPanel
|
|||||||
}
|
}
|
||||||
else if (Directory.Exists(path))
|
else if (Directory.Exists(path))
|
||||||
{
|
{
|
||||||
long totalDirsL;
|
FileHelper.CountFolder(path, ref _stop,
|
||||||
long totalFilesL;
|
out long totalDirsL, out long totalFilesL, out long totalSizeL);
|
||||||
long totalSizeL;
|
|
||||||
|
|
||||||
FileHelper.CountFolder(path, ref _stop, out totalDirsL, out totalFilesL, out totalSizeL);
|
|
||||||
|
|
||||||
if (!Stop)
|
if (!Stop)
|
||||||
Dispatcher.Invoke(() =>
|
Dispatcher.Invoke(() =>
|
||||||
{
|
{
|
||||||
|
string t;
|
||||||
|
var d = totalDirsL != 0 ? $"{totalDirsL} folders" : string.Empty;
|
||||||
|
var f = totalFilesL != 0 ? $"{totalFilesL} files" : string.Empty;
|
||||||
|
if (!string.IsNullOrEmpty(d) && !string.IsNullOrEmpty(f))
|
||||||
|
t = $"({d} and {f})";
|
||||||
|
else if (string.IsNullOrEmpty(d) && string.IsNullOrEmpty(f))
|
||||||
|
t = string.Empty;
|
||||||
|
else
|
||||||
|
t = $"({d}{f})";
|
||||||
|
|
||||||
totalSize.Text =
|
totalSize.Text =
|
||||||
$"{totalSizeL.ToPrettySize(2)} ({totalDirsL} folders and {totalFilesL} files)";
|
$"{totalSizeL.ToPrettySize(2)} {t}";
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
Reference in New Issue
Block a user