private void LoadItems(string fileName, LoRExtractor.AudioType audioType) { try { var entries = LoRExtractor.OpenDirectory(fileName, audioType); this.Dispatcher.Invoke(() => { try { AudioListView audioListView = new (); audioListView.ListViewTitle.Content = fileName; foreach (var entry in entries) { this._dataContainer = audioListView.ListViewContainer; this._dataContainer.Items.Add(entry); if (entry?.ArchiveEntry != null) { this.openArchiveFiles.Add(entry.ArchiveEntry.Parent); } } int itemCount = entries.Count; audioListView.ListViewStatus.Content = $"{itemCount} items total"; this.MainAppPanel.Children.Clear(); this.MainAppPanel.Children.Add(audioListView); this.ExportMenu.IsEnabled = true; } catch (Exception exception) { Console.WriteLine(exception); MessageBox.Show(exception.Message, "Error"); } finally { this.LoadVOMenuOption.IsEnabled = true; this.LoadSFXMenuOption.IsEnabled = true; } }); } catch (Exception exception) { Console.WriteLine(exception); MessageBox.Show(exception.Message, "Error"); } }
private void Load(LoRExtractor.AudioType audioType) { using CommonOpenFileDialog dialog = new () { InitialDirectory = "C:\\Riot Games\\", Title = "Please select Legends of Runeterra's root directory", IsFolderPicker = true }; if (dialog.ShowDialog() != CommonFileDialogResult.Ok) { return; } string fileName = dialog.FileName; this.ExportMenu.IsEnabled = false; foreach (var archiveFile in this.openArchiveFiles) { archiveFile.Dispose(); } this.openArchiveFiles.Clear(); this.MainAppPanel.Children.Clear(); GC.Collect(); GC.WaitForPendingFinalizers(); AppInitialBox initialBox = new (); LoadingBox loadingBox = new (); initialBox.ChildContainer.Child = loadingBox; this.MainAppPanel.Children.Add(initialBox); this.LoadVOMenuOption.IsEnabled = false; this.LoadSFXMenuOption.IsEnabled = false; Task.Run(() => this.LoadItems(fileName, audioType)); }