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

112 lines
3.0 KiB
C#

using dnlib.DotNet;
using Newtonsoft.Json;
using ReCodeIt.Enums;
namespace ReCodeIt.Models;
/// <summary>
/// Object to store linq statements in inside of json to search and remap classes
/// </summary>
public class RemapModel
{
[JsonIgnore]
public bool Succeeded { get; set; } = false;
[JsonIgnore]
public List<ENoMatchReason> NoMatchReasons { get; set; } = [];
/// <summary>
/// This is a list of type candidates that made it through the filter
/// </summary>
[JsonIgnore]
public HashSet<TypeDef> TypeCandidates { get; set; } = [];
/// <summary>
/// This is the final chosen type we will use to remap
/// </summary>
[JsonIgnore]
public TypeDef TypePrimeCandidate { get; set; }
public string NewTypeName { get; set; } = string.Empty;
public string OriginalTypeName { get; set; } = string.Empty;
public bool UseForceRename { get; set; }
public SearchParams SearchParams { get; set; } = new();
}
/// <summary>
/// Search filters to find types and remap them
/// </summary>
public class SearchParams
{
#region BOOL_PARAMS
/// <summary>
/// Default to true, most types are public
/// </summary>
public bool IsPublic { get; set; } = true;
public bool? IsAbstract { get; set; } = null;
public bool? IsInterface { get; set; } = null;
public bool? IsStruct { get; set; } = null;
public bool? IsEnum { get; set; } = null;
public bool? IsNested { get; set; } = null;
public bool? IsSealed { get; set; } = null;
public bool? HasAttribute { get; set; } = null;
public bool? IsDerived { get; set; } = null;
public bool? HasGenericParameters { get; set; } = null;
#endregion BOOL_PARAMS
#region STR_PARAMS
/// <summary>
/// Name of the nested types parent
/// </summary>
public string? NTParentName { get; set; } = null;
/// <summary>
/// Name of the derived classes declaring type
/// </summary>
public string? MatchBaseClass { get; set; } = null;
/// <summary>
/// Name of the derived classes declaring type we want to ignore
/// </summary>
public string? IgnoreBaseClass { get; set; } = null;
#endregion STR_PARAMS
#region INT_PARAMS
public int? ConstructorParameterCount { get; set; } = null;
public int? MethodCount { get; set; } = null;
public int? FieldCount { get; set; } = null;
public int? PropertyCount { get; set; } = null;
public int? NestedTypeCount { get; set; } = null;
#endregion INT_PARAMS
#region LISTS
public List<string> IncludeMethods { get; set; }
public List<string> ExcludeMethods { get; set; }
public List<string> IncludeFields { get; set; }
public List<string> ExcludeFields { get; set; }
public List<string> IncludeProperties { get; set; }
public List<string> ExcludeProperties { get; set; }
public List<string> IncludeNestedTypes { get; set; }
public List<string> ExcludeNestedTypes { get; set; }
#endregion LISTS
public SearchParams()
{
}
}
internal class AdvancedSearchParams
{
}