CJ-SPT d33f1f3c9b
Dnlib refactor
* First compiling build

* fix out path

* fix hollow

* Traditional loops in favor of linq for clarity

* Start refactor

* Refactor part 2

* Rename variable

* Better error reason handling

* Clean up enum

* Refactor part 3

* Use combo boxes in favor of updowns

* Update tooltips

* fix is nested tree view display

* Capitialization

* Refactor part ??

* remove unused methods

* Expanded IsNested Check

* TypeFilter class + Fix CLI bug

* Remove reflection, change IsDerived and IsNested checks

* Remove optional out for IsPublic

* Remove nullable from IsPublic

* fix logger not resetting color

* actually fix it...

* remove redundant if else on IsPublic check

* Add logging to indicate all types have been filtered out

* Default IsPublic to true

* remove duplicate method call

* Refactor logger to be on its own thread

* Multithread remapping and grouped logging for threads

* 5 more filters

* Finish migrating to the new system

* bug fixes

* Add empty string validation to text fields

* re-enable renamer

* restore renamer

* Multi threaded renaming, still broken

* Basis for method renaming

* More renamer work, might get a passing build now?

* Re-enable publicizer

* Rework logging

* re-enable mapping updates

* fix hollow

* Iterate over all types instead of just one to re-link fields

* Add reference list command

---------

Co-authored-by: clodan <clodan@clodan.com>
2024-06-26 14:45:54 -04:00

65 lines
1.6 KiB
C#

using dnlib.DotNet;
namespace ReCodeIt.AutoMapper;
/// <summary>
/// Represents a match of a field name to obfuscated class
/// </summary>
/// <param name="type"></param>
/// <param name="name"></param>
/// <param name="isInterface"></param>
/// <param name="isStruct"></param>
public sealed class MappingPair(
TypeDef type,
string name,
bool isInterface,
bool isStruct,
bool isPublic)
{
public TypeDef OriginalTypeDefinition { get; private set; } = type;
/// <summary>
/// The type reference we want to change
/// </summary>
public TypeDef NewTypeRef { get; set; }
/// <summary>
/// Is this field an interface?
/// </summary>
public bool IsInterface { get; set; } = isInterface;
/// <summary>
/// Is this type a struct?
/// </summary>
public bool IsStruct { get; set; } = isStruct;
/// <summary>
/// Has this type been renamed? Use for checking for failures at the end
/// </summary>
public bool HasBeenRenamed { get; set; } = false;
/// <summary>
/// Did this match come from a method?
/// </summary>
public AutoMappingResult AutoMappingResult { get; set; } = AutoMappingResult.None;
/// <summary>
/// This is the name we want to change the assembly class to
/// </summary>
public string Name { get; set; } = name;
/// <summary>
/// Original name of the property or field type
/// </summary>
public string OriginalPropOrFieldName { get; } = name;
}
public enum AutoMappingResult
{
None,
Match_From_Field,
Match_From_Property,
Match_From_Method,
Fail_From_Already_Contained_Name,
Fail_From_New_Type_Ref_Null,
}