Compare commits

..

16 Commits

Author SHA1 Message Date
Cj
4ad34ea6ab Allow debugging of the CLI, preface the command with [debug] to await debugger connection. 2024-11-05 15:33:57 -05:00
Cj
f56ec6d0a1 Fix typo 2024-11-05 14:25:54 -05:00
Cj
e9d6b30e88 Add ENomatchReason for events, and properly handle them. 2024-11-05 14:22:28 -05:00
8a350c6818 Feature: Adding Include/Exclude for events. (#13)
Added checking events for the remapping, can include/exclude any events, tested.
Added New GUI option for events. also fixed ExcludeNestedTypes wrongly displayed if no IncludeNestedTypes exists.

Co-authored-by: SlejmUr <slejmur@protonmail.com>
Reviewed-on: SPT/AssemblyTool#13
Co-authored-by: SlejmUr <slejmur@noreply.dev.sp-tarkov.com>
Co-committed-by: SlejmUr <slejmur@noreply.dev.sp-tarkov.com>
2024-11-05 18:21:26 +00:00
1d44e1cac2 mapping-updates (#14)
* Renames NetworkHealthSyncStruct to NetworkHealthSyncPacketStruct
* Makes RevolverFireOperationClass only have one possible match
* Re-adds a whole bunch of mapping for inventory operations.

Reviewed-on: SPT/AssemblyTool#14
Co-authored-by: Archangel <jesse@archangel.wtf>
Co-committed-by: Archangel <jesse@archangel.wtf>
2024-11-05 18:19:29 +00:00
Cj
00588855f2 Merge pull request 'Add new mappings' (#11) from Archangel/AssemblyTool:new-mappings into master
Reviewed-on: SPT/AssemblyTool#11
2024-11-04 20:02:11 +00:00
1ea295e9a9 Add new mappings 2024-11-04 20:42:49 +01:00
Cj
e9b1649d55 Don't unseal classes for the launcher, resolves launcher not starting 2024-11-02 22:08:27 -04:00
Cj
c1a36ee8e3 Publicize and unseal launcher 2024-11-02 21:30:02 -04:00
Cj
817fe28c1e Merge remote-tracking branch 'origin/master' 2024-11-02 15:58:35 -04:00
Cj
5c1842daaa Add additional function to the deobfuscation command 2024-11-02 15:58:08 -04:00
Dev
15ef523189 Updated mappings 2024-11-02 17:10:11 +00:00
CWX
d0790a0c8f should have been with last commit 2024-11-02 17:04:38 +00:00
CWX
86a922327c Add Additional changes needed for new patch 2024-11-02 17:04:10 +00:00
CWX
bb2c43e9ec Update Quit Method 2024-11-02 17:03:54 +00:00
CWX
07900a46cf Update BotData 2024-11-02 17:03:45 +00:00
19 changed files with 1636 additions and 355 deletions

View File

@ -2684,18 +2684,25 @@
} }
}, },
{ {
"NewTypeName": "DamageInfo", "NewTypeName": "DamageInfoStruct",
"OriginalTypeName": "GStruct394", "OriginalTypeName": "GStruct421",
"UseForceRename": false, "UseForceRename": false,
"SearchParams": { "SearchParams": {
"IsPublic": true, "IsPublic": true,
"IncludeMethods": [], "IncludeMethods": [],
"ExcludeMethods": [], "ExcludeMethods": [],
"IncludeFields": [ "IncludeFields": [
"OverDamageFrom" "OverDamageFrom",
"Player",
"BodyPartColliderType",
"HittedBallisticColliders"
], ],
"ExcludeFields": [], "ExcludeFields": [],
"IncludeProperties": [], "IncludeProperties": [
"Penetrated",
"HaveOwner",
"Blunt"
],
"ExcludeProperties": [], "ExcludeProperties": [],
"IncludeNestedTypes": [], "IncludeNestedTypes": [],
"ExcludeNestedTypes": [] "ExcludeNestedTypes": []
@ -5278,25 +5285,6 @@
"ExcludeNestedTypes": [] "ExcludeNestedTypes": []
} }
}, },
{
"NewTypeName": "SwapOperationClass",
"OriginalTypeName": "GClass3090",
"UseForceRename": false,
"SearchParams": {
"IsPublic": true,
"ConstructorParameterCount": 7,
"IncludeMethods": [],
"ExcludeMethods": [],
"IncludeFields": [],
"ExcludeFields": [],
"IncludeProperties": [
"DestroysMainItem"
],
"ExcludeProperties": [],
"IncludeNestedTypes": [],
"ExcludeNestedTypes": []
}
},
{ {
"NewTypeName": "ThrowOperationClass", "NewTypeName": "ThrowOperationClass",
"OriginalTypeName": "GClass3091", "OriginalTypeName": "GClass3091",
@ -6310,17 +6298,21 @@
}, },
{ {
"NewTypeName": "TimeHasComeScreenClass", "NewTypeName": "TimeHasComeScreenClass",
"OriginalTypeName": "GClass3436", "OriginalTypeName": "GClass3563",
"UseForceRename": false, "UseForceRename": false,
"SearchParams": { "SearchParams": {
"ConstructorParameterCount": 3,
"IsPublic": true, "IsPublic": true,
"IsNested": true, "IsNested": true,
"IsSealed": true, "IsSealed": false,
"NTParentName": "MatchmakerTimeHasCome", "NTParentName": "MatchmakerTimeHasCome",
"IncludeMethods": [], "IncludeMethods": [],
"ExcludeMethods": [], "ExcludeMethods": [],
"IncludeFields": [ "IncludeFields": [
"SearchingForServer" "ScreenType",
"IsReconnecting",
"SwitchTaskBarButtonsAvailability",
"LimitedServersAvailability"
], ],
"ExcludeFields": [], "ExcludeFields": [],
"IncludeProperties": [], "IncludeProperties": [],
@ -7667,7 +7659,8 @@
"FieldCount": 1, "FieldCount": 1,
"IncludeMethods": [ "IncludeMethods": [
"Enter", "Enter",
"Exit" "Exit",
"ManualAnimatorMoveUpdate"
], ],
"ExcludeMethods": [ "ExcludeMethods": [
"ProcessAnimatorMovement", "ProcessAnimatorMovement",
@ -8059,5 +8052,725 @@
"IncludeNestedTypes": [], "IncludeNestedTypes": [],
"ExcludeNestedTypes": [] "ExcludeNestedTypes": []
} }
},
{
"NewTypeName": "GrenadeFactoryClass",
"OriginalTypeName": "Gclass737",
"UseForceRename": false,
"SearchParams": {
"IsPublic": true,
"IsAbstract": false,
"IsDerived": false,
"IncludeMethods": [
"AddSmokeGrenade",
"AddStunGrenade",
"AddGrenade"
],
"ExcludeMethods": [],
"IncludeFields": [],
"ExcludeFields": [],
"IncludeProperties": [],
"ExcludeProperties": [],
"IncludeNestedTypes": [],
"ExcludeNestedTypes": []
}
},
{
"NewTypeName": "NetworkHealthSyncPacketStruct",
"OriginalTypeName": "GStruct358",
"UseForceRename": false,
"SearchParams": {
"IsPublic": true,
"IsStruct": true,
"IncludeMethods": [],
"ExcludeMethods": [],
"IncludeFields": [
"Nested",
"SyncType",
"Data"
],
"ExcludeFields": [],
"IncludeProperties": [],
"ExcludeProperties": [],
"IncludeNestedTypes": [
"ESyncType"
],
"ExcludeNestedTypes": []
}
},
{
"NewTypeName": "SeasonsSettingsClass",
"OriginalTypeName": "GClass2359",
"UseForceRename": false,
"SearchParams": {
"IsPublic": true,
"IsSealed": true,
"IncludeMethods": [],
"ExcludeMethods": [],
"IncludeFields": [
"SpringSnowFactorDefault",
"SpringSnowFactor"
],
"ExcludeFields": [],
"IncludeProperties": [],
"ExcludeProperties": [],
"IncludeNestedTypes": [],
"ExcludeNestedTypes": []
}
},
{
"NewTypeName": "PausedEffectsStruct",
"OriginalTypeName": "GStruct357",
"UseForceRename": false,
"SearchParams": {
"IsPublic": true,
"IsStruct": true,
"IncludeMethods": [
"SaveInfo"
],
"ExcludeMethods": [],
"IncludeFields": [
"ID",
"HealthController",
"Type",
"BodyPart",
"Strength",
"State"
],
"ExcludeFields": [],
"IncludeProperties": [],
"ExcludeProperties": [],
"IncludeNestedTypes": [],
"ExcludeNestedTypes": []
}
},
{
"NewTypeName": "LootSyncStruct",
"OriginalTypeName": "GStruct128",
"UseForceRename": false,
"SearchParams": {
"IsPublic": true,
"IsStruct": true,
"IncludeMethods": [],
"ExcludeMethods": [],
"IncludeFields": [
"Id",
"Position",
"Rotation",
"Velocity",
"AngularVelocity",
"Done"
],
"ExcludeFields": [
"CollisionNumber"
],
"IncludeProperties": [],
"ExcludeProperties": [],
"IncludeNestedTypes": [],
"ExcludeNestedTypes": []
}
},
{
"NewTypeName": "IPlayerBridge",
"OriginalTypeName": "GInterface20",
"UseForceRename": false,
"SearchParams": {
"IsPublic": true,
"IsInterface": true,
"IsNested": true,
"IncludeMethods": [
"ApplyDamageInfo",
"ApplyShot",
"CheckArmorHitByDirection"
],
"ExcludeMethods": [],
"IncludeFields": [
"iPlayer",
"WorldTime",
"UsingSimplifiedSkeleton"
],
"ExcludeFields": [],
"IncludeProperties": [],
"ExcludeProperties": [],
"IncludeNestedTypes": [],
"ExcludeNestedTypes": []
}
},
{
"NewTypeName": "FlareGunFireOperationClass",
"OriginalTypeName": "GClass1768",
"UseForceRename": false,
"SearchParams": {
"IsPublic": true,
"IsNested": true,
"IsDerived": true,
"IncludeMethods": [
"PrepareShot",
"OnFireEvent",
"SetTriggerPressed",
"OnFireEndEvent",
"CanNotBeInterrupted"
],
"ExcludeMethods": [
"FastForward"
],
"IncludeFields": [
"bulletClass"
],
"ExcludeFields": [],
"IncludeProperties": [],
"ExcludeProperties": [],
"IncludeNestedTypes": [],
"ExcludeNestedTypes": []
}
},
{
"NewTypeName": "IsOneOffFireOperationClass",
"OriginalTypeName": "GClass1770",
"UseForceRename": false,
"SearchParams": {
"IsPublic": true,
"IsNested": true,
"IsDerived": true,
"IncludeMethods": [
"StartFireAnimation",
"PrepareShot",
"OnFireEvent",
"SetTriggerPressed",
"OnFireEndEvent",
"FastForward"
],
"ExcludeMethods": [],
"IncludeFields": [
"bulletClass"
],
"ExcludeFields": [
"singleShotData_0"
],
"IncludeProperties": [],
"ExcludeProperties": [],
"IncludeNestedTypes": [],
"ExcludeNestedTypes": []
}
},
{
"NewTypeName": "RevolverFireOperationClass",
"OriginalTypeName": "GClass1767",
"UseForceRename": false,
"SearchParams": {
"IsPublic": true,
"IsNested": true,
"IsDerived": true,
"IncludeMethods": [
"OnFireEvent",
"OnAddAmmoInChamber",
"SetTriggerPressed",
"SetInventoryOpened",
"OnFireEndEvent",
"OnIdleStartEvent",
"OnShellEjectEvent"
],
"ExcludeMethods": [
"SetScopeMode"
],
"IncludeFields": [
"cylinderMagazineClass"
],
"ExcludeFields": [],
"IncludeProperties": [],
"ExcludeProperties": [],
"IncludeNestedTypes": [],
"ExcludeNestedTypes": []
}
},
{
"NewTypeName": "GenericFireOperationClass",
"OriginalTypeName": "GClass1765",
"UseForceRename": false,
"SearchParams": {
"IsPublic": true,
"IsNested": true,
"IsDerived": true,
"IncludeMethods": [
"StartFireAnimation",
"OnFireEvent",
"PrepareShot",
"RemoveAmmoFromChamber",
"OnAddAmmoInChamber",
"OnShellEjectEvent"
],
"ExcludeMethods": [],
"IncludeFields": [
"singleShotData_0"
],
"ExcludeFields": [],
"IncludeProperties": [],
"ExcludeProperties": [],
"IncludeNestedTypes": [],
"ExcludeNestedTypes": []
}
},
{
"NewTypeName": "BaseDescriptorClass",
"OriginalTypeName": "GClass1693",
"UseForceRename": false,
"SearchParams": {
"IsPublic": true,
"IsAbstract": true,
"IncludeMethods": [
"ToInventoryOperation"
],
"ExcludeMethods": [],
"IncludeFields": [],
"ExcludeFields": [],
"IncludeProperties": [
"OperationId",
"OwnerId",
"Operation"
],
"ExcludeProperties": [],
"IncludeNestedTypes": [],
"ExcludeNestedTypes": []
}
},
{
"NewTypeName": "BaseInventoryOperationClass",
"OriginalTypeName": "GClass3192",
"UseForceRename": false,
"SearchParams": {
"IsPublic": true,
"IsAbstract": true,
"IncludeMethods": [
"WaitingForForeignEvents"
],
"ExcludeMethods": [],
"IncludeFields": [],
"ExcludeFields": [],
"IncludeProperties": [
"Id",
"Status",
"OwnerId"
],
"ExcludeProperties": [],
"IncludeNestedTypes": [],
"ExcludeNestedTypes": []
}
},
{
"NewTypeName": "FoldOperationClass",
"OriginalTypeName": "GClass3208",
"UseForceRename": false,
"SearchParams": {
"IsPublic": true,
"IsSealed": true,
"IncludeMethods": [],
"ExcludeMethods": [],
"IncludeFields": [],
"ExcludeFields": [],
"IncludeProperties": [
"Foldable",
"NewValue"
],
"ExcludeProperties": [],
"IncludeNestedTypes": [
"FoldCommand"
],
"ExcludeNestedTypes": []
}
},
{
"NewTypeName": "SwapOperationClass",
"OriginalTypeName": "GClass3196",
"UseForceRename": false,
"SearchParams": {
"IsPublic": true,
"IsSealed": true,
"IncludeMethods": [
"ExecuteInternal",
"ToDescriptor",
"ToBaseInventoryCommand"
],
"ExcludeMethods": [
"Dispose"
],
"IncludeFields": [],
"ExcludeFields": [],
"IncludeProperties": [
"Item",
"From",
"DestroysMainItem"
],
"ExcludeProperties": [
"To"
],
"IncludeNestedTypes": [
"SwapCommand"
],
"ExcludeNestedTypes": []
}
},
{
"NewTypeName": "MergeOperationClass",
"OriginalTypeName": "GClass3209",
"UseForceRename": false,
"SearchParams": {
"IsPublic": true,
"IsSealed": true,
"IncludeMethods": [
"ToDescriptor"
],
"ExcludeMethods": [],
"IncludeFields": [],
"ExcludeFields": [],
"IncludeProperties": [
"Item1",
"Item2"
],
"ExcludeProperties": [],
"IncludeNestedTypes": [
"MergeCommand"
],
"ExcludeNestedTypes": []
}
},
{
"NewTypeName": "TransferOperationClass",
"OriginalTypeName": "GClass3219",
"UseForceRename": false,
"SearchParams": {
"IsPublic": true,
"IsSealed": true,
"IncludeMethods": [
"ExecuteInternal",
"ToDescriptor",
"ToBaseInventoryCommand"
],
"ExcludeMethods": [
"Dispose"
],
"IncludeFields": [
"item_0"
],
"ExcludeFields": [],
"IncludeProperties": [
"Item1",
"From1",
"To1",
"Item2",
"From2",
"To2"
],
"ExcludeProperties": [],
"IncludeNestedTypes": [
"TransferCommand"
],
"ExcludeNestedTypes": []
}
},
{
"NewTypeName": "ApplyKeyOperationClass",
"OriginalTypeName": "GClass3200",
"UseForceRename": false,
"SearchParams": {
"IsPublic": true,
"IsSealed": true,
"IncludeMethods": [
"ExecuteInternal",
"ToDescriptor",
"ToBaseInventoryCommand"
],
"ExcludeMethods": [],
"IncludeFields": [
"keyComponent_0",
"lockableComponent_0"
],
"ExcludeFields": [],
"IncludeProperties": [],
"ExcludeProperties": [],
"IncludeNestedTypes": [
"ApplyCommand"
],
"ExcludeNestedTypes": []
}
},
{
"NewTypeName": "RemoveOperationClass",
"OriginalTypeName": "GClass3213",
"UseForceRename": false,
"SearchParams": {
"IsPublic": true,
"IsSealed": true,
"IncludeMethods": [
"ExecuteInternal",
"ToDescriptor"
],
"ExcludeMethods": [],
"IncludeFields": [
"item_0",
"itemAddress_0"
],
"ExcludeFields": [],
"IncludeProperties": [
"Item"
],
"ExcludeProperties": [],
"IncludeNestedTypes": [
"RemoveCommand"
],
"ExcludeNestedTypes": []
}
},
{
"NewTypeName": "SplitOperationClass",
"OriginalTypeName": "GClass3216",
"UseForceRename": false,
"SearchParams": {
"IsPublic": true,
"IsSealed": true,
"IncludeMethods": [
"ToDescriptor"
],
"ExcludeMethods": [],
"IncludeFields": [],
"ExcludeFields": [],
"IncludeProperties": [
"Item1",
"From1",
"To1"
],
"ExcludeProperties": [],
"IncludeNestedTypes": [
"SplitCommand"
],
"ExcludeNestedTypes": []
}
},
{
"NewTypeName": "PlayerSearchControllerClass",
"OriginalTypeName": "GClass1967",
"UseForceRename": false,
"SearchParams": {
"IsPublic": true,
"IsSealed": true,
"IncludeMethods": [
"SetItemAsTemporaryKnown",
"RemoveItemFromTemporaryKnown",
"ForgetItem"
],
"ExcludeMethods": [],
"IncludeFields": [],
"ExcludeFields": [],
"IncludeProperties": [],
"ExcludeProperties": [],
"IncludeNestedTypes": [],
"ExcludeNestedTypes": []
}
},
{
"NewTypeName": "AISearchControllerClass",
"OriginalTypeName": "GClass1969",
"UseForceRename": false,
"SearchParams": {
"IsPublic": true,
"IsSealed": true,
"IncludeMethods": [
"SetItemAsSearched",
"SetItemAsKnown",
"StopSearching",
"SearchContents",
"GetObserverItemState"
],
"ExcludeMethods": [],
"IncludeFields": [],
"ExcludeFields": [],
"IncludeProperties": [],
"ExcludeProperties": [
"SearchOperations"
],
"IncludeNestedTypes": [],
"ExcludeNestedTypes": []
}
},
{
"NewTypeName": "MemoryControllerClass",
"OriginalTypeName": "GClass839",
"UseForceRename": false,
"SearchParams": {
"IsPublic": true,
"IncludeMethods": [
"EmptyWorkingSet",
"Collect"
],
"ExcludeMethods": [],
"IncludeFields": [],
"ExcludeFields": [],
"IncludeProperties": [
"GCEnabled"
],
"ExcludeProperties": [],
"IncludeNestedTypes": [],
"ExcludeNestedTypes": []
}
},
{
"NewTypeName": "ArmorResistanceStruct",
"OriginalTypeName": "GStruct23",
"UseForceRename": false,
"SearchParams": {
"IsPublic": true,
"IsStruct": true,
"IncludeMethods": [
"GetPenetrationChance"
],
"ExcludeMethods": [],
"IncludeFields": [
"RealResistance",
"ArmorClassResistance"
],
"ExcludeFields": [],
"IncludeProperties": [],
"ExcludeProperties": [],
"IncludeNestedTypes": [],
"ExcludeNestedTypes": []
}
},
{
"NewTypeName": "ShotIdStruct",
"OriginalTypeName": "GStruct420",
"UseForceRename": false,
"SearchParams": {
"IsPublic": true,
"IsStruct": true,
"IncludeMethods": [
"Equals"
],
"ExcludeMethods": [],
"IncludeFields": [
"EMPTY_SHOT_ID"
],
"ExcludeFields": [],
"IncludeProperties": [],
"ExcludeProperties": [],
"IncludeNestedTypes": [],
"ExcludeNestedTypes": []
}
},
{
"NewTypeName": "LoadingProgressStruct",
"OriginalTypeName": "GStruct122",
"UseForceRename": false,
"SearchParams": {
"IsPublic": true,
"IsStruct": true,
"IncludeMethods": [],
"ExcludeMethods": [],
"IncludeFields": [
"Progress",
"Stage"
],
"ExcludeFields": [],
"IncludeProperties": [],
"ExcludeProperties": [],
"IncludeNestedTypes": [],
"ExcludeNestedTypes": []
}
},
{
"NewTypeName": "TransitControllerAbstractClass",
"OriginalTypeName": "GClass1640",
"UseForceRename": false,
"SearchParams": {
"IsPublic": true,
"IsAbstract": true,
"IncludeMethods": [
"DisableTransitPoints",
"IsTransit",
"IsTransitPlayer"
],
"ExcludeMethods": [],
"IncludeFields": [
"transitPlayers"
],
"ExcludeFields": [],
"IncludeProperties": [],
"ExcludeProperties": [],
"IncludeNestedTypes": [],
"ExcludeNestedTypes": []
}
},
{
"NewTypeName": "NetworkHealthExtraDataTypeStruct",
"OriginalTypeName": "GStruct359",
"UseForceRename": false,
"SearchParams": {
"IsPublic": true,
"IsStruct": true,
"IsNested": true,
"IncludeMethods": [
"ToString"
],
"ExcludeMethods": [],
"IncludeFields": [
"EffectId",
"Type",
"BodyPart",
"ExtraDataType",
"ExtraData"
],
"ExcludeFields": [],
"IncludeProperties": [],
"ExcludeProperties": [],
"IncludeNestedTypes": [
"EExtraDataType"
],
"ExcludeNestedTypes": []
}
},
{
"NewTypeName": "NetworkHealthDataPacketStruct",
"OriginalTypeName": "GStruct377",
"UseForceRename": false,
"SearchParams": {
"IsPublic": true,
"IsStruct": true,
"IsNested": true,
"IncludeMethods": [],
"ExcludeMethods": [],
"IncludeFields": [
"AddEffect",
"RemoveEffect",
"EffectNextState",
"EffectStateTime",
"EffectStrength"
],
"ExcludeFields": [],
"IncludeProperties": [],
"ExcludeProperties": [],
"IncludeNestedTypes": [],
"ExcludeNestedTypes": []
}
},
{
"NewTypeName": "DestroyedItemsStruct",
"OriginalTypeName": "GStruct384",
"UseForceRename": false,
"SearchParams": {
"IsPublic": true,
"IsStruct": true,
"IncludeMethods": [
"Deconstruct"
],
"ExcludeMethods": [],
"IncludeFields": [
"Item",
"NumberToDestroy",
"NumberToPreserve"
],
"ExcludeFields": [],
"IncludeProperties": [],
"ExcludeProperties": [],
"IncludeNestedTypes": [],
"ExcludeNestedTypes": []
}
} }
] ]

