Ejemplo n.º 1
0
 protected void OrderFiles(IEnumerable <T> files)
 {
     // ReSharper disable once PossibleMultipleEnumeration
     FileNames        = GetFileNames(files).Where(FileIsImage).OrderBy(c => c).ToArray();
     OrderedFileNames = PageOrderMode switch
     {
         MainViewModel.PageOrder.Natural => GetFileNames(files)
         .Where(FileIsImage)
         .OrderBy(ef => ef, new NaturalSortComparer())
         .ToArray(),
         MainViewModel.PageOrder.Modified => OrderFilesByDateModified(files).Where(FileIsImage).ToArray(),
         MainViewModel.PageOrder.Ordinal => FileNames.ToArray(),
         _ => throw new ArgumentOutOfRangeException()
     };
     OrderedShortNames = OrderedFileNames.Select(fn => GetShortName(this is FolderContainer ? ContainerPath : null, fn)).ToArray();
     foreach (var pageTag in Item.PageTags)
     {
         var index = Array.IndexOf(OrderedShortNames, pageTag.FileName);
         pageTag.Page = index == -1 ? -1 : index + 1;
     }
 }
Ejemplo n.º 2
0
 public string GetFileName() => FileNames == null ? FileName : FileNames.ToArray()[_random.Next(0, FileNames.Count())];