ALFA.SystemInfo.LoadAssemblyFromNWNX4 C# (CSharp) Метод

LoadAssemblyFromNWNX4() публичный статический Метод

This helper method loads an assembly from the NWNX4 installation directory.
public static LoadAssemblyFromNWNX4 ( string AssemblyName ) : Assembly
AssemblyName string Supplies the DLL file name of the /// assembly to load. The assembly should be present in the NWNX4 /// installation directory.
Результат System.Reflection.Assembly
        public static Assembly LoadAssemblyFromNWNX4(string AssemblyName)
        {
            return Assembly.LoadFrom(GetNWNX4InstallationDirectory() + AssemblyName);
        }

Usage Example

        /// <summary>
        /// This method links to the MySQL assembly, ensuring that the
        /// assembly is loaded.  If necessary the assembly is loaded from the
        /// NWNX4 installation directory.
        /// </summary>
        /// <param name="ConnectionString">Optionally supplies an overload
        /// connection string.  If null, the default string is built from the
        /// NWNX MySQL plugin's configuration file.</param>
        /// <param name="Dedicated">Supplies true if the database object is to
        /// use a dedicated connection.</param>
        private void LinkToMySQLAssembly(string ConnectionString = null, bool Dedicated = false)
        {
            AppDomain CurrentDomain = AppDomain.CurrentDomain;

            MySQLAssembly = SystemInfo.LoadAssemblyFromNWNX4("MySql.Data.dll");

            CurrentDomain.AssemblyResolve += new ResolveEventHandler(LinkToMySQLAssembly_AssemblyResolve);

            try
            {
                ForceLoadMySQL();
            }
            finally
            {
                CurrentDomain.AssemblyResolve -= new ResolveEventHandler(LinkToMySQLAssembly_AssemblyResolve);
            }

            Implementation = new MySQLDatabaseInternal(ConnectionString, Dedicated);
        }