View File

@ -35,5 +35,9 @@
{"Role":"followerKojaniy","Limit":2,"Difficulty":"normal"}, {"Role":"followerKojaniy","Limit":2,"Difficulty":"normal"},
{"Role":"skier","Limit":2,"Difficulty":"normal"}, {"Role":"skier","Limit":2,"Difficulty":"normal"},
{"Role":"peacemaker","Limit":2,"Difficulty":"normal"}, {"Role":"peacemaker","Limit":2,"Difficulty":"normal"},
{"Role":"bossPartisan","Limit":2,"Difficulty":"normal"} {"Role":"infectedAssault","Limit":2,"Difficulty":"normal"},
{"Role":"infectedPmc","Limit":2,"Difficulty":"normal"},
{"Role":"infectedCivil","Limit":2,"Difficulty":"normal"},
{"Role":"infectedLaborant","Limit":2,"Difficulty":"normal"},
{"Role":"infectedTagilla","Limit":2,"Difficulty":"normal"}
] ]

View File

@ -168,7 +168,7 @@ namespace DumpLib
// get End raid class from json // get End raid class from json
DataHelper.EndRaidClass = DataHelper.GetEndRaidClass(); DataHelper.EndRaidClass = DataHelper.GetEndRaidClass();
// get player profile // get player profile
DataHelper.PlayerProfile = ReflectionHelper.GetPlayerProfile(); DataHelper.PlayerProfile = ReflectionHelper.GetProfileCompleteData();
// Set up end raid class // Set up end raid class
DataHelper.EndRaidClass.GetType().GetField("profile").SetValue(DataHelper.EndRaidClass, DataHelper.PlayerProfile); DataHelper.EndRaidClass.GetType().GetField("profile").SetValue(DataHelper.EndRaidClass, DataHelper.PlayerProfile);

