private void Button_SelectAFSClick(object sender, RoutedEventArgs e) { var dialog = new Ookii.Dialogs.Wpf.VistaOpenFileDialog { Filter = "AFS files (*.afs)|*.afs|All files (*.*)|*.*" }; if (dialog.ShowDialog() == false) { return; } if (!dialog.FileName.ToLower().EndsWith(".afs")) { MessageBox.Show("Pick an 'AFS' file", "Try Again"); return; } var data = File.ReadAllBytes(dialog.FileName); if (AfsArchive.TryFromFile(data, out var afsArchive)) { currentAfs = afsArchive; Button_ExportAFS.IsEnabled = true; if (ListBox_CurrentFNT.SelectedItem == null) { return; } var currentSubtitleIndex = currentFnt.entryTable.IndexOf((TableEntry)ListBox_CurrentFNT.SelectedItem); if (currentSubtitleIndex == -1) { return; } ListBox_CurrentFNT.SelectedIndex = -1; ListBox_CurrentFNT.SelectedIndex = currentSubtitleIndex; } ; }
private void ClearData() { openedFnts = new List <FNT>(); initialFntsOpenedState = new List <FNT>(); currentAfs = null; Button_OpenAFS.IsEnabled = false; Button_ExportAFS.IsEnabled = false; Button_ExportChangedFNTs.IsEnabled = false; Button_PreviewADX.IsEnabled = false; Button_AddEntry.IsEnabled = false; ClearUIData(); ListBox_AllFNTS.ItemsSource = null; ListBox_CurrentFNT.ItemsSource = null; }