From e4a8daaba300832e3e1a72282f1fc8d9d6d8f233 Mon Sep 17 00:00:00 2001 From: Cj <161484149+CJ-SPT@users.noreply.github.com> Date: Wed, 26 Jun 2024 20:44:22 -0400 Subject: [PATCH] Fix some automapper bugs --- RecodeItGUI/GUI/Main.cs | 4 ++-- RecodeItLib/AutoMapper/ReCodeItAutoMapper.cs | 20 ++++---------------- 2 files changed, 6 insertions(+), 18 deletions(-) diff --git a/RecodeItGUI/GUI/Main.cs b/RecodeItGUI/GUI/Main.cs index 9157ac0..b0a32dc 100644 --- a/RecodeItGUI/GUI/Main.cs +++ b/RecodeItGUI/GUI/Main.cs @@ -842,7 +842,7 @@ public partial class ReCodeItForm : Form if (result != string.Empty) { AppSettings.AutoMapper.AssemblyPath = result; - TargetAssemblyPath.Text = result; + AutoMapperTargetPath.Text = result; } } @@ -853,7 +853,7 @@ public partial class ReCodeItForm : Form if (result != string.Empty) { AppSettings.AutoMapper.OutputPath = result; - RemapperOutputDirectoryPath.Text = result; + AutoMapperOuputPath.Text = result; } } diff --git a/RecodeItLib/AutoMapper/ReCodeItAutoMapper.cs b/RecodeItLib/AutoMapper/ReCodeItAutoMapper.cs index 65fa2a0..ea96167 100644 --- a/RecodeItLib/AutoMapper/ReCodeItAutoMapper.cs +++ b/RecodeItLib/AutoMapper/ReCodeItAutoMapper.cs @@ -46,12 +46,11 @@ public class ReCodeItAutoMapper TotalPropertyRenameCount = 0; var types = Module.GetTypes(); + AllTypes.AddRange(types); FindCompilerGeneratedObjects(types); - GetAllTypes(types); - - Logger.Log($"Found {CompilerGeneratedClasses.Count - AllTypes.Count} potential remappable types"); + Logger.Log($"Found {AllTypes.Count - CompilerGeneratedClasses.Count} potential remappable types"); Logger.Log($"Found {CompilerGeneratedClasses.Count} compiler generated objects"); foreach (var type in types) @@ -78,19 +77,6 @@ public class ReCodeItAutoMapper WriteChanges(); } - private void GetAllTypes(IEnumerable types) - { - AllTypes.AddRange(types); - - foreach (var type in types) - { - if (type.HasNestedTypes) - { - GetAllTypes(type.NestedTypes); - } - } - } - /// /// Finds any compiler generated code so we can ignore it, its mostly LINQ garbage /// @@ -154,6 +140,8 @@ public class ReCodeItAutoMapper //Logger.Log($"Paremeter Names: {string.Join(", ", parmNames)}"); //Logger.Log($"Paremeter Types: {string.Join(", ", parmTypes)}\n"); + if (parm.Type.TryGetTypeDef() is null) continue; + var mapPair = new MappingPair( parm.Type.TryGetTypeDef(), parm.Name,