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:
parent
c9fcf4e5ca
commit
4da9c42c28
File diff suppressed because it is too large
Load Diff
@ -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)
|
||||||
{
|
{
|
||||||
|
@ -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.
|
||||||
|
@ -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();
|
||||||
|
|
||||||
|
@ -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;
|
||||||
|
@ -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)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user