View File

@ -32,7 +32,7 @@ public class MethodHelper
} }
/// <summary> /// <summary>
/// Method to get Quit method from EFT (as of 20/05/2024 - GClass1955) /// Method to get Quit method from EFT (as of 02/11/2024 - GClass2193)
/// </summary> /// </summary>
/// <returns>MethodInfo</returns> /// <returns>MethodInfo</returns>
public static MethodInfo GetApplicationQuitMethod() public static MethodInfo GetApplicationQuitMethod()
@ -40,8 +40,11 @@ public class MethodHelper
try try
{ {
return DataHelper._eftAssembly.GetTypes().First(x => return DataHelper._eftAssembly.GetTypes().First(x =>
x.GetMethods().Any(y => {
y.Name == "Quit") var methods = x.GetMethods();
return methods.Any(m => m.Name == "Quit") && methods.Any(m => m.Name == "QuitWithCode");
}
).GetMethod("Quit"); ).GetMethod("Quit");
} }
catch (Exception e) catch (Exception e)

View File

@ -220,6 +220,9 @@ namespace DumpLib.Helpers
} }
} }
/// <summary>
/// DONT USE ANYMORE, USE GETPROFILECOMPLETEDATA()
/// </summary>
public static object GetPlayerProfile() public static object GetPlayerProfile()
{ {
try try
@ -235,5 +238,47 @@ namespace DumpLib.Helpers
throw; throw;
} }
} }
/// <summary>
/// TODO: Rename as its not an actual shim
///
/// </summary>
/// <returns></returns>
public static object GetProfileShim()
{
try
{
var typeToUse = TypeHelper.GetProfileShimType();
var instance = Activator.CreateInstance(typeToUse,
new object[]
{
DataHelper.Session.GetType().GetProperty("Profile").GetValue(DataHelper.Session),
TypeHelper.GetProfileSearchControllerType().GetField("Instance").GetValue(null)
});
return instance;
}
catch (Exception e)
{
Utils.LogError("GetProfileShim");
Utils.LogError(e);
throw;
}
}
public static object GetProfileCompleteData()
{
try
{
var completeData = ReflectionHelper.GetProfileShim();
var converterMethod = CreateGenericMethod(MethodHelper.GetToUnparsedDataMethod(), TypeHelper.GetProfileShimType());
return converterMethod.Invoke(null, new[] { completeData, Array.Empty<JsonConverter>() });
}
catch (Exception e)
{
Utils.LogError("GetProfileCompleteData");
Utils.LogError(e);
throw;
}
}
} }
} }

