diff --git a/MainWindow.xaml b/MainWindow.xaml
index 2d33d1d..8dc266b 100644
--- a/MainWindow.xaml
+++ b/MainWindow.xaml
@@ -5,6 +5,7 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:adonisUi="clr-namespace:AdonisUI;assembly=AdonisUI"
xmlns:adonisControls="clr-namespace:AdonisUI.Controls;assembly=AdonisUI"
+ xmlns:adonisExtensions="clr-namespace:AdonisUI.Extensions;assembly=AdonisUI"
Closed="OnWindowClosed"
Title="PD2 Soundbank Editor"
Height="360"
@@ -55,43 +56,21 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -104,6 +83,7 @@
+
diff --git a/MainWindow.xaml.cs b/MainWindow.xaml.cs
index 9778bca..0a40359 100644
--- a/MainWindow.xaml.cs
+++ b/MainWindow.xaml.cs
@@ -9,6 +9,7 @@
using System.Linq;
using System.Net;
using System.Reflection;
+using System.Text.RegularExpressions;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Media;
@@ -106,6 +107,7 @@ private void CommandSaveCanExecute(object sender, System.Windows.Input.CanExecut
private void CommandSaveExecuted(object sender, System.Windows.Input.ExecutedRoutedEventArgs e) {
soundBank.Save(soundBank.FilePath);
+ Title = $"PD2 Soundbank Editor - {Path.GetFileName(soundBank.FilePath)}";
}
private void CommandSaveAsCanExecute(object sender, System.Windows.Input.CanExecuteRoutedEventArgs e) {
e.CanExecute = soundBank != null && soundBank.StreamInfos.Count > 0;
@@ -145,7 +147,7 @@ private void OnAboutButtonClick(object sender, RoutedEventArgs e) {
}
private void OnExtractButtonClick(object sender, RoutedEventArgs e) {
- DoGenericProcessing(true, ExtractStreams, OnExtractStreamsFinished, ((Button)sender) == extractAllButton ? soundBank.StreamInfos : listView.SelectedItems.Cast());
+ DoGenericProcessing(true, ExtractStreams, OnExtractStreamsFinished, ((Button)sender) == extractAllButton ? soundBank.StreamInfos : dataGrid.SelectedItems.Cast());
}
private void OnReplaceButtonClick(object sender, RoutedEventArgs e) {
@@ -164,7 +166,7 @@ private void OnReplaceButtonClick(object sender, RoutedEventArgs e) {
return;
}
var data = File.ReadAllBytes(fileName);
- foreach (var info in listView.SelectedItems.Cast()) {
+ foreach (var info in dataGrid.SelectedItems.Cast()) {
info.Data = data;
info.ReplacementFile = fileNameNoExt + ".wav";
info.ConvertedFilePath = null;
@@ -173,6 +175,19 @@ private void OnReplaceButtonClick(object sender, RoutedEventArgs e) {
Title = $"PD2 Soundbank Editor - {Path.GetFileName(soundBank.FilePath)}*";
}
+ private void OnFilterTextBoxChanged(object sender, RoutedEventArgs e) {
+ var text = (sender as TextBox).Text;
+ if (text.Length > 0) {
+ var rx = new Regex(text, RegexOptions.Compiled);
+ var filtered = soundBank.StreamInfos.Where(info => rx.Match(info.Note).Success || rx.Match(info.Id.ToString()).Success);
+ dataGrid.ItemsSource = filtered;
+ dataGrid.DataContext = filtered;
+ } else {
+ dataGrid.ItemsSource = soundBank.StreamInfos;
+ dataGrid.DataContext = soundBank.StreamInfos;
+ }
+ }
+
private void OnPlayButtonClick(object sender, RoutedEventArgs e) {
if (!converterAvailable) {
return;
@@ -223,20 +238,9 @@ private void OnRecentFileClick(object sender, RoutedEventArgs e) {
}
}
- private void OnListViewSelectionChanged(object sender, SelectionChangedEventArgs e) {
- replaceSelectedButton.IsEnabled = converterAvailable && listView.SelectedItems.Count > 0;
- extractSelectedButton.IsEnabled = converterAvailable && listView.SelectedItems.Count > 0;
- }
-
- private void OnListViewSizeChanged(object sender, SizeChangedEventArgs e) {
- ListView listView = sender as ListView;
- GridView gridView = listView.View as GridView;
-
- gridView.Columns[0].Width = 40;
- var workingWidth = Math.Max(0, listView.ActualWidth - SystemParameters.VerticalScrollBarWidth * 2 - gridView.Columns[0].Width - 16);
- for (var i = 1; i < gridView.Columns.Count; i++) {
- gridView.Columns[i].Width = workingWidth / (gridView.Columns.Count - 1);
- }
+ private void OnDataGridSelectionChanged(object sender, SelectionChangedEventArgs e) {
+ replaceSelectedButton.IsEnabled = converterAvailable && dataGrid.SelectedItems.Count > 0;
+ extractSelectedButton.IsEnabled = converterAvailable && dataGrid.SelectedItems.Count > 0;
}
private void OnWindowClosed(object sender, EventArgs e) {
@@ -318,9 +322,9 @@ public void OnSoundBankLoaded(object sender, RunWorkerCompletedEventArgs e) {
Title = $"PD2 Soundbank Editor - {Path.GetFileName(soundBank.FilePath)}";
var containsEmedded = soundBank.StreamInfos.Count > 0;
- listView.ItemsSource = soundBank.StreamInfos;
- listView.DataContext = soundBank.StreamInfos;
+ OnFilterTextBoxChanged(filterTextBox, null);
extractAllButton.IsEnabled = converterAvailable && containsEmedded;
+ filterTextBox.IsEnabled = containsEmedded;
if (!containsEmedded) {
MessageBox.Show($"This soundbank does not contain any embedded streams.", "Information", MessageBoxButton.OK, MessageBoxImage.Warning);
}
diff --git a/PD2SoundBankEditor.csproj b/PD2SoundBankEditor.csproj
index f339199..aed39e5 100644
--- a/PD2SoundBankEditor.csproj
+++ b/PD2SoundBankEditor.csproj
@@ -6,7 +6,7 @@
true
PD2SoundBankEditor
- 0.9.0
+ 1.0.0
1.0.0.0
1.0.0.0
en