MonoAssembly *gdmono_load_assembly_from(const String &p_name, const String &p_path) { MonoDomain *domain = mono_domain_get(); GDMonoAssembly *assembly = memnew(GDMonoAssembly(p_name, p_path)); Error err = assembly->load(domain); ERR_FAIL_COND_V(err != OK, NULL); GDMono::get_singleton()->add_assembly(mono_domain_get_id(domain), assembly); return assembly->get_assembly(); }
MonoAssembly *GDMonoAssembly::_load_assembly_from(const String &p_name, const String &p_path) { GDMonoAssembly *assembly = memnew(GDMonoAssembly(p_name, p_path)); MonoDomain *domain = mono_domain_get(); Error err = assembly->load(domain); if (err != OK) { memdelete(assembly); ERR_FAIL_V(NULL); } GDMono::get_singleton()->add_assembly(domain ? mono_domain_get_id(domain) : 0, assembly); return assembly->get_assembly(); }
GDMonoClass *GDMono::get_class(MonoClass *p_raw_class) { MonoImage *image = mono_class_get_image(p_raw_class); if (image == corlib_assembly->get_image()) return corlib_assembly->get_class(p_raw_class); uint32_t domain_id = mono_domain_get_id(mono_domain_get()); HashMap<String, GDMonoAssembly *> &domain_assemblies = assemblies[domain_id]; const String *k = NULL; while ((k = domain_assemblies.next(k))) { GDMonoAssembly *assembly = domain_assemblies.get(*k); if (assembly->get_image() == image) { GDMonoClass *klass = assembly->get_class(p_raw_class); if (klass) return klass; } } return NULL; }