View File

@ -222,11 +222,11 @@ public static class TypeHelper
{ {
var fields = x.GetFields(); var fields = x.GetFields();
var methods = x.GetMethods(); var methods = x.GetMethods();
return fields.Length == 6 && return fields.Length == 6 &&
fields.Any(f => f.Name == "location") && fields.Any(f => f.Name == "location") &&
fields.Any(f => f.Name == "_id") && fields.Any(f => f.Name == "_id") &&
methods.Any(m => m.Name == "Clone") && methods.Any(m => m.Name == "Clone") &&
methods.Any(m => m.Name == "ToString"); methods.Any(m => m.Name == "ToString");
}); });
} }
@ -253,4 +253,56 @@ public static class TypeHelper
throw; throw;
} }
} }
public static Type GetProfileShimType()
{
try
{
return DataHelper._eftAssembly.GetTypes().First(x =>
{
var fields = x.GetFields();
var constructors = x.GetConstructors();
var properties = x.GetProperties();
var methods = x.GetMethods();
return fields.Length == 25 && constructors.Length == 2 &&
properties.Length == 0 && methods.Length == 4 &&
fields.Any(f => f.Name == "KarmaValue") &&
fields.Any(f => f.Name == "Encyclopedia") &&
fields.Any(f => f.Name == "Id") &&
fields.Any(f => f.Name == "AccountId") &&
fields.Any(f => f.Name == "PetId") &&
fields.Any(f => f.Name == "Customization");
});
}
catch (Exception e)
{
Utils.LogError("GetProfileShimType");
Utils.LogError(e);
throw;
}
}
public static Type GetProfileSearchControllerType()
{
try
{
return DataHelper._eftAssembly.GetTypes().First(x =>
{
var fields = x.GetFields();
var methods = x.GetMethods();
return fields.Length == 1 && methods.Length == 17 &&
!x.IsInterface && methods.Any(m => m.Name == "IsItemKnown") &&
methods.Any(m => m.Name == "TryFindChangedContainer") &&
methods.Any(m => m.Name == "GetObserverItemState");
});
}
catch (Exception e)
{
Utils.LogError("GetProfileSearchControllerType");
Utils.LogError(e);
throw;
}
}
} }

