Skip to content

Commit

Permalink
fix: Add custom classes to Add Chunk dialog
Browse files Browse the repository at this point in the history
They were not being included before making it impossible to add custom class chunks(since 7.2)
  • Loading branch information
glassfish777 committed Aug 4, 2023
1 parent 8b3ed4f commit 4221435
Showing 1 changed file with 19 additions and 11 deletions.
30 changes: 19 additions & 11 deletions WolvenKit/Forms/Dialog/frmAddChunk.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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<string> vanillaClasses = null;
private List<string> customClasses = null;
private List<string> vanillaEnums = null;
private List<string> customEnums = null;
public frmAddChunk(List<string> list = null, bool isVariant = false, bool allowEditName = false)
{
InitializeComponent();
Expand All @@ -24,16 +28,20 @@ public frmAddChunk(List<string> 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();
}

Expand All @@ -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;
Expand Down

0 comments on commit 4221435

Please sign in to comment.