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;
|
SongsLoaded = false;
|
||||||
_Songs.Clear();
|
_Songs.Clear();
|
||||||
|
|
||||||
var files = new List<string>();
|
var files = Enumerable.Empty<string>();
|
||||||
|
|
||||||
using (CBenchmark.Time("List Songs"))
|
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 = files.Union(Directory.EnumerateFiles(path, "*.txt", SearchOption.AllDirectories));
|
||||||
files.AddRange(CHelper.ListFiles(path, "*.txt", true, true));
|
files = files.Union(Directory.EnumerateFiles(path, "*.txd", SearchOption.AllDirectories));
|
||||||
files.AddRange(CHelper.ListFiles(path, "*.txd", true, true));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user