From bfd86d7f2f844569c8151a30155f135549cf7858 Mon Sep 17 00:00:00 2001 From: Cj <161484149+CJ-SPT@users.noreply.github.com> Date: Sat, 15 Jun 2024 17:36:40 -0400 Subject: [PATCH] More filtering --- RecodeItGUI/ReCodeItGUI.csproj | 2 +- RecodeItLib/AutoMapper/ReCodeItAutoMapper.cs | 25 ++++++++++++++------ Templates/Settings.jsonc | 3 ++- 3 files changed, 21 insertions(+), 9 deletions(-) diff --git a/RecodeItGUI/ReCodeItGUI.csproj b/RecodeItGUI/ReCodeItGUI.csproj index c7dfacc..1903880 100644 --- a/RecodeItGUI/ReCodeItGUI.csproj +++ b/RecodeItGUI/ReCodeItGUI.csproj @@ -9,7 +9,7 @@ - + diff --git a/RecodeItLib/AutoMapper/ReCodeItAutoMapper.cs b/RecodeItLib/AutoMapper/ReCodeItAutoMapper.cs index 09f8baa..84f6a44 100644 --- a/RecodeItLib/AutoMapper/ReCodeItAutoMapper.cs +++ b/RecodeItLib/AutoMapper/ReCodeItAutoMapper.cs @@ -126,16 +126,27 @@ public class ReCodeItAutoMapper { // Filter types to the ones we're looking for var mappingPairs = MappingPairs - .Where(pair => Settings.TokensToMatch.Any(token => pair.Type.Name.StartsWith(token))) - - // Filter out anything that has the same name as the type, we cant remap those - .Where(pair => !Settings.TokensToMatch.Any(token => pair.Name.ToLower().StartsWith(token.ToLower()))) - // Filter based on length, short lengths dont make good class names .Where(pair => pair.Name.Length >= Settings.MinLengthToMatch) - // Filter based on direct name blacklist - .Where(pair => !Settings.PropertyFieldBlackList.Any(token => pair.Name.ToLower().StartsWith(token.ToLower()))); + // Filter out anything that doesnt start with our specified tokens (Where pair.Type.Name + // is the property Type name `Class1202` and token is start identifer we are looking for `GClass` + .Where(pair => Settings.TokensToMatch + .Any(token => pair.Type.Name.StartsWith(token))) + + // Filter out anything that has the same name as the type, we cant remap those + .Where(pair => !Settings.TokensToMatch + .Any(token => pair.Name.ToLower().StartsWith(token.ToLower()))) + + // Filter based on direct name blacklist (Where pair.Name is the property name and token + // is blacklisted item `Columns` + .Where(pair => !Settings.PropertyFieldBlackList + .Any(token => pair.Name.ToLower().StartsWith(token.ToLower()))) + + // We only want types once, so make it unique + .GroupBy(pair => pair.Type.FullName) + .Select(group => group.First()) + .ToList(); foreach (var pair in mappingPairs) { diff --git a/Templates/Settings.jsonc b/Templates/Settings.jsonc index 4f45899..ecc4421 100644 --- a/Templates/Settings.jsonc +++ b/Templates/Settings.jsonc @@ -45,8 +45,9 @@ "Template", "Condition", "Conditions", - "counter", + "Counter", "Instance", + "Command" ] } }