From 4221435793b4ac4aa7fbd411194789fbaa1333cb Mon Sep 17 00:00:00 2001 From: glassfish777 Date: Thu, 3 Aug 2023 19:20:44 -0700 Subject: [PATCH] fix: Add custom classes to Add Chunk dialog They were not being included before making it impossible to add custom class chunks(since 7.2) --- WolvenKit/Forms/Dialog/frmAddChunk.cs | 30 +++++++++++++++++---------- 1 file changed, 19 insertions(+), 11 deletions(-) diff --git a/WolvenKit/Forms/Dialog/frmAddChunk.cs b/WolvenKit/Forms/Dialog/frmAddChunk.cs index 8a2a73bf..8c157c5f 100644 --- a/WolvenKit/Forms/Dialog/frmAddChunk.cs +++ b/WolvenKit/Forms/Dialog/frmAddChunk.cs @@ -9,8 +9,12 @@ namespace WolvenKit { public partial class frmAddChunk : Form { - private string[] classTypes = null; - private string[] enumTypes = null; + //private string[] classTypes = null; + //private string[] enumTypes = null; + private List vanillaClasses = null; + private List customClasses = null; + private List vanillaEnums = null; + private List customEnums = null; public frmAddChunk(List list = null, bool isVariant = false, bool allowEditName = false) { InitializeComponent(); @@ -24,16 +28,20 @@ public frmAddChunk(List list = null, bool isVariant = false, bool allowE { txName.Enabled = false; } - if (list == null) + if (vanillaClasses == null) { - list = AssemblyDictionary.TypeNames; + vanillaClasses = AssemblyDictionary.TypeNames; } - list.Sort(); - classTypes = list.ToArray(); + vanillaClasses.Sort(); - list = AssemblyDictionary.EnumNames; - list.Sort(); - enumTypes = list.ToArray(); + customClasses = CR2WManager.TypeNames; + customClasses.Sort(); + + + vanillaEnums = AssemblyDictionary.EnumNames; + vanillaEnums.Sort(); + customEnums = CR2WManager.EnumNames; + customEnums.Sort(); UpdateTypeChoices(); } @@ -42,11 +50,11 @@ private void UpdateTypeChoices() txType.Items.Clear(); if (checkEnum.Checked) { - txType.Items.AddRange(enumTypes); + txType.Items.AddRange(vanillaEnums.Concat(customEnums).Distinct().ToArray()); } else { - txType.Items.AddRange(classTypes); + txType.Items.AddRange(vanillaClasses.Concat(customClasses).Distinct().ToArray()); } if (txType.SelectedIndex < 0 && txType.Items.Count > 0) txType.SelectedIndex = 0;