Загрузка конфигов домена для .NET 4.5, иначе некоторые библиотеки не работают (такие как MySQL Connector/Net)

This commit is contained in:
Kernell 2015-12-03 01:54:58 +03:00
parent 457aa93ec4
commit ade2e99586
4 changed files with 9 additions and 1 deletions

View File

@ -175,6 +175,11 @@ MonoObject* CMonoDomain::CreateObject( MonoClass* klass )
return mono_object_new( this->m_pDomain, klass ); return mono_object_new( this->m_pDomain, klass );
} }
void CMonoDomain::SetConfig( const char *szBaseDir, const char *szConfigFileName )
{
mono_domain_set_config( this->m_pDomain, szBaseDir, szConfigFileName );
}
MonoString* CMonoDomain::NewString( const char* szText ) MonoString* CMonoDomain::NewString( const char* szText )
{ {
return mono_string_new( this->m_pDomain, szText ); return mono_string_new( this->m_pDomain, szText );

View File

@ -55,6 +55,7 @@ public:
bool Set ( bool bForce ); bool Set ( bool bForce );
MonoAssembly* OpenAssembly ( const char *szName ); MonoAssembly* OpenAssembly ( const char *szName );
MonoObject* CreateObject ( MonoClass* klass ); MonoObject* CreateObject ( MonoClass* klass );
void SetConfig ( const char *szBaseDir, const char *szConfigFileName );
MonoString* NewString ( const char* szText ); MonoString* NewString ( const char* szText );
MonoString* NewString ( string strText ); MonoString* NewString ( string strText );

View File

@ -156,6 +156,8 @@ bool CResource::Init( void )
return false; return false;
} }
this->m_pMonoDomain->SetConfig( "mods/deathmatch/", "mods/deathmatch/mono/etc/mono/4.5/machine.config" );
this->m_pMonoDomain->Set( false ); this->m_pMonoDomain->Set( false );
this->m_pMonoDomain->Init(); this->m_pMonoDomain->Init();

View File

@ -12,7 +12,7 @@
#define MODULE_NAME "Mono 4.2.1" #define MODULE_NAME "Mono 4.2.1"
#define MODULE_AUTHOR "Dmitry Korolev <kernell@mtaroleplay.ru>" #define MODULE_AUTHOR "Dmitry Korolev <kernell@mtaroleplay.ru>"
#define MODULE_VERSION 0.1f #define MODULE_VERSION 0.2f
#include "CFunctions.h" #include "CFunctions.h"
#include "CResource.h" #include "CResource.h"