private void _view_RightClick(object sender, Gui.Misc.StringEventArgs e) { var selectedCollections = _model.SelectedCollections; CollectionEditArgs args; switch (e.Value) { case "Delete": if (selectedCollections == null) { return; } args = CollectionEditArgs.RemoveCollections(selectedCollections); break; case "Merge": if (selectedCollections == null) { return; } args = CollectionEditArgs.MergeCollections(selectedCollections, selectedCollections[0].Name); break; case "Intersect": if (selectedCollections == null) { return; } args = CollectionEditArgs.IntersectCollections(selectedCollections, selectedCollections[0].Name); break; case "Create": args = CollectionEditArgs.AddCollections(null); break; case "Rename": if (_view.SelectedCollection == null) { return; } args = CollectionEditArgs.RenameCollection(_view.SelectedCollection, null); break; case "Duplicate": if (_view.SelectedCollection == null) { return; } args = CollectionEditArgs.DuplicateCollection(_view.SelectedCollection); break; default: return; } _model.EmitCollectionEditing(args); }
private void _view_RightClick(object sender, Gui.Misc.StringEventArgs e) { var selectedCollections = _model.SelectedCollections; CollectionEditArgs args; switch (e.Value) { case "Delete": if (selectedCollections == null) { return; } args = CollectionEditArgs.RemoveCollections(selectedCollections); break; case "Merge": if (selectedCollections == null) { return; } args = CollectionEditArgs.MergeCollections(selectedCollections, selectedCollections[0].Name); break; case "Intersect": if (selectedCollections == null) { return; } args = CollectionEditArgs.IntersectCollections(selectedCollections, selectedCollections[0].Name); break; case "Inverse": if (selectedCollections == null) { return; } args = CollectionEditArgs.InverseCollections(selectedCollections, selectedCollections[0].Name); break; case "Difference": if (selectedCollections == null) { return; } args = CollectionEditArgs.DifferenceCollections(selectedCollections, selectedCollections[0].Name); break; case "Create": args = CollectionEditArgs.AddCollections(null); break; case "Rename": if (_view.SelectedCollection == null) { return; } args = CollectionEditArgs.RenameCollection(_view.SelectedCollection, null); break; case "Duplicate": if (_view.SelectedCollection == null) { return; } args = CollectionEditArgs.DuplicateCollection(_view.SelectedCollection); break; case "Export": if (selectedCollections == null) { return; } args = CollectionEditArgsExtension.ExportBeatmaps(selectedCollections); break; case "Copy": if (selectedCollections == null) { return; } var tempFolder = Path.Combine(Path.GetTempPath(), "CMcollections"); if (Directory.Exists(tempFolder)) { Directory.Delete(tempFolder, true); } Directory.CreateDirectory(tempFolder); var fileName = Helpers.StripInvalidFileNameCharacters(selectedCollections[0].Name, "_"); var tempLocation = Path.Combine(tempFolder, $"{fileName}.osdb"); Initalizer.OsuFileIo.CollectionLoader.SaveOsdbCollection(selectedCollections, tempLocation); Clipboard.SetFileDropList(new StringCollection { tempLocation }); return; default: return; } _model.EmitCollectionEditing(args); }