Fix some automapper bugs

This commit is contained in:
Cj 2024-06-26 20:44:22 -04:00
parent d33f1f3c9b
commit e4a8daaba3
2 changed files with 6 additions and 18 deletions

View File

@ -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;
}
}

View File

@ -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<TypeDef> types)
{
AllTypes.AddRange(types);
foreach (var type in types)
{
if (type.HasNestedTypes)
{
GetAllTypes(type.NestedTypes);
}
}
}
/// <summary>
/// Finds any compiler generated code so we can ignore it, its mostly LINQ garbage
/// </summary>
@ -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,