improve song enumeration performance
This commit is contained in:
1 parent
5d46be228f
commit
70be8f4d94
1 file changed
+5
-6
@@ -339,18 +339,17 @@ namespace Vocaluxe.Base
|
||||
SongsLoaded = false;
|
||||
_Songs.Clear();
|
||||
|
||||
var files = new List<string>();
|
||||
var files = Enumerable.Empty<string>();
|
||||
|
||||
using (CBenchmark.Time("List Songs"))
|
||||
{
|
||||
|
||||
foreach (string p in CConfig.SongFolders)
|
||||
foreach (string path in CConfig.SongFolders)
|
||||
{
|
||||
if (Directory.Exists(p))
|
||||
if (Directory.Exists(path))
|
||||
{
|
||||
string path = p;
|
||||
files.AddRange(CHelper.ListFiles(path, "*.txt", true, true));
|
||||
files.AddRange(CHelper.ListFiles(path, "*.txd", true, true));
|
||||
files = files.Union(Directory.EnumerateFiles(path, "*.txt", SearchOption.AllDirectories));
|
||||
files = files.Union(Directory.EnumerateFiles(path, "*.txd", SearchOption.AllDirectories));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user