Make build friendly
This commit is contained in:
parent
5ccf9f5e25
commit
50c2f2fcc5
@ -12,4 +12,8 @@
|
|||||||
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
|
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
|
<Target Name="PostBuild" AfterTargets="PostBuildEvent">
|
||||||
|
<Exec Command="xcopy "$(SolutionDir)Templates" "$(TargetDir)Data" /E /I /Y" />
|
||||||
|
</Target>
|
||||||
|
|
||||||
</Project>
|
</Project>
|
||||||
|
@ -6,9 +6,7 @@ namespace AssemblyRemapper.Models;
|
|||||||
internal class ScoringModel
|
internal class ScoringModel
|
||||||
{
|
{
|
||||||
public string ProposedNewName { get; set; }
|
public string ProposedNewName { get; set; }
|
||||||
public RemapModel Remap { get; set; }
|
|
||||||
public int Score { get; set; } = 0;
|
public int Score { get; set; } = 0;
|
||||||
|
|
||||||
public TypeDefinition Definition { get; set; }
|
public TypeDefinition Definition { get; set; }
|
||||||
public RemapModel RemapModel { get; internal set; }
|
public RemapModel RemapModel { get; internal set; }
|
||||||
|
|
||||||
|
@ -251,13 +251,10 @@ internal class Remapper
|
|||||||
Logger.Log("-----------------------------------------------", ConsoleColor.Green);
|
Logger.Log("-----------------------------------------------", ConsoleColor.Green);
|
||||||
Logger.Log($"Renaming {highestScore.Definition.Name} to {highestScore.ProposedNewName}", ConsoleColor.Green);
|
Logger.Log($"Renaming {highestScore.Definition.Name} to {highestScore.ProposedNewName}", ConsoleColor.Green);
|
||||||
|
|
||||||
|
RenameService.RenameAllFields(highestScore.RemapModel, DataProvider.ModuleDefinition.Types);
|
||||||
|
RenameService.RenameAllProperties(highestScore.RemapModel, DataProvider.ModuleDefinition.Types);
|
||||||
highestScore.Definition.Name = highestScore.ProposedNewName;
|
highestScore.Definition.Name = highestScore.ProposedNewName;
|
||||||
|
|
||||||
foreach (var score in nextHighestScores)
|
|
||||||
{
|
|
||||||
Logger.Log($"Alternative match `{score.Definition.Name}` for `{highestScore.ProposedNewName}`", ConsoleColor.Yellow);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (DataProvider.AppSettings.ScoringMode)
|
if (DataProvider.AppSettings.ScoringMode)
|
||||||
{
|
{
|
||||||
scores.Remove(highestScore);
|
scores.Remove(highestScore);
|
||||||
|
@ -19,8 +19,12 @@ internal static class RenameService
|
|||||||
{
|
{
|
||||||
if (field.FieldType.ToString() == remap.NewTypeName)
|
if (field.FieldType.ToString() == remap.NewTypeName)
|
||||||
{
|
{
|
||||||
Logger.Log($"Renaming Field: `{field.Name}` on Type `{type}`");
|
var newFieldName = GetNewFieldName(remap.NewTypeName, field.IsPrivate, fieldCount);
|
||||||
field.Name = GetNewFieldName(remap.NewTypeName, field.IsPrivate, fieldCount);
|
|
||||||
|
Logger.Log($"Renaming: `{field.Name}` on Type `{type}` to {remap.NewTypeName}");
|
||||||
|
|
||||||
|
field.Name = newFieldName;
|
||||||
|
|
||||||
fieldCount++;
|
fieldCount++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
46
Templates/MappingTemplate.jsonc
Normal file
46
Templates/MappingTemplate.jsonc
Normal file
@ -0,0 +1,46 @@
|
|||||||
|
[
|
||||||
|
// TEMPLATE
|
||||||
|
// NOTE: You only need to add the properties you need inside of `SearchParams`
|
||||||
|
{
|
||||||
|
"NewTypeName": "TEMPLATE", // This is the name we want to change it to
|
||||||
|
"OriginalTypeName": "", // This is the name of the object in the assembly, Can be used to store what type you're changing as its not read unless "UseDirectRename" is true, it is also written to after remapping
|
||||||
|
"UseForceRename": false, // If this is true, directly remap using the name in the assembly from the above property
|
||||||
|
"SearchParams": {
|
||||||
|
"IsPublic": true, // Is the Type public?
|
||||||
|
"IsAbstract": false, // Is the Type Abstract?
|
||||||
|
"IsInterface": false, // Is the Type an Interface?
|
||||||
|
"IsEnum": false, // Is the Type an Enum?
|
||||||
|
"IsNested": false, // Is the Type Nested?
|
||||||
|
"ParentName": "", // The Name of the parent type if it is nested, can be left empty
|
||||||
|
"IsSealed": false, // Is the Type Sealed?
|
||||||
|
"HasAttribute": false, // Does the Type have an attribute?
|
||||||
|
"IsDerived": true, // Does the Type inherit from another Type?
|
||||||
|
"HasGenericParameters": false, // Does the type have generic parameters?
|
||||||
|
"MethodNamesToMatch": [ // This is a list of methods we want to match
|
||||||
|
"Foo"
|
||||||
|
],
|
||||||
|
"MethodNamesToIgnore": [ // This is a list of methods we want to ignore
|
||||||
|
"Foo",
|
||||||
|
"*" // Ignore all Types that have methods, this wildcard can be used on any ignore list
|
||||||
|
],
|
||||||
|
"FieldNamesToMatch": [ // This is a list of fields we want to match
|
||||||
|
"_fooBar"
|
||||||
|
],
|
||||||
|
"FieldNamesToIgnore": [ // This is a list of fields we want to ignore
|
||||||
|
"Foo"
|
||||||
|
],
|
||||||
|
"PropertyNamesToMatch": [ // This is a list of properties we want to match
|
||||||
|
"FooBar"
|
||||||
|
],
|
||||||
|
"PropertyNamesToIgnore": [ // This is a list of properties we want to ignore
|
||||||
|
"Foo"
|
||||||
|
],
|
||||||
|
"NestedTypesToMatch": [ // This is a list of nested types we want to match
|
||||||
|
"FooBarFoo"
|
||||||
|
],
|
||||||
|
"NestedTypesToIgnore": [ // This is a list of nested types we want to match ignore
|
||||||
|
"FooBarFoo"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
9
Templates/Settings.jsonc
Normal file
9
Templates/Settings.jsonc
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
{
|
||||||
|
"Debug": false, // Enables extra debug logging, slows down the program by alot
|
||||||
|
"SilentMode": true, // The tool will stop and prompt you to continue on every remapping if disabled
|
||||||
|
"Publicize": true, // Publicize all types, methods, and properties : NOTE: Not run until after the remap has completed
|
||||||
|
"Unseal": true, // Unseal all types : NOTE: Not run until after the remap has completed
|
||||||
|
"AssemblyPath": "./Data/Managed/Assembly-CSharp.dll", // Path to the assembly we want to remap
|
||||||
|
"OutputPath": "./Data/Assembly-CSharp-Remapped.dll", // Path including the filename and extension we want to write the changes to
|
||||||
|
"MappingPath": "./Data/Mappings.jsonc" // Path to the mapping file
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user