mirror of
https://github.com/sp-tarkov/assembly-tool.git
synced 2025-02-12 17:30:43 -05:00
Make lists into hashsets
This commit is contained in:
parent
9f2165f325
commit
2cf25373fe
@ -16422,5 +16422,171 @@
|
||||
"ExcludeEvents": []
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"NewTypeName": "PlantState",
|
||||
"OriginalTypeName": "GClass1895",
|
||||
"UseForceRename": false,
|
||||
"SearchParams": {
|
||||
"GenericParams": {
|
||||
"IsPublic": true,
|
||||
"IsAbstract": false,
|
||||
"IsInterface": false,
|
||||
"IsStruct": false,
|
||||
"IsEnum": false,
|
||||
"IsNested": false,
|
||||
"IsSealed": true,
|
||||
"HasAttribute": false,
|
||||
"HasGenericParameters": false
|
||||
},
|
||||
"Methods": {
|
||||
"ConstructorParameterCount": 1,
|
||||
"MethodCount": 9,
|
||||
"IncludeMethods": [
|
||||
"Enter",
|
||||
"Exit",
|
||||
"ManualAnimatorMoveUpdate",
|
||||
"ChangePose",
|
||||
"SetTilt",
|
||||
"Pickup",
|
||||
"Examine",
|
||||
"Plant",
|
||||
"Cancel"
|
||||
],
|
||||
"ExcludeMethods": [
|
||||
"Dispose",
|
||||
"smethod_0",
|
||||
"method_0",
|
||||
"smethod_1",
|
||||
"method_1",
|
||||
"method_2",
|
||||
"Pause",
|
||||
"Resume",
|
||||
"method_3",
|
||||
"Begin",
|
||||
"End",
|
||||
"GetIcon",
|
||||
"RenderModel",
|
||||
"PoseModelByPivot",
|
||||
"PoseModelByBounds",
|
||||
"GetBounds",
|
||||
"Create",
|
||||
"ChatShared.IChatMember.Add",
|
||||
"ChatShared.IChatMember.Remove",
|
||||
"ChatShared.IChatMember.Receive",
|
||||
"ChatShared.IChatMember.ReceiveReplay",
|
||||
"ChatShared.IChatMember.SetBanned",
|
||||
"ChatShared.IChatMember.SetUnbanned",
|
||||
"ChatShared.IChatMember.Drop",
|
||||
"OnUpdate",
|
||||
"GetEffect",
|
||||
"OnLateUpdate",
|
||||
"method_4",
|
||||
"method_5",
|
||||
"OnDispose",
|
||||
"StartFade",
|
||||
"StopFade",
|
||||
"Clear",
|
||||
"ContainsIndex",
|
||||
"GetNumPixels",
|
||||
"ToIndexArray",
|
||||
"ToSamplesArray",
|
||||
"UnionWith",
|
||||
"GetCellData",
|
||||
"GetPixelData",
|
||||
"DisposeAt",
|
||||
"GetSample",
|
||||
"Remap",
|
||||
"ProcessAnimator",
|
||||
"GInterface109.OnParameterValueChanged",
|
||||
"Serialize",
|
||||
"Deserialize",
|
||||
"UpdateTimers",
|
||||
"HandleExits",
|
||||
"Transit",
|
||||
"InteractWithTransit",
|
||||
"Sizes",
|
||||
"Timers",
|
||||
"method_16",
|
||||
"method_17",
|
||||
"Start",
|
||||
"Stop",
|
||||
"method_6",
|
||||
"add_OnQuit",
|
||||
"remove_OnQuit",
|
||||
"ShowDialogScreen",
|
||||
"ExecuteDialogOption",
|
||||
"ExecuteQuestAction",
|
||||
"ExecuteServiceAction",
|
||||
"SaveDialogState",
|
||||
"add_SearchStopped",
|
||||
"remove_SearchStopped",
|
||||
"add_SearchComplete",
|
||||
"remove_SearchComplete",
|
||||
"Search",
|
||||
"TryPauseFrameRelatedMetrics",
|
||||
"TryResumeFrameRelatedMetrics",
|
||||
"Update",
|
||||
"SetAsCurrent",
|
||||
"add_OnBuffsUpdated",
|
||||
"remove_OnBuffsUpdated",
|
||||
"Add",
|
||||
"Replace",
|
||||
"Remove",
|
||||
"InvokeInternalBuffChange",
|
||||
"EFT.IExplosiveItem.CreateFragment",
|
||||
"Contains",
|
||||
"CanExecute",
|
||||
"RaiseEvents",
|
||||
"RollBack",
|
||||
"Execute",
|
||||
"ExecuteWithNewCount",
|
||||
"GInterface143.SetItemInfo",
|
||||
"GetHashSum",
|
||||
"GetInfo",
|
||||
"ExecuteInternal",
|
||||
"ToDescriptor",
|
||||
"ToString",
|
||||
"ToBaseInventoryCommand",
|
||||
"method_7",
|
||||
"method_8",
|
||||
"method_9",
|
||||
"method_10",
|
||||
"ExecuteInteractionInternal",
|
||||
"IsActive",
|
||||
"IsInteractive",
|
||||
"method_11",
|
||||
"GetCommands",
|
||||
"SetChanges",
|
||||
"Reset",
|
||||
"Rollback",
|
||||
"Save",
|
||||
"AddTask",
|
||||
"CreateThread",
|
||||
"RunInMainTread",
|
||||
"CheckForFinishedTasks",
|
||||
"Kill"
|
||||
]
|
||||
},
|
||||
"Fields": {
|
||||
"FieldCount": 2,
|
||||
"IncludeFields": [],
|
||||
"ExcludeFields": []
|
||||
},
|
||||
"Properties": {
|
||||
"PropertyCount": 0,
|
||||
"IncludeProperties": [],
|
||||
"ExcludeProperties": []
|
||||
},
|
||||
"NestedTypes": {
|
||||
"NestedTypeCount": -1,
|
||||
"IncludeNestedTypes": [],
|
||||
"ExcludeNestedTypes": []
|
||||
},
|
||||
"Events": {
|
||||
"IncludeEvents": [],
|
||||
"ExcludeEvents": []
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
@ -26,12 +26,6 @@ public class AutoMatchCommand : ICommand
|
||||
{
|
||||
DataProvider.IsCli = true;
|
||||
DataProvider.LoadAppSettings();
|
||||
|
||||
var remapperSettings = DataProvider.Settings!.Remapper!.MappingSettings;
|
||||
|
||||
remapperSettings!.RenameFields = true;
|
||||
remapperSettings.RenameProperties = true;
|
||||
remapperSettings.Publicize = true;
|
||||
|
||||
Logger.LogSync("Finding match...");
|
||||
|
||||
|
@ -247,31 +247,31 @@ public partial class ReCodeItForm : Form
|
||||
{
|
||||
ConstructorParameterCount = (int)ConstructorCountEnabled.GetCount(ConstuctorCountUpDown),
|
||||
MethodCount = (int)MethodCountEnabled.GetCount(MethodCountUpDown),
|
||||
IncludeMethods = GUIHelpers.GetAllEntriesFromListBox(MethodIncludeBox),
|
||||
ExcludeMethods = GUIHelpers.GetAllEntriesFromListBox(MethodExcludeBox),
|
||||
IncludeMethods = GUIHelpers.GetAllEntriesFromListBox(MethodIncludeBox).ToHashSet(),
|
||||
ExcludeMethods = GUIHelpers.GetAllEntriesFromListBox(MethodExcludeBox).ToHashSet(),
|
||||
},
|
||||
Fields =
|
||||
{
|
||||
FieldCount = (int)FieldCountEnabled.GetCount(FieldCountUpDown),
|
||||
IncludeFields = GUIHelpers.GetAllEntriesFromListBox(FieldIncludeBox),
|
||||
ExcludeFields = GUIHelpers.GetAllEntriesFromListBox(FieldExcludeBox),
|
||||
IncludeFields = GUIHelpers.GetAllEntriesFromListBox(FieldIncludeBox).ToHashSet(),
|
||||
ExcludeFields = GUIHelpers.GetAllEntriesFromListBox(FieldExcludeBox).ToHashSet(),
|
||||
},
|
||||
Properties =
|
||||
{
|
||||
PropertyCount = (int)PropertyCountEnabled.GetCount(PropertyCountUpDown),
|
||||
IncludeProperties = GUIHelpers.GetAllEntriesFromListBox(PropertiesIncludeBox),
|
||||
ExcludeProperties = GUIHelpers.GetAllEntriesFromListBox(PropertiesExcludeBox),
|
||||
IncludeProperties = GUIHelpers.GetAllEntriesFromListBox(PropertiesIncludeBox).ToHashSet(),
|
||||
ExcludeProperties = GUIHelpers.GetAllEntriesFromListBox(PropertiesExcludeBox).ToHashSet(),
|
||||
},
|
||||
NestedTypes =
|
||||
{
|
||||
NestedTypeCount = (int)NestedTypeCountEnabled.GetCount(NestedTypeCountUpDown),
|
||||
IncludeNestedTypes = GUIHelpers.GetAllEntriesFromListBox(NestedTypesIncludeBox),
|
||||
ExcludeNestedTypes = GUIHelpers.GetAllEntriesFromListBox(NestedTypesExcludeBox),
|
||||
IncludeNestedTypes = GUIHelpers.GetAllEntriesFromListBox(NestedTypesIncludeBox).ToHashSet(),
|
||||
ExcludeNestedTypes = GUIHelpers.GetAllEntriesFromListBox(NestedTypesExcludeBox).ToHashSet(),
|
||||
},
|
||||
Events =
|
||||
{
|
||||
IncludeEvents = GUIHelpers.GetAllEntriesFromListBox(EventsIncludeBox),
|
||||
ExcludeEvents = GUIHelpers.GetAllEntriesFromListBox(EventsExcludeBox)
|
||||
IncludeEvents = GUIHelpers.GetAllEntriesFromListBox(EventsIncludeBox).ToHashSet(),
|
||||
ExcludeEvents = GUIHelpers.GetAllEntriesFromListBox(EventsExcludeBox).ToHashSet()
|
||||
}
|
||||
}
|
||||
};
|
||||
|
@ -286,7 +286,7 @@ internal static class GUIHelpers
|
||||
/// <param name="items"></param>
|
||||
/// <param name="name"></param>
|
||||
/// <returns>A new tree node, or null if the provided list is empty</returns>
|
||||
private static TreeNode GenerateNodeFromList(List<string> items, string name)
|
||||
private static TreeNode GenerateNodeFromList(HashSet<string> items, string name)
|
||||
{
|
||||
var node = new TreeNode(name);
|
||||
|
||||
|
@ -85,33 +85,33 @@ public class MethodParams
|
||||
{
|
||||
public int ConstructorParameterCount { get; set; } = -1;
|
||||
public int MethodCount { get; set; } = -1;
|
||||
public List<string> IncludeMethods { get; set; } = [];
|
||||
public List<string> ExcludeMethods { get; set; } = [];
|
||||
public HashSet<string> IncludeMethods { get; set; } = [];
|
||||
public HashSet<string> ExcludeMethods { get; set; } = [];
|
||||
}
|
||||
|
||||
public class FieldParams
|
||||
{
|
||||
public int FieldCount { get; set; } = -1;
|
||||
public List<string> IncludeFields { get; set; } = [];
|
||||
public List<string> ExcludeFields { get; set; } = [];
|
||||
public HashSet<string> IncludeFields { get; set; } = [];
|
||||
public HashSet<string> ExcludeFields { get; set; } = [];
|
||||
}
|
||||
|
||||
public class PropertyParams
|
||||
{
|
||||
public int PropertyCount { get; set; } = -1;
|
||||
public List<string> IncludeProperties { get; set; } = [];
|
||||
public List<string> ExcludeProperties { get; set; } = [];
|
||||
public HashSet<string> IncludeProperties { get; set; } = [];
|
||||
public HashSet<string> ExcludeProperties { get; set; } = [];
|
||||
}
|
||||
|
||||
public class NestedTypeParams
|
||||
{
|
||||
public int NestedTypeCount { get; set; } = -1;
|
||||
public List<string> IncludeNestedTypes { get; set; } = [];
|
||||
public List<string> ExcludeNestedTypes { get; set; } = [];
|
||||
public HashSet<string> IncludeNestedTypes { get; set; } = [];
|
||||
public HashSet<string> ExcludeNestedTypes { get; set; } = [];
|
||||
}
|
||||
|
||||
public class EventParams
|
||||
{
|
||||
public List<string> IncludeEvents { get; set; } = [];
|
||||
public List<string> ExcludeEvents { get; set; } = [];
|
||||
public HashSet<string> IncludeEvents { get; set; } = [];
|
||||
public HashSet<string> ExcludeEvents { get; set; } = [];
|
||||
}
|
@ -26,6 +26,12 @@ public class AutoMatcher(List<RemapModel> mappings, string mappingPath)
|
||||
.ToList();
|
||||
|
||||
var targetTypeDef = FindTargetType(oldTypeName);
|
||||
|
||||
if (targetTypeDef is null)
|
||||
{
|
||||
Logger.LogSync($"Could not target type: {oldTypeName}", ConsoleColor.Red);
|
||||
return;
|
||||
}
|
||||
|
||||
Logger.LogSync($"Found target type: {targetTypeDef!.FullName}", ConsoleColor.Green);
|
||||
|
||||
@ -152,10 +158,15 @@ public class AutoMatcher(List<RemapModel> mappings, string mappingPath)
|
||||
.Where(m => !m.IsConstructor && !m.IsGetter && !m.IsSetter)
|
||||
.Select(s => s.Name.ToString()));
|
||||
|
||||
methods.IncludeMethods.Clear();
|
||||
methods.IncludeMethods.AddRange(includeMethods);
|
||||
|
||||
methods.ExcludeMethods.AddRange(excludeMethods);
|
||||
foreach (var include in includeMethods)
|
||||
{
|
||||
methods.IncludeMethods.Add(include);
|
||||
}
|
||||
|
||||
foreach (var exclude in excludeMethods)
|
||||
{
|
||||
methods.ExcludeMethods.Add(exclude);
|
||||
}
|
||||
|
||||
methods.MethodCount = target.Methods
|
||||
.Count(m => !m.IsConstructor && !m.IsGetter && !m.IsSetter && !m.IsSpecialName);
|
||||
@ -200,10 +211,15 @@ public class AutoMatcher(List<RemapModel> mappings, string mappingPath)
|
||||
.Select(s => s.Name.ToString())
|
||||
.Except(target.Fields.Select(s => s.Name.ToString()));
|
||||
|
||||
fields.IncludeFields.Clear();
|
||||
fields.IncludeFields.AddRange(includeFields);
|
||||
|
||||
fields.ExcludeFields.AddRange(excludeFields);
|
||||
foreach (var include in includeFields)
|
||||
{
|
||||
fields.IncludeFields.Add(include);
|
||||
}
|
||||
|
||||
foreach (var exclude in excludeFields)
|
||||
{
|
||||
fields.ExcludeFields.Add(exclude);
|
||||
}
|
||||
|
||||
fields.FieldCount = target.Fields.Count;
|
||||
|
||||
@ -242,10 +258,15 @@ public class AutoMatcher(List<RemapModel> mappings, string mappingPath)
|
||||
.Select(s => s.Name.ToString())
|
||||
.Except(target.Properties.Select(s => s.Name.ToString()));
|
||||
|
||||
props.IncludeProperties.Clear();
|
||||
props.IncludeProperties.AddRange(includeProps);
|
||||
|
||||
props.ExcludeProperties.AddRange(excludeProps);
|
||||
foreach (var include in includeProps)
|
||||
{
|
||||
props.IncludeProperties.Add(include);
|
||||
}
|
||||
|
||||
foreach (var exclude in excludeProps)
|
||||
{
|
||||
props.ExcludeProperties.Add(exclude);
|
||||
}
|
||||
|
||||
props.PropertyCount = target.Properties.Count;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user