public object LoadTracks(BackgroundWorker backgroundWorker, string[] fileNames) { var filesEnum = fileNames.GetEnumerator(); var tempTrackCollection = new TrackCollection(); var count = 1; while (filesEnum.MoveNext() && !backgroundWorker.CancellationPending) { var filePath = (string)(filesEnum.Current); if (Directory.Exists(filePath)) { var filesInDirectoryEnum = Directory.GetFiles(filePath).GetEnumerator(); while (filesInDirectoryEnum.MoveNext() && !backgroundWorker.CancellationPending) { var filePathInDirectory = (string)(filesInDirectoryEnum.Current); if (Utils.GetExtension(filePathInDirectory).Contains("mp3")) { var track = new Track(filePathInDirectory); tempTrackCollection.SafeAdd(track); } } } else if (Utils.GetExtension(filePath).Contains("mp3")) { var track = new Track(filePath); tempTrackCollection.SafeAdd(track); } backgroundWorker.ReportProgress(250 * count++ / fileNames.Length); } _trackCollection.Concat(tempTrackCollection); _trackCollection.SortByName(); backgroundWorker.ReportProgress(250); _dataExtractionEngine.ExtractData(backgroundWorker, tempTrackCollection); RetrieveControlOnCollection(); _trackCollection.Purge(); return(_trackCollection); }