Finally got some time to say my experience about this:
Picking up directly, this Ex method cannot resolve some class /r methods what not Ex can.
I mean sure with Ex method app doesn’t crash and you do not need debug exceptions alike C5.
Yet…
for example from 55 images and their classes (from search form) :
Not Ex method found 200+
while this Ex method found 50+
So Ex method doesn't find most of classes and their method -- YET, again this method it is most safest approach (if you experiencing a lot of crashes during MONO info lookup...)...
So…
Edited Ex method that should found equally same as not Ex and do not cause app to crash…
Code: Select all
function init_DotNetInfo()
-- I didn't found a better way to access "dotnetinfo.lua" local functions
miDotNetInfoClick(getMainForm()) -- opens ".Net Info" form
df.Hide() -- hides just opened ".Net Info" form
end
function mono_findClassEx(namespace, classname)
if namespace == nil then
print("[mono_findClassEx]: Invalid parameters!" .. namespace .. "." .. classname)
else
if classname == nil then
classname = namespace
namespace = ''
else
if not namespace == "" or not namespace == nil then
classname = namespace .. "." .. classname
end -- fixed issue when namespace is provided.
end
if DataSource.Domains == nil then
print("[mono_findClassEx]: DataSource is not initialized! Open .Net Info once")
init_DotNetInfo()
end
for _, Domain in ipairs(DataSource.Domains) do
if Domain.Images == nil then
DataSource.getImages(Domain)
end
for _, Image in ipairs(Domain.Images) do
if Image.Classes == nil then
Image.Classes = {}
Image.Classes.Busy = true
DataSource.getClasses(Image)
Image.Classes.Busy = nil
end
if namespace then
for _, Class in ipairs(Image.Classes) do -- fails here
-- catches first found Class if no namespace is provided for code flow.
-- this fixes and create new potential problem. Yet not all important classes has namespace.
if Class.FullName == classname or Class.Name == classname then
return Class.Handle
end
end
end
end
end
end
return nil
end
function mono_findMethodEx(namespace, classname, methodname)
if namespace == nil or classname == nil then
print("[mono_findMethodEx]: Invalid parameters! " .. namespace .. "." .. classname .. ":" .. methodname)
else
if methodname == nil then
methodname = classname
classname = namespace
namespace = ''
end
local class = mono_findClassEx(namespace, classname)
if class == nil or class == 0 then
print("[mono_findMethodEx]: Class not found! " .. namespace .. "." .. classname)
else
return mono_class_findMethod(class, methodname)
end
end
return nil
end
function mono_symbolLookupCallbackEx(symbol)
local namespace, classname, methodname = SplitDotNetName(symbol)
if (methodname == '') or (classname == '') then
print("[mono_symbolLookupCallbackEx]: Invalid parameters! " .. namespace .. "." .. classname .. ":" ..
methodname)
else
if monopipe == nil or monopipe.IL2CPP then
print("[mono_symbolLookupCallbackEx]: Unable to use mono features.")
else
local method = mono_findMethodEx(namespace, classname, methodname)
if method == nil or method == 0 then
print("[mono_symbolLookupCallbackEx]: Method not found! " .. namespace .. "." .. classname .. ":" ..
methodname)
else
local methodaddress = mono_compile_method(method)
if methodaddress == nil or methodaddress == 0 then
print("[mono_symbolLookupCallbackEx]: mono_compile_method error!")
else
return methodaddress
end
end
end
end
return nil
end
return mono_symbolLookupCallbackEx("") -- Class:method
….
Also something mixed , From .NET Info form --> Find --> Find class to Classname:method as text file (I should later merge this into my project) -- Using this Ex project in combine... (to output text file just it takes time minute or so, depending on search result count (slow at beginning)..)
local function getFormbyName(string)
for i = 0, getFormCount() - 1 do
local root = getForm(i)
local root_name = root.Name
if root_name == string then
return root;
end
end
if root_name ~= string then
return nil
end
end
local function local_get_mono_table() -- gets alldata
if not process then
return
end
l = mono_enumDomains()
a = nil
b = nil
c = nil
a = mono_enumAssemblies(l)
b = {}
-- c = {}
for i = 1, #a do
local s = a[i]
local img = mono_getImageFromAssembly(s)
tid = mono_image_enumClasses(img)
for j = 1, #tid do
local cID = tid[j].class
local nID = tid[j].namespace
local methods = mono_class_enumMethods(cID)
for u = 1, #methods do
local mstring
if tid[j].namespace == "" then
mstring = tid[j].classname .. ":" .. methods[u].name
else
mstring = tid[j].namespace .. "." .. tid[j].classname .. ":" .. methods[u].name
end
methods[u].lookupString = mstring
end
tid[j].methods = methods
local fields = mono_class_enumFields(cID)
tid[j].fields = fields
end
table.insert(b, {
root = s,
img = img,
classes = tid
})
end
return b -- , c
end
if not methods then
methods = local_get_mono_table()
end
searchwin = getFormbyName("frmDotNetSearch")
if not searchwin then return error("Couldn't find Find Class .NET Info form") end
-- print(searchwin.lvResults.Items.Count) -- class count
local resultlist = createStringList()
for i = 0, searchwin.lvResults.Items.Count - 1 do
for a = 1, #methods do
if searchwin.lvResults.Items[i].Caption == mono_image_get_name(methods[a].img) then
for b = 1, #methods[a].classes do
local stringa = methods[a].classes[b].classname
local stringb = searchwin.lvResults.Items[i].SubItems.Text:gsub("^%s*(.-)%s*$", "%1"):sub(1, -1)
if (stringa == stringb) then
for c = 1, #methods[a].classes[b].methods do
local check = mono_symbolLookupCallbackEx(methods[a].classes[b].methods[c].lookupString)
if check then
resultlist.add(methods[a].classes[b].methods[c].lookupString)
end
end
break
end
end
break
end
end
end
local sd = createSaveDialog()
sd.defaultExt = '.txt'
sd.Filter = [[Text File (*.txt)|*.txt]]
if sd.Execute() then
resultlist.saveToFile(sd.FileName)
end
searchwin.destroy()
All this for unity mono games.