Files
GaCy-GO/tools/cw_json_serializer_metadata.lua
T

28 lines
1.3 KiB
Lua

-- One named serializer type, bounded metadata only; no invocation or hooks.
do
_G.__gacCwJsonMethod3=_G.__gacCwJsonMethod3 or {offset=0}
local s=_G.__gacCwJsonMethod3
if s.done then return end
local flags=CS.System.Enum.ToObject(typeof(CS.System.Reflection.BindingFlags),60)
local manager=CS.RPG.Client.GlobalVars.s_GamePhaseManager
local phase=manager and typeof(CS.RPG.Client.GamePhaseManager):GetField('_CurrentPhase',flags):GetValue(manager)
if not phase or typeof(CS.RPG.Client.BattleGamePhase):IsInstanceOfType(phase)then return end
local t=typeof(CS.Newtonsoft.Json.JsonConvert)
local methods=t:GetMethods(flags)
local log=function(v)CS.UnityEngine.Debug.Log('[GAC_CW_JSON_METHOD] '..tostring(v))end
for i=s.offset,math.min(s.offset+31,methods.Length-1)do
local m=methods[i]
if m.IsStatic and m.Name=='SerializeObject' then
local ps=m:GetParameters()
if ps.Length==1 and ps[0].ParameterType==typeof(CS.System.Object) then
log('METHOD '..tostring(m)..' TOKEN '..m.MetadataToken)
log('TOKEN_ROW [GAC_CW_METHOD_TOKEN] METHOD Newtonsoft.Json.JsonConvert SerializeObject_OneObject '..m.MetadataToken)
local good,handle=pcall(function()return tostring(m.MethodHandle.Value)end)
log('HANDLE '..tostring(good)..' '..tostring(handle))
end
end
end
s.offset=s.offset+32
if s.offset>=methods.Length then s.done=true;log('END')end
end