-
Notifications
You must be signed in to change notification settings - Fork 0
/
MusicFolder.cs
36 lines (30 loc) · 983 Bytes
/
MusicFolder.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
using System.Collections.Generic;
using System.IO;
namespace milonga_generator
{
public static class MusicFolder
{
// fix extensioin
// the supported extension to filter the files
public static List<string> fileExtensions = new List<string>()
{ ".mp3" };
public static string getLastFolderName(string _path)
{
return new DirectoryInfo(_path).Name;
}
public static List<string> getMusicFiles(string _path)
{
string[] filesUnfiltered = Directory.GetFiles(_path);
List<string> filesFiltered = new List<string>();
foreach (string file in filesUnfiltered)
{
string extension = file.Substring(file.LastIndexOf('.'));
if (fileExtensions.Contains(extension))
{
filesFiltered.Add(file);
}
}
return filesFiltered;
}
}
}