public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            switch (value)
            {
            case null:
                return(DependencyProperty.UnsetValue);

            case FileInfo fileInfo:
                return(WinExplorerHelper.GetSizeFormat(fileInfo.Length));

            case DirectoryInfo directoryInfo:
                int count = directoryInfo.GetFiles().Length + directoryInfo.GetDirectories().Length;

                return(string.Format(Strings.Resources.FileItemCount, count));
            }

            return(DependencyProperty.UnsetValue);
        }
Esempio n. 2
0
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            switch (value)
            {
            case null:
                return(DependencyProperty.UnsetValue);

            case FileInfo fileInfo:
                var length = fileInfo.Length;

                return(WinExplorerHelper.GetSizeFormat(length));

            case DirectoryInfo directoryInfo:
                int count = directoryInfo.GetFiles().Length + directoryInfo.GetDirectories().Length;

                return($"{count} items");
            }

            return(DependencyProperty.UnsetValue);
        }
 private static string FormatMetadata(Size size, FileInfo fileInfo)
 {
     return($"{size.Width}x{size.Height} - {WinExplorerHelper.GetSizeFormat(fileInfo.Length)}");
 }
Esempio n. 4
0
 private static string FormatMetadata(TagLib.File file, FileInfo fileInfo)
 {
     return($"{file.Properties.PhotoWidth}x{file.Properties.PhotoHeight} - {WinExplorerHelper.GetSizeFormat(fileInfo.Length)}");
 }
Esempio n. 5
0
 private static string FormatMetadata(PdfDocument document, FileInfo fileInfo)
 {
     return($"{string.Format(Strings.Resources.PageCountText, document.PageCount)} - {WinExplorerHelper.GetSizeFormat(fileInfo.Length)}");
 }