View File

@ -9,9 +9,12 @@ namespace ReCodeIt.Commands;
[Command("DeObfuscate", Description = "Generates a de-obfuscated -cleaned dll in the folder your assembly is in")] [Command("DeObfuscate", Description = "Generates a de-obfuscated -cleaned dll in the folder your assembly is in")]
public class DeObfuscate : ICommand public class DeObfuscate : ICommand
{ {
[CommandParameter(0, IsRequired = true, Description = "The absolute path to your obfuscated assembly file, folder must contain all references to be resolved.")] [CommandParameter(0, IsRequired = true, Description = "The absolute path to your obfuscated assembly or exe file, folder must contain all references to be resolved.")]
public string AssemblyPath { get; init; } public string AssemblyPath { get; init; }
[CommandParameter(1, IsRequired = false, Description = "Is the target the EFT launcher?")]
public bool IsLauncher { get; init; } = false;
public ValueTask ExecuteAsync(IConsole console) public ValueTask ExecuteAsync(IConsole console)
{ {
DataProvider.IsCli = true; DataProvider.IsCli = true;
@ -19,7 +22,7 @@ public class DeObfuscate : ICommand
Logger.Log("Deobfuscating assembly..."); Logger.Log("Deobfuscating assembly...");
Deobfuscator.Deobfuscate(AssemblyPath); Deobfuscator.Deobfuscate(AssemblyPath, IsLauncher);
Logger.Log("Complete", ConsoleColor.Green); Logger.Log("Complete", ConsoleColor.Green);

View File

@ -6,6 +6,7 @@ public static class Program
public static async Task<int> Main() => public static async Task<int> Main() =>
await new CliApplicationBuilder() await new CliApplicationBuilder()
.AddCommandsFromThisAssembly() .AddCommandsFromThisAssembly()
.AllowDebugMode()
.SetExecutableName("ReCodeIt") .SetExecutableName("ReCodeIt")
.Build() .Build()
.RunAsync(); .RunAsync();

File diff suppressed because it is too large Load Diff

View File

@ -113,6 +113,22 @@ public partial class ReCodeItForm : Form
} }
}; };
EventsIncludeTextField.KeyDown += (sender, e) =>
{
if (e.KeyCode == Keys.Enter)
{
EventsAddButton_Click(sender, e);
}
};
EventsExcludeTextField.KeyDown += (sender, e) =>
{
if (e.KeyCode == Keys.Enter)
{
EventsExcludeAddButton_Click(sender, e);
}
};
#endregion MANUAL_REMAPPER #endregion MANUAL_REMAPPER
#region AUTOMAPPER #region AUTOMAPPER
@ -287,6 +303,8 @@ public partial class ReCodeItForm : Form
ExcludeProperties = GUIHelpers.GetAllEntriesFromListBox(PropertiesExcludeBox), ExcludeProperties = GUIHelpers.GetAllEntriesFromListBox(PropertiesExcludeBox),
IncludeNestedTypes = GUIHelpers.GetAllEntriesFromListBox(NestedTypesIncludeBox), IncludeNestedTypes = GUIHelpers.GetAllEntriesFromListBox(NestedTypesIncludeBox),
ExcludeNestedTypes = GUIHelpers.GetAllEntriesFromListBox(NestedTypesExcludeBox), ExcludeNestedTypes = GUIHelpers.GetAllEntriesFromListBox(NestedTypesExcludeBox),
IncludeEvents = GUIHelpers.GetAllEntriesFromListBox(EventsIncludeBox),
ExcludeEvents = GUIHelpers.GetAllEntriesFromListBox(EventsExcludeBox)
} }
}; };
@ -631,6 +649,45 @@ public partial class ReCodeItForm : Form
} }
} }
private void EventsAddButton_Click(object sender, EventArgs e)
{
if (EventsIncludeTextField.Text == string.Empty) return;
if (!EventsIncludeBox.Items.Contains(EventsIncludeTextField.Text))
{
EventsIncludeBox.Items.Add(EventsIncludeTextField.Text);
EventsIncludeTextField.Clear();
}
}
private void EventsRemoveButton_Click(object sender, EventArgs e)
{
if (EventsIncludeBox.SelectedItem != null)
{
EventsIncludeBox.Items.Remove(EventsIncludeBox.SelectedItem);
}
}
private void EventsExcludeAddButton_Click(object sender, EventArgs e)
{
if (EventsExcludeTextField.Text == string.Empty) return;
if (!EventsExcludeBox.Items.Contains(EventsExcludeTextField.Text))
{
EventsExcludeBox.Items.Add(EventsExcludeTextField.Text);
EventsExcludeTextField.Clear();
}
}
private void EventsExcludeRemoveButton_Click(object sender, EventArgs e)
{
if (EventsExcludeBox.SelectedItem != null)
{
EventsExcludeBox.Items.Remove(EventsExcludeBox.SelectedItem);
}
}
private void AutoMapperExcludeAddButton_Click(object sender, EventArgs e) private void AutoMapperExcludeAddButton_Click(object sender, EventArgs e)
{ {
if (AutoMapperTypesToIgnoreTextField.Text == string.Empty) return; if (AutoMapperTypesToIgnoreTextField.Text == string.Empty) return;
@ -932,6 +989,8 @@ public partial class ReCodeItForm : Form
PropertiesExcludeTextField.Clear(); PropertiesExcludeTextField.Clear();
NestedTypesIncludeTextField.Clear(); NestedTypesIncludeTextField.Clear();
NestedTypesExcludeTextField.Clear(); NestedTypesExcludeTextField.Clear();
EventsIncludeTextField.Clear();
EventsExcludeTextField.Clear();
// Numeric UpDowns // Numeric UpDowns
@ -960,6 +1019,8 @@ public partial class ReCodeItForm : Form
PropertiesExcludeBox.Items.Clear(); PropertiesExcludeBox.Items.Clear();
NestedTypesIncludeBox.Items.Clear(); NestedTypesIncludeBox.Items.Clear();
NestedTypesExcludeBox.Items.Clear(); NestedTypesExcludeBox.Items.Clear();
EventsIncludeBox.Items.Clear();
EventsExcludeBox.Items.Clear();
} }
private void ManualEditSelectedRemap(object? sender, TreeNodeMouseClickEventArgs e) private void ManualEditSelectedRemap(object? sender, TreeNodeMouseClickEventArgs e)
@ -1122,6 +1183,16 @@ public partial class ReCodeItForm : Form
{ {
NestedTypesExcludeBox.Items.Add(method); NestedTypesExcludeBox.Items.Add(method);
} }
foreach (var method in remap.SearchParams.IncludeEvents)
{
EventsIncludeBox.Items.Add(method);
}
foreach (var method in remap.SearchParams.ExcludeEvents)
{
EventsExcludeBox.Items.Add(method);
}
} }
private void PopulateDomainUpDowns() private void PopulateDomainUpDowns()
@ -1183,4 +1254,5 @@ public partial class ReCodeItForm : Form
UseShellExecute = true UseShellExecute = true
}); });
} }
} }

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<root> <root>
<!-- <!--
Microsoft ResX Schema Microsoft ResX Schema
Version 2.0 Version 2.0
@ -48,7 +48,7 @@
value : The object must be serialized with value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding. : and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64 mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
@ -126,4 +126,7 @@
<metadata name="toolTip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> <metadata name="toolTip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value> <value>17, 17</value>
</metadata> </metadata>
<metadata name="$this.TrayHeight" type="System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>47</value>
</metadata>
</root> </root>

