Exemplo n.º 1
0
 public static Func <ListedItem, string> GetItemGroupKeySelector(GroupOption option)
 {
     return(option switch
     {
         GroupOption.Name => x => new string(x.ItemName.Take(1).ToArray()).ToUpperInvariant(),
         GroupOption.Size => x => x.PrimaryItemAttribute != StorageItemTypes.Folder ? GetGroupSizeKey(x.FileSizeBytes) : x.FileSizeDisplay,
         GroupOption.DateCreated => x => dateTimeFormatter.ToTimeSpanLabel(x.ItemDateCreatedReal).Text,
         GroupOption.DateModified => x => dateTimeFormatter.ToTimeSpanLabel(x.ItemDateModifiedReal).Text,
         GroupOption.FileType => x => x.PrimaryItemAttribute == StorageItemTypes.Folder && !x.IsShortcutItem ? x.ItemType : x.FileExtension?.ToLowerInvariant() ?? " ",
         GroupOption.SyncStatus => x => x.SyncStatusString,
         GroupOption.FileTag => x => x.FileTags?.FirstOrDefault(),
         GroupOption.OriginalFolder => x => (x as RecycleBinItem)?.ItemOriginalFolder,
         GroupOption.DateDeleted => x => dateTimeFormatter.ToTimeSpanLabel((x as RecycleBinItem)?.ItemDateDeletedReal ?? DateTimeOffset.Now).Text,
         GroupOption.FolderPath => x => PathNormalization.GetParentDir(x.ItemPath.TrimPath()),
         _ => null,
     });
Exemplo n.º 2
0
 public ITimeSpanLabel ToTimeSpanLabel(DateTimeOffset offset) => formatter.ToTimeSpanLabel(offset);