private void LoadBackup(object sender, RoutedEventArgs e) { try { var paths = GetCurrentMaps(); if (paths.Length > 1) { throw new Exception($"Can't load backup into multiple beatmaps. You currently have {paths.Length} beatmaps selected."); } var backupPaths = IOHelper.BeatmapFileDialog(SettingsManager.GetBackupsPath(), false); if (backupPaths.Length == 1) { try { BackupManager.LoadMapBackup(backupPaths[0], paths[0], false); } catch (BeatmapIncompatibleException ex) { ex.Show(); var result = MessageBox.Show("Do you want to load the backup anyways?", "Load backup", MessageBoxButton.YesNo); if (result == MessageBoxResult.Yes) { BackupManager.LoadMapBackup(backupPaths[0], paths[0], true); } else { return; } } Task.Factory.StartNew(() => MessageQueue.Enqueue("Backup successfully loaded!")); } } catch (Exception ex) { ex.Show(); } }
private void OpenBeatmap(object sender, RoutedEventArgs e) { string[] paths = IOHelper.BeatmapFileDialog(true); if (paths.Length != 0) { SetCurrentMaps(paths); } }
private void BeatmapBrowse4_Click(object sender, RoutedEventArgs e) { string[] paths = IOHelper.BeatmapFileDialog(restore: !SettingsManager.Settings.CurrentBeatmapDefaultFolder); if (paths.Length != 0) { BeatmapPathBox4.Text = string.Join("|", paths); } }
private void BaseBeatmapBrowse_Click(object sender, RoutedEventArgs e) { try { string[] paths = IOHelper.BeatmapFileDialog(restore: !SettingsManager.Settings.CurrentBeatmapDefaultFolder); if (paths.Length != 0) { Settings.BaseBeatmap = paths[0]; } } catch (Exception ex) { ex.Show(); } }
private void SelectedImportPathBrowse_Click(object sender, RoutedEventArgs e) { try { string[] paths = IOHelper.BeatmapFileDialog(restore: !SettingsManager.Settings.CurrentBeatmapDefaultFolder); if (paths.Length != 0) { SelectedImportPathBox.Text = paths[0]; } } catch (Exception) { } }
private void BeatmapToBrowse_Click(object sender, RoutedEventArgs e) { try { var paths = IOHelper.BeatmapFileDialog(true, !SettingsManager.Settings.CurrentBeatmapDefaultFolder); if (paths.Length != 0) { BeatmapToBox.Text = string.Join("|", paths); } } catch (Exception) { // ignored } }
private void BeatmapFromBrowse_Click(object sender, RoutedEventArgs e) { try { var paths = IOHelper.BeatmapFileDialog(restore: !SettingsManager.Settings.CurrentBeatmapDefaultFolder); if (paths.Length != 0) { BeatmapFromBox.Text = paths[0]; } } catch (Exception) { // ignored } }
public TimingCopierVm() { _importPath = ""; _exportPath = ""; _resnapMode = "Number of beats between objects stays the same"; _snap1 = 16; _snap2 = 12; ImportLoadCommand = new CommandImplementation( _ => { try { string path = IOHelper.GetCurrentBeatmap(); if (path != "") { ImportPath = path; } } catch (Exception ex) { ex.Show(); } }); ImportBrowseCommand = new CommandImplementation( _ => { string[] paths = IOHelper.BeatmapFileDialog(restore: !SettingsManager.Settings.CurrentBeatmapDefaultFolder); if (paths.Length != 0) { ImportPath = paths[0]; } }); ExportLoadCommand = new CommandImplementation( _ => { try { string path = IOHelper.GetCurrentBeatmap(); if (path != "") { ExportPath = path; } } catch (Exception ex) { ex.Show(); } }); ExportBrowseCommand = new CommandImplementation( _ => { string[] paths = IOHelper.BeatmapFileDialog(true, !SettingsManager.Settings.CurrentBeatmapDefaultFolder); if (paths.Length != 0) { ExportPath = string.Join("|", paths); } }); }
private void OpenBeatmap(object sender, RoutedEventArgs e) { try { string[] paths = IOHelper.BeatmapFileDialog(true); if (paths.Length != 0) { SetCurrentMaps(paths); } } catch (Exception ex) { ex.Show(); } }
public RhythmGuideVm() { GuideGeneratorArgs = new RhythmGuide.RhythmGuideGeneratorArgs(); ImportLoadCommand = new CommandImplementation( _ => { try { var path = IOHelper.GetCurrentBeatmap(); if (path != "") { GuideGeneratorArgs.Paths = new[] { path }; } } catch (Exception ex) { ex.Show(); } }); ImportBrowseCommand = new CommandImplementation( _ => { var paths = IOHelper.BeatmapFileDialog(true, !SettingsManager.Settings.CurrentBeatmapDefaultFolder); if (paths.Length != 0) { GuideGeneratorArgs.Paths = paths; } }); ExportLoadCommand = new CommandImplementation( _ => { try { var path = IOHelper.GetCurrentBeatmap(); if (path != "") { GuideGeneratorArgs.ExportPath = path; } } catch (Exception ex) { ex.Show(); } }); ExportBrowseCommand = new CommandImplementation( _ => { var paths = IOHelper.BeatmapFileDialog(restore: !SettingsManager.Settings.CurrentBeatmapDefaultFolder); if (paths.Length != 0) { GuideGeneratorArgs.ExportPath = paths[0]; } }); }
public MetadataManagerVm() { _importPath = ""; _exportPath = ""; _useComboColours = true; ComboColours = new ObservableCollection <ComboColour>(); SpecialColours = new ObservableCollection <SpecialColour>(); ImportLoadCommand = new CommandImplementation( _ => { var path = IOHelper.GetCurrentBeatmap(); if (path != "") { ImportPath = path; } }); ImportBrowseCommand = new CommandImplementation( _ => { var paths = IOHelper.BeatmapFileDialog(restore: !SettingsManager.Settings.CurrentBeatmapDefaultFolder); if (paths.Length != 0) { ImportPath = paths[0]; } }); ImportCommand = new CommandImplementation( _ => { ImportFromBeatmap(ImportPath); }); ExportLoadCommand = new CommandImplementation( _ => { var path = IOHelper.GetCurrentBeatmap(); if (path != "") { ExportPath = path; } }); ExportBrowseCommand = new CommandImplementation( _ => { var paths = IOHelper.BeatmapFileDialog(true, !SettingsManager.Settings.CurrentBeatmapDefaultFolder); if (paths.Length != 0) { ExportPath = string.Join("|", paths); } }); AddCommand = new CommandImplementation(_ => { if (ComboColours.Count >= 8) { return; } ComboColours.Add(ComboColours.Count > 0 ? new ComboColour(ComboColours[ComboColours.Count - 1].Color) : new ComboColour(Colors.White)); }); RemoveCommand = new CommandImplementation(_ => { if (ComboColours.Count > 0) { ComboColours.RemoveAt(ComboColours.Count - 1); } }); AddSpecialCommand = new CommandImplementation(_ => { SpecialColours.Add(SpecialColours.Count > 0 ? new SpecialColour(SpecialColours[SpecialColours.Count - 1].Color) : new SpecialColour(Colors.White)); }); RemoveSpecialCommand = new CommandImplementation(_ => { if (SpecialColours.Count > 0) { SpecialColours.RemoveAt(SpecialColours.Count - 1); } }); PropertyChanged += OnPropertyChanged; }
private static Grid AttachBeatmapBrowseHelp(TextBox textBox, PropertyInfo prop, object settings) { var grid = new Grid(); grid.ColumnDefinitions.Add(new ColumnDefinition { Width = new GridLength(1, GridUnitType.Star) }); grid.ColumnDefinitions.Add(new ColumnDefinition { Width = new GridLength(5, GridUnitType.Pixel) }); grid.ColumnDefinitions.Add(new ColumnDefinition { Width = new GridLength(1, GridUnitType.Auto) }); grid.ColumnDefinitions.Add(new ColumnDefinition { Width = new GridLength(5, GridUnitType.Pixel) }); grid.ColumnDefinitions.Add(new ColumnDefinition { Width = new GridLength(1, GridUnitType.Auto) }); textBox.MaxWidth = 200; Grid.SetColumn(textBox, 0); grid.Children.Add(textBox); var getButton = new Button { Cursor = Cursors.Hand, Style = Application.Current.FindResource("IconButton") as Style, VerticalAlignment = VerticalAlignment.Bottom, ToolTip = @"Fetch the selected beatmap from your osu! client.", Content = new PackIcon { Kind = PackIconKind.RestoreFromTrash, Width = 30, Height = 30, Cursor = Cursors.Hand, Foreground = Application.Current.FindResource("PrimaryHueMidBrush") as Brush }, Command = new CommandImplementation(_ => { try { string path = IOHelper.GetCurrentBeatmap(); if (!string.IsNullOrEmpty(path)) { textBox.Text = path; prop.SetValue(settings, path); } } catch (Exception ex) { ex.Show(); } }) }; Grid.SetColumn(getButton, 2); grid.Children.Add(getButton); var browseButton = new Button { Cursor = Cursors.Hand, Style = Application.Current.FindResource("IconButton") as Style, VerticalAlignment = VerticalAlignment.Bottom, ToolTip = @"Select beatmaps with File Explorer.", Content = new PackIcon { Kind = PackIconKind.Folder, Width = 30, Height = 30, Cursor = Cursors.Hand, Foreground = Application.Current.FindResource("PrimaryHueMidBrush") as Brush }, Command = new CommandImplementation(_ => { try { string[] paths = IOHelper.BeatmapFileDialog(restore: !SettingsManager.Settings.CurrentBeatmapDefaultFolder); if (paths.Length > 0) { textBox.Text = paths[0]; prop.SetValue(settings, paths[0]); } } catch (Exception ex) { ex.Show(); } }) }; Grid.SetColumn(browseButton, 4); grid.Children.Add(browseButton); return(grid); }