0
0
mirror of https://github.com/sp-tarkov/assembly-tool.git synced 2025-02-13 09:50:44 -05:00

Misc and add new mappings

This commit is contained in:
Cj 2025-01-02 01:21:37 -05:00
parent c9fcf4e5ca
commit 4da9c42c28
6 changed files with 2184 additions and 11 deletions

File diff suppressed because it is too large Load Diff

View File

@ -13,14 +13,15 @@ public class AutoMatchCommand : ICommand
[CommandParameter(0, IsRequired = true, Description = "The absolute path to your assembly, folder must contain all references to be resolved.")] [CommandParameter(0, IsRequired = true, Description = "The absolute path to your assembly, folder must contain all references to be resolved.")]
public required string AssemblyPath { get; init; } public required string AssemblyPath { get; init; }
[CommandParameter(1, IsRequired = true, Description = "Full old type name including namespace")] [CommandParameter(1, IsRequired = true, Description = "Path to your mapping file so it can be updated if a match is found")]
public string MappingsPath { get; init; }
[CommandParameter(2, IsRequired = true, Description = "Full old type name including namespace")]
public required string OldTypeName { get; init; } public required string OldTypeName { get; init; }
[CommandParameter(2, IsRequired = true, Description = "The name you want the type to be renamed to")] [CommandParameter(3, IsRequired = true, Description = "The name you want the type to be renamed to")]
public required string NewTypeName { get; init; } public required string NewTypeName { get; init; }
[CommandParameter(3, IsRequired = false, Description = "Path to your mapping file so it can be updated if a match is found")]
public string MappingsPath { get; init; }
public ValueTask ExecuteAsync(IConsole console) public ValueTask ExecuteAsync(IConsole console)
{ {

View File

@ -16,9 +16,9 @@ references needed to be resolved.
- `automatch` - This command will Automatically try to generate a mapping object given old type and new type names. - `automatch` - This command will Automatically try to generate a mapping object given old type and new type names.
- `AssemblyPath` - The absolute path to your assembly, folder must contain all references to be resolved. - `AssemblyPath` - The absolute path to your assembly, folder must contain all references to be resolved.
- `OldTypeName` - Full old type name including namespace - `MappingsPath` - Path to your mapping file so it can be updated if a match is found.
- `NewTypeName` - The name you want the type to be renamed to - `OldTypeName` - Full old type name including namespace.
- `MappingsPath` - Path to your mapping file so it can be updated if a match is found - `NewTypeName` - The name you want the type to be renamed to.
- This command will prompt you to append your created mapping to the mapping file. - This command will prompt you to append your created mapping to the mapping file.
- It will then prompt you to run the remap process. - It will then prompt you to run the remap process.

View File

@ -185,6 +185,11 @@ public class ReMapper
types = types.Where(type => tokens!.Any(token => type.Name.StartsWith(token))); types = types.Where(type => tokens!.Any(token => type.Name.StartsWith(token)));
} }
if (mapping.SearchParams.NestedTypes.NestedTypeParentName != string.Empty)
{
types = types.Where(t => t.DeclaringType != null && t.DeclaringType.Name == mapping.SearchParams.NestedTypes.NestedTypeParentName);
}
// Run through a series of filters and report an error if all types are filtered out. // Run through a series of filters and report an error if all types are filtered out.
var filters = new TypeFilters(); var filters = new TypeFilters();

View File

@ -76,12 +76,10 @@ public class Statistics(
continue; continue;
} }
if (validate) if (validate && remap.Succeeded)
{ {
var str = JsonConvert.SerializeObject(remap, Formatting.Indented);
Logger.Log("Generated Model: ", ConsoleColor.Blue); Logger.Log("Generated Model: ", ConsoleColor.Blue);
Logger.Log(str, ConsoleColor.Blue); Logger.LogRemapModel(remap);
Logger.Log("Passed validation", ConsoleColor.Green); Logger.Log("Passed validation", ConsoleColor.Green);
return; return;

View File

@ -1,4 +1,6 @@
using System.Collections.Concurrent; using System.Collections.Concurrent;
using Newtonsoft.Json;
using ReCodeItLib.Models;
namespace ReCodeItLib.Utils; namespace ReCodeItLib.Utils;
@ -119,6 +121,12 @@ public static class Logger
Console.ResetColor(); Console.ResetColor();
} }
public static void LogRemapModel(RemapModel remapModel)
{
var str = JsonConvert.SerializeObject(remapModel, Formatting.Indented);
LogSync(str, ConsoleColor.Blue);
}
private static void LogInternal(LogMessage message) private static void LogInternal(LogMessage message)
{ {
if (!message.Silent) if (!message.Silent)