View File

@ -251,7 +251,7 @@ internal static class GUIHelpers
remapTreeItem.Nodes.Add(includeNestedTypes); remapTreeItem.Nodes.Add(includeNestedTypes);
} }
if (model.SearchParams.IncludeNestedTypes?.Count > 0) if (model.SearchParams.ExcludeNestedTypes?.Count > 0)
{ {
var excludeNestedTypes = var excludeNestedTypes =
GenerateNodeFromList(model.SearchParams.ExcludeNestedTypes, "Exclude Nested Types"); GenerateNodeFromList(model.SearchParams.ExcludeNestedTypes, "Exclude Nested Types");
@ -259,6 +259,22 @@ internal static class GUIHelpers
remapTreeItem.Nodes.Add(excludeNestedTypes); remapTreeItem.Nodes.Add(excludeNestedTypes);
} }
if (model.SearchParams.IncludeEvents?.Count > 0)
{
var includeEvents =
GenerateNodeFromList(model.SearchParams.IncludeEvents, "Include Events");
remapTreeItem.Nodes.Add(includeEvents);
}
if (model.SearchParams.ExcludeEvents?.Count > 0)
{
var excludeEvents =
GenerateNodeFromList(model.SearchParams.ExcludeEvents, "Exclude Events");
remapTreeItem.Nodes.Add(excludeEvents);
}
ReCodeItForm.RemapNodes.Add(remapTreeItem, model); ReCodeItForm.RemapNodes.Add(remapTreeItem, model);
return remapTreeItem; return remapTreeItem;

View File

@ -222,7 +222,8 @@ public class DumperClass
var firstMethod = methods.FirstOrDefault(m => m.Parameters.Any(p => p.Name == "certificate")); var firstMethod = methods.FirstOrDefault(m => m.Parameters.Any(p => p.Name == "certificate"));
var secondMethod = methods.FirstOrDefault(m => m.Parameters.Any(p => p.Name == "certificateData")); var secondMethod = methods.FirstOrDefault(m => m.Parameters.Any(p => p.Name == "certificateData"));
if (firstMethod?.Body.Instructions.Count != 55 || secondMethod?.Body.Instructions.Count != 14) // as of 01/11/24 firstMethod returns true, so its now only 2 instructions, was 55 (this may change, BSG have byppassed their own SSL checks atm)
if (firstMethod?.Body.Instructions.Count != 2 || secondMethod?.Body.Instructions.Count != 14)
{ {
Logger.Log($"Instruction count has changed, method with 'certificate' as a param - before: 51, now: {firstMethod.Body.Instructions.Count}, " + Logger.Log($"Instruction count has changed, method with 'certificate' as a param - before: 51, now: {firstMethod.Body.Instructions.Count}, " +
$"method with 'certificateData' as a param - before: 14, now: {secondMethod.Body.Instructions.Count}", ConsoleColor.Red); $"method with 'certificateData' as a param - before: 14, now: {secondMethod.Body.Instructions.Count}", ConsoleColor.Red);

View File

@ -26,4 +26,6 @@ public enum ENoMatchReason
NestedTypeInclude, NestedTypeInclude,
NestedTypeExclude, NestedTypeExclude,
NestedTypeCount, NestedTypeCount,
EventsInclude,
EventsExclude
} }

View File

@ -101,6 +101,8 @@ public class SearchParams
public List<string> ExcludeProperties { get; set; } public List<string> ExcludeProperties { get; set; }
public List<string> IncludeNestedTypes { get; set; } public List<string> IncludeNestedTypes { get; set; }
public List<string> ExcludeNestedTypes { get; set; } public List<string> ExcludeNestedTypes { get; set; }
public List<string> IncludeEvents { get; set; } = [];
public List<string> ExcludeEvents { get; set; } = [];
#endregion LISTS #endregion LISTS

View File

@ -2,12 +2,13 @@
using dnlib.DotNet.Emit; using dnlib.DotNet.Emit;
using ReCodeIt.Utils; using ReCodeIt.Utils;
using System.Diagnostics; using System.Diagnostics;
using ReCodeIt.ReMapper;
namespace ReCodeItLib.Remapper; namespace ReCodeItLib.Remapper;
public static class Deobfuscator public static class Deobfuscator
{ {
public static void Deobfuscate(string assemblyPath) public static void Deobfuscate(string assemblyPath, bool isLauncher = false)
{ {
var executablePath = Path.Combine(DataProvider.DataPath, "De4dot", "de4dot.exe"); var executablePath = Path.Combine(DataProvider.DataPath, "De4dot", "de4dot.exe");
@ -54,19 +55,29 @@ public static class Deobfuscator
token = $"0x{(deobfRid.Raw | deobfRid.Rid):x4}"; token = $"0x{(deobfRid.Raw | deobfRid.Rid):x4}";
Console.WriteLine($"Deobfuscation token: {token}"); Console.WriteLine($"Deobfuscation token: {token}");
var process = Process.Start(executablePath, var cmd = isLauncher
$"--un-name \"!^<>[a-z0-9]$&!^<>[a-z0-9]__.*$&![A-Z][A-Z]\\$<>.*$&^[a-zA-Z_<{{$][a-zA-Z_0-9<>{{}}$.`-]*$\" \"{assemblyPath}\" --strtyp delegate --strtok \"{token}\""); ? $"--un-name \"!^<>[a-z0-9]$&!^<>[a-z0-9]__.*$&![A-Z][A-Z]\\$<>.*$&^[a-zA-Z_<{{$][a-zA-Z_0-9<>{{}}$.`-]*$\" \"{assemblyPath}\" --strtok \"{token}\""
: $"--un-name \"!^<>[a-z0-9]$&!^<>[a-z0-9]__.*$&![A-Z][A-Z]\\$<>.*$&^[a-zA-Z_<{{$][a-zA-Z_0-9<>{{}}$.`-]*$\" \"{assemblyPath}\" --strtyp delegate --strtok \"{token}\"";
var process = Process.Start(executablePath, cmd);
process.WaitForExit(); process.WaitForExit();
var extName = isLauncher ? "-cleaned.exe" : "-cleaned.dll";
// Fixes "ResolutionScope is null" by rewriting the assembly // Fixes "ResolutionScope is null" by rewriting the assembly
var cleanedDllPath = Path.Combine(Path.GetDirectoryName(assemblyPath), Path.GetFileNameWithoutExtension(assemblyPath) + "-cleaned.dll"); var cleanedDllPath = Path.Combine(Path.GetDirectoryName(assemblyPath), Path.GetFileNameWithoutExtension(assemblyPath) + extName);
ModuleDefMD assemblyRewrite = null; ModuleDefMD assemblyRewrite = null;
using (var memoryStream = new MemoryStream(File.ReadAllBytes(cleanedDllPath))) using (var memoryStream = new MemoryStream(File.ReadAllBytes(cleanedDllPath)))
{ {
assemblyRewrite = ModuleDefMD.Load(memoryStream, modCtx); assemblyRewrite = ModuleDefMD.Load(memoryStream, modCtx);
if (isLauncher)
{
SPTPublicizer.PublicizeClasses(assemblyRewrite, true);
}
} }
assemblyRewrite.Write(cleanedDllPath); assemblyRewrite.Write(cleanedDllPath);

View File

@ -7,7 +7,7 @@ internal static class SPTPublicizer
{ {
private static ModuleDefMD MainModule; private static ModuleDefMD MainModule;
public static void PublicizeClasses(ModuleDefMD definition) public static void PublicizeClasses(ModuleDefMD definition, bool isLauncher = false)
{ {
var types = definition.GetTypes(); var types = definition.GetTypes();
@ -15,15 +15,15 @@ internal static class SPTPublicizer
{ {
if (type.IsNested) continue; // Nested types are handled when publicizing the parent type if (type.IsNested) continue; // Nested types are handled when publicizing the parent type
PublicizeType(type); PublicizeType(type, isLauncher);
} }
} }
private static void PublicizeType(TypeDef type) private static void PublicizeType(TypeDef type, bool isLauncher)
{ {
// if (type.CustomAttributes.Any(a => a.AttributeType.Name == // if (type.CustomAttributes.Any(a => a.AttributeType.Name ==
// nameof(CompilerGeneratedAttribute))) { return; } // nameof(CompilerGeneratedAttribute))) { return; }
if (!type.IsNested && !type.IsPublic || type.IsNested && !type.IsNestedPublic) if (!type.IsNested && !type.IsPublic || type.IsNested && !type.IsNestedPublic)
{ {
if (!type.Interfaces.Any(i => i.Interface.Name == "IEffect")) if (!type.Interfaces.Any(i => i.Interface.Name == "IEffect"))
@ -32,17 +32,17 @@ internal static class SPTPublicizer
type.Attributes |= type.IsNested ? TypeAttributes.NestedPublic : TypeAttributes.Public; // Apply a public visibility attribute type.Attributes |= type.IsNested ? TypeAttributes.NestedPublic : TypeAttributes.Public; // Apply a public visibility attribute
} }
} }
if (type.IsSealed) if (type.IsSealed && !isLauncher)
{ {
type.Attributes &= ~TypeAttributes.Sealed; // Remove the Sealed attribute if it exists type.Attributes &= ~TypeAttributes.Sealed; // Remove the Sealed attribute if it exists
} }
foreach (var method in type.Methods) foreach (var method in type.Methods)
{ {
PublicizeMethod(method); PublicizeMethod(method);
} }
foreach (var property in type.Properties) foreach (var property in type.Properties)
{ {
if (property.GetMethod != null) PublicizeMethod(property.GetMethod); if (property.GetMethod != null) PublicizeMethod(property.GetMethod);
@ -69,7 +69,7 @@ internal static class SPTPublicizer
*/ */
foreach (var nestedType in type.NestedTypes) foreach (var nestedType in type.NestedTypes)
{ {
PublicizeType(nestedType); PublicizeType(nestedType, isLauncher);
} }
} }

View File

@ -158,6 +158,7 @@ public class ReCodeItRemapper
if (!FilterTypesByMethods(mapping, ref types)) return; if (!FilterTypesByMethods(mapping, ref types)) return;
if (!FilterTypesByFields(mapping, ref types)) return; if (!FilterTypesByFields(mapping, ref types)) return;
if (!FilterTypesByProps(mapping, ref types)) return; if (!FilterTypesByProps(mapping, ref types)) return;
if (!FilterTypesByEvents(mapping, ref types)) return;
if (!FilterTypesByNested(mapping, ref types)) return; if (!FilterTypesByNested(mapping, ref types)) return;
types = CtorTypeFilters.FilterByParameterCount(types, mapping.SearchParams); types = CtorTypeFilters.FilterByParameterCount(types, mapping.SearchParams);
@ -385,7 +386,30 @@ public class ReCodeItRemapper
return true; return true;
} }
private static bool FilterTypesByEvents(RemapModel mapping, ref IEnumerable<TypeDef> types)
{
types = EventTypeFilters.FilterByInclude(types, mapping.SearchParams);
if (!types.Any())
{
AllTypesFilteredOutFor(mapping, ENoMatchReason.EventsInclude);
mapping.TypeCandidates.UnionWith(types);
return false;
}
types = EventTypeFilters.FilterByExclude(types, mapping.SearchParams);
if (!types.Any())
{
AllTypesFilteredOutFor(mapping, ENoMatchReason.EventsExclude);
mapping.TypeCandidates.UnionWith(types);
return false;
}
return true;
}
private void HandleDirectRename(RemapModel mapping, ref IEnumerable<TypeDef> types) private void HandleDirectRename(RemapModel mapping, ref IEnumerable<TypeDef> types)
{ {
foreach (var type in types) foreach (var type in types)

View File

@ -0,0 +1,58 @@
using dnlib.DotNet;
using ReCodeIt.Models;
namespace ReCodeItLib.Remapper.Search;
internal static class EventTypeFilters
{
/// <summary>
/// Filters based on events name
/// </summary>
/// <param name="types"></param>
/// <param name="parms"></param>
/// <returns>Filtered list</returns>
public static IEnumerable<TypeDef> FilterByInclude(IEnumerable<TypeDef> types, SearchParams parms)
{
if (parms.IncludeEvents.Count == 0) return types;
List<TypeDef> filteredTypes = [];
foreach (var type in types)
{
if (parms.IncludeEvents
.All(includeName => type.Events
.Any(ev => ev.Name.String == includeName)))
{
filteredTypes.Add(type);
}
}
return filteredTypes.Any() ? filteredTypes : types;
}
/// <summary>
/// Filters based on events name
/// </summary>
/// <param name="types"></param>
/// <param name="parms"></param>
/// <returns>Filtered list</returns>
public static IEnumerable<TypeDef> FilterByExclude(IEnumerable<TypeDef> types, SearchParams parms)
{
if (parms.ExcludeEvents.Count == 0) return types;
List<TypeDef> filteredTypes = [];
foreach (var type in types)
{
var match = type.Events
.Where(prop => parms.ExcludeEvents.Contains(prop.Name.String));
if (!match.Any())
{
filteredTypes.Add(type);
}
}
return filteredTypes.Any() ? filteredTypes : types;
}
}