public static void DeleteBeatmap(Beatmap b, bool allDifficulties) { SongWatcher.EnableRaisingEvents = false; AudioEngine.FreeMusic(); if (allDifficulties) { if (!b.BeatmapPresent || b.ContainingFolderAbsolute.EndsWith(BeatmapManager.SongsDirectory) || b.InOszContainer) { try { if (b.InOszContainer) { AudioEngine.Stop(); AudioEngine.FreeMusic(); Osz2Factory.CloseMapPackage(b.Package); RecycleBin.SendSilent(b.ContainingFolderAbsolute); FolderFileCount--; } else if (!b.ContainingFolderAbsolute.EndsWith(BeatmapManager.SongsDirectory)) { RecycleBin.SendSilent(b.ContainingFolderAbsolute); FolderFileCount--; } else { b.DeleteFile(b.AudioFilename); } } catch { } } else { try { RecycleBin.SendSilent(b.ContainingFolderAbsolute); FolderFileCount--; } catch (Exception) { } } } else { b.DeleteFile(Current.Filename); } List <Beatmap> matches = allDifficulties ? Beatmaps.FindAll(bm => bm.ContainingFolder == b.ContainingFolder) : new List <Beatmap>() { Current }; foreach (Beatmap bm in matches) { Remove(bm); BeatmapManager.Root.Beatmaps.Remove(bm); } SongWatcher.EnableRaisingEvents = true; if (OnDeletedBeatmaps != null && matches.Count > 0) { OnDeletedBeatmaps(null, matches); } }