/// <summary> /// Cue file filter. Parse Cue sheet file, /// add cue fake track files for each one cue track, /// removes original single file ape flac wav and etc, from list /// </summary> /// <typeparam name="T">Type of obgects in fileList</typeparam> /// <param name="fileList">File list to be filtered</param> /// <param name="adaptor"></param> /// <returns></returns> public static IList <T> CUEFileListFilter <T>(IList <T> fileList, ICueTrackFileBuilder <T> builder) { if (fileList == null || fileList.Count == 0) { return(fileList); } List <string> exclusionList = new List <string>(2); List <T> resultList = new List <T>(fileList.Count); foreach (T fobj in fileList) { string fileName = builder.getFileName(fobj); if (CueUtil.isCueFile(fileName)) { exclusionList.Add(fileName); CueSheet cueSheet = new CueSheet(fileName); string cuePath = System.IO.Path.GetDirectoryName(fileName); foreach (Track track in cueSheet.Tracks) { if (!exclusionList.Contains(cuePath + "\\" + track.DataFile.Filename)) { exclusionList.Add(cuePath + "\\" + track.DataFile.Filename); } resultList.Add(builder.build(fileName, cueSheet, track)); } } else { if (!isWavCueFile(fileName)) { resultList.Add(fobj); } } } if (exclusionList.Count > 0) { List <T> tmpList = new List <T>(resultList.Count); foreach (T fobj in resultList) { if (!exclusionList.Contains(builder.getFileName(fobj))) { tmpList.Add(fobj); } } resultList = tmpList; } return(resultList); }
/// <summary> /// Cue file filter for usage with not generic parameters /// See CUEFileListFilter for more infrmation /// </summary> /// <typeparam name="T">Parameter for builder (Type of IList entries)</typeparam> /// <param name="fileList">fileList to filter</param> /// <param name="builder">Builder for construct new list entries</param> /// <returns>filtered list</returns> public static IList <T> CUEFileListFilterList <T>(IList <T> fileList, ICueTrackFileBuilder <T> builder) { if (fileList == null || fileList.Count == 0) { return(fileList); } // Apply CUE Filter fileList = CueUtil.CUEFileListFilter <T>(fileList, builder); return(fileList); }