예제 #1
0
        public object[] GetAllItemsWithInterface <T>() where T : class
        {
            var helper = DomainHelper.GetHelper <IDomainHelper>(Domain);// GetDomainHelper();
            var items  = helper.GetAllItemsWithInterface <T>();

            return(items);
        }
예제 #2
0
        public T CreateInstanceAndUnwrap <T>(string assemblyName, string typeName)
        {
            var helper = DomainHelper.GetHelper <IDomainHelper>(Domain);// GetDomainHelper();
            var result = helper.CreateInstanceAndUnwrap <T>(assemblyName, typeName);

            return(result);
        }
예제 #3
0
 protected void LoadAssemblies(params string[] assemblyNames)
 {
     if (assemblyNames?.Length > 0)
     {
         var helper = DomainHelper.GetHelper <IDomainHelper>(Domain);// GetDomainHelper();
         foreach (var assembly in assemblyNames)
         {
             helper.Load(assembly);
         }
     }
 }
예제 #4
0
        protected void OnDispose()
        {
            var helper = DomainHelper.GetHelper <IDomainHelper>(Domain);// GetDomainHelper();

            helper?.Dispose();
            if (Domain != null)
            {
                try
                {
                    AppDomain.Unload(Domain);
                }
                catch (CannotUnloadAppDomainException e)
                {
                    Log.e(e);
                }
            }
            Domain = null;
        }
예제 #5
0
 public CustomAppDomain(string name, string personalPath, bool shadowCopyFiles, bool autoloadAllDlls = true) : this(name, personalPath, shadowCopyFiles, null)
 {
     try
     {
         if (autoloadAllDlls)
         {
             using (var helper = DomainHelper.GetHelper <IDomainHelper>(Domain))
             {
                 foreach (var filename in System.IO.Directory.GetFiles(personalPath))
                 {
                     if (System.IO.Path.GetExtension(filename).ToLower().Equals(".dll"))
                     {
                         helper.Load(filename);
                     }
                 }
             }
         }
     }
     catch (Exception e)
     {
         Log.e(e);
     }
 }
예제 #6
0
        public object ExecuteStaticMethod(string assemblyName, string typeName, string methodName, params object[] args)
        {
            var helper = DomainHelper.GetHelper <IDomainHelper>(Domain);// GetDomainHelper();

            return(helper.ExecuteStaticMethod(assemblyName, typeName, methodName, args));
        }
예제 #7
0
        public int ExecuteAssemblyByName <T>(string assemblyName, params string[] args)
        {
            var helper = DomainHelper.GetHelper <IDomainHelper>(Domain);// GetDomainHelper();

            return(helper.ExecuteAssemblyByName(assemblyName, args));
        }