Skip to content

Commit

Permalink
#5894 performance enhancement on RoxyFileman
Browse files Browse the repository at this point in the history
  • Loading branch information
skoshelev committed Oct 12, 2021
1 parent 30fd49c commit 78a0bce
Showing 1 changed file with 6 additions and 7 deletions.
Expand Up @@ -5,6 +5,7 @@
using System.Drawing.Imaging;
using System.IO;
using System.IO.Compression;
using System.Linq;
using System.Net;
using System.Text;
using System.Threading.Tasks;
Expand Down Expand Up @@ -99,12 +100,10 @@ protected virtual async Task<List<string>> GetFilesByDirectoryAsync(string direc
if (type == "#")
type = string.Empty;

var files = new List<string>();
foreach (var fileName in _fileProvider.GetFiles(directoryPath))
if (string.IsNullOrEmpty(type) || GetFileType(_fileProvider.GetFileExtension(fileName)) == type)
files.Add(fileName);

return files;
return _fileProvider.EnumerateFiles(directoryPath, "*.*")
.AsParallel()
.Where(file => string.IsNullOrEmpty(type) || GetFileType(_fileProvider.GetFileExtension(file)) == type)
.ToList();
}

/// <summary>
Expand Down Expand Up @@ -544,7 +543,7 @@ public virtual async Task GetFilesAsync(string directoryPath, string type)
if (GetFileType(_fileProvider.GetFileExtension(files[i])) == "image")
{
await using var stream = new FileStream(physicalPath, FileMode.Open);
using var image = SKBitmap.Decode(stream);
var image = SKBitmap.DecodeBounds(stream);
width = image.Width;
height = image.Height;
}
Expand Down

0 comments on commit 78a0bce

Please sign in to comment.