Example #1
0
        private void OpenLib_Click(object sender, RoutedEventArgs e)
        {
            var openDialog = new OpenFileDialog();

            openDialog.Filter          = "Gran Turismo BGM Library (*.lib)|*.lib";
            openDialog.CheckFileExists = true;
            openDialog.CheckPathExists = true;

            if (openDialog.ShowDialog() == true)
            {
                BGML bgml;
                try
                {
                    bgml = BGML.ReadFromFile(openDialog.FileName);
                }
                catch (Exception ex)
                {
                    MessageBox.Show($"Error occured while loading file: {ex.Message}", "A not so friendly prompt", MessageBoxButton.OK, MessageBoxImage.Error);
                    return;
                }


                Library = bgml;

                UpdateTrackList();
                UpdatePlaylistsList();

                if (bgml.Format == LibraryTrackFormat.SXDF)
                {
                    MessageBox.Show($"This library uses SXDF headers (GTSP), and contains track metadata in it. It cannot be saved yet.", "Cannot save", MessageBoxButton.OK, MessageBoxImage.Information);
                    menuItem_Save.IsEnabled = false;
                }
                else if (bgml.HasExtraTrackMetadata)
                {
                    MessageBox.Show($"This library contains track metadata for each track. It cannot be saved yet.", "Cannot save", MessageBoxButton.OK, MessageBoxImage.Information);
                    menuItem_Save.IsEnabled = false;
                }
                else
                {
                    menuItem_Save.IsEnabled = true;
                }
            }
        }
 public PlaylistEditWindow(BGML library, BGML_Playlist playlist)
 {
     InitializeComponent();
     _library  = library;
     _playlist = playlist;
 }