More filtering

This commit is contained in:
Cj 2024-06-15 17:36:40 -04:00
parent 75f2c16d80
commit bfd86d7f2f
3 changed files with 21 additions and 9 deletions

View File

@ -9,7 +9,7 @@
</PropertyGroup> </PropertyGroup>
<Target Name="PostBuild" AfterTargets="PostBuildEvent"> <Target Name="PostBuild" AfterTargets="PostBuildEvent">
<Exec Command="xcopy &quot;$(SolutionDir)Templates&quot; &quot;$(TargetDir)Data&quot; /E /I /Y /D" /> <Exec Command="xcopy &quot;$(SolutionDir)Templates&quot; &quot;$(TargetDir)Data&quot; /E /I /Y" />
</Target> </Target>
<ItemGroup> <ItemGroup>

View File

@ -126,16 +126,27 @@ public class ReCodeItAutoMapper
{ {
// Filter types to the ones we're looking for // Filter types to the ones we're looking for
var mappingPairs = MappingPairs 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 // Filter based on length, short lengths dont make good class names
.Where(pair => pair.Name.Length >= Settings.MinLengthToMatch) .Where(pair => pair.Name.Length >= Settings.MinLengthToMatch)
// Filter based on direct name blacklist // Filter out anything that doesnt start with our specified tokens (Where pair.Type.Name
.Where(pair => !Settings.PropertyFieldBlackList.Any(token => pair.Name.ToLower().StartsWith(token.ToLower()))); // 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) foreach (var pair in mappingPairs)
{ {

View File

@ -45,8 +45,9 @@
"Template", "Template",
"Condition", "Condition",
"Conditions", "Conditions",
"counter", "Counter",
"Instance", "Instance",
"Command"
] ]
} }
} }