From 26b0c792bf46ee786ca34ca3b154a4b1a8f00ac2 Mon Sep 17 00:00:00 2001 From: PaRcS Date: Tue, 31 Aug 2021 18:58:29 +0200 Subject: [PATCH] Fixed non scaleable songsTreeView. Added section count on songsTreeView sections. Fixed bug where file that is not found result in crashing. --- .../PistolWhipModSelector/MainForm.Designer.cs | 2 ++ PistolWhipModSelector/PistolWhipModSelector/MainForm.cs | 6 ++++-- .../PistolWhipModSelector/MainForm.resx | 9 --------- .../PistolWhipModSelector/PistolWhipModSelector.csproj | 2 +- .../PistolWhipModSelector/Properties/AssemblyInfo.cs | 4 ++-- .../SaveOriginalFiles/ReadAllAudioSongs.cs | 8 ++++++-- 6 files changed, 15 insertions(+), 16 deletions(-) diff --git a/PistolWhipModSelector/PistolWhipModSelector/MainForm.Designer.cs b/PistolWhipModSelector/PistolWhipModSelector/MainForm.Designer.cs index cf8ee09..125ebb2 100644 --- a/PistolWhipModSelector/PistolWhipModSelector/MainForm.Designer.cs +++ b/PistolWhipModSelector/PistolWhipModSelector/MainForm.Designer.cs @@ -207,6 +207,8 @@ private void InitializeComponent() // // songsTreeView // + this.songsTreeView.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left))); this.songsTreeView.Location = new System.Drawing.Point(12, 44); this.songsTreeView.Name = "songsTreeView"; this.songsTreeView.Size = new System.Drawing.Size(309, 384); diff --git a/PistolWhipModSelector/PistolWhipModSelector/MainForm.cs b/PistolWhipModSelector/PistolWhipModSelector/MainForm.cs index 34c7a23..cd52625 100644 --- a/PistolWhipModSelector/PistolWhipModSelector/MainForm.cs +++ b/PistolWhipModSelector/PistolWhipModSelector/MainForm.cs @@ -10,6 +10,7 @@ using PistolWhipModSelector.Settings; using PistolWhipModSelector.SaveOriginalFiles; using System.IO; +using System.Reflection; namespace PistolWhipModSelector { @@ -22,6 +23,7 @@ public MainForm(ModsFolder modsFolder) { this.modsFolder = modsFolder; InitializeComponent(); + this.Text = "Pistol Whip Custom Songs v" + Assembly.GetExecutingAssembly().GetName().Version.ToString(); } private void MainForm_Load(object sender, EventArgs e) @@ -82,7 +84,7 @@ private void FillOriginalSongNamesList() newNode.Tag = properties.ID; foreach (TreeNode node in songsTreeView.Nodes) { - if (node.Text == properties.AudioSectionName) + if (node.Text.StartsWith(properties.AudioSectionName)) { node.Nodes.Add(newNode); found = true; @@ -91,7 +93,7 @@ private void FillOriginalSongNamesList() } if (!found) { - TreeNode newSection = new TreeNode(properties.AudioSectionName); + TreeNode newSection = new TreeNode(properties.AudioSectionName + " (" + audioLines.Where(x=> x.AudioSectionName == properties.AudioSectionName).Count() + ")"); newSection.Nodes.Add(newNode); songsTreeView.Nodes.Add(newSection); diff --git a/PistolWhipModSelector/PistolWhipModSelector/MainForm.resx b/PistolWhipModSelector/PistolWhipModSelector/MainForm.resx index 690d71e..6539e12 100644 --- a/PistolWhipModSelector/PistolWhipModSelector/MainForm.resx +++ b/PistolWhipModSelector/PistolWhipModSelector/MainForm.resx @@ -126,13 +126,4 @@ True - - True - - - True - - - True - \ No newline at end of file diff --git a/PistolWhipModSelector/PistolWhipModSelector/PistolWhipModSelector.csproj b/PistolWhipModSelector/PistolWhipModSelector/PistolWhipModSelector.csproj index 44a08f5..9c8fbcb 100644 --- a/PistolWhipModSelector/PistolWhipModSelector/PistolWhipModSelector.csproj +++ b/PistolWhipModSelector/PistolWhipModSelector/PistolWhipModSelector.csproj @@ -24,7 +24,7 @@ false true 0 - 1.4.0.0 + 1.4.1.0 false true true diff --git a/PistolWhipModSelector/PistolWhipModSelector/Properties/AssemblyInfo.cs b/PistolWhipModSelector/PistolWhipModSelector/Properties/AssemblyInfo.cs index 4e56dc9..a505aac 100644 --- a/PistolWhipModSelector/PistolWhipModSelector/Properties/AssemblyInfo.cs +++ b/PistolWhipModSelector/PistolWhipModSelector/Properties/AssemblyInfo.cs @@ -32,5 +32,5 @@ // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.4.0.0")] -[assembly: AssemblyFileVersion("1.4.0.0")] +[assembly: AssemblyVersion("1.4.1.0")] +[assembly: AssemblyFileVersion("1.4.1.0")] diff --git a/PistolWhipModSelector/PistolWhipModSelector/SaveOriginalFiles/ReadAllAudioSongs.cs b/PistolWhipModSelector/PistolWhipModSelector/SaveOriginalFiles/ReadAllAudioSongs.cs index 07dd043..9bd8aac 100644 --- a/PistolWhipModSelector/PistolWhipModSelector/SaveOriginalFiles/ReadAllAudioSongs.cs +++ b/PistolWhipModSelector/PistolWhipModSelector/SaveOriginalFiles/ReadAllAudioSongs.cs @@ -51,8 +51,12 @@ private List GetAudioLines(bool tryAgain = false) if (memoryAudioSectionFound && !String.IsNullOrWhiteSpace(line) && line.Contains("\\Music\\") && !line.Contains("sfx_") && !line.Contains("\\TestContent\\") && !line.Contains("mus_landing_area_lp") && !line.Contains("mus_tutorial") && !line.Contains("visualizer")) { AudioLineProperties currentAudioLine = this.TrimAudioLines(line); - if(!audios.Exists(x=> x.ID == currentAudioLine.ID)) - audios.Add(currentAudioLine); + if (!audios.Exists(x => x.ID == currentAudioLine.ID)) + { + if (File.Exists(GlobalVariables.SongsFolderPath + @"\" + currentAudioLine.ID + ".wem")){ + audios.Add(currentAudioLine); + } + } } else {