示例#1
0
        public bool LoadAppDomain(ISearchPath searchPath)
        {
            try
            {
                if (customConfigAssemblyInspector == null)
                {
                    customConfigAssemblyInspector = CreateAppDomain();
                }

                if (searchPath.Paths.Any())
                {
                    if (!customConfigAssemblyInspector.LoadAssembly(searchPath))
                    {
                        AppDomain.Unload(workerAppDomain);
                        workerAppDomain = null;
                        CustomConfigInspectorObject.ClearAll();
                        return(false);
                    }
                }
                return(true);
            }
            catch (Exception)
            {
                return(false);
            }
        }
示例#2
0
        private ICustomConfigAssemblyInspector CreateAppDomain()
        {
            AppDomainSetup setup = new AppDomainSetup();


#if DEBUG
            setup.ApplicationBase = @"E:\db4object\db4o\Trunk\omn\OMADDIN\bin\";
#else
            setup.ApplicationBase = CommonForAppDomain.GetPath() + "\\";
#endif


            setup.ShadowCopyDirectories              = Path.GetTempPath();
            setup.ShadowCopyFiles                    = "true";
            workerAppDomain                          = AppDomain.CreateDomain("CustomConfigWorkerAppDomain", null, setup);
            AppDomain.CurrentDomain.AssemblyResolve += new ResolveEventHandler(CurrentDomain_AssemblyResolve);
            object anObject = workerAppDomain.CreateInstanceAndUnwrap("OMCustomConfigImplementation",
                                                                      "OMCustomConfigImplementation.CustomConfigAssemblyInfo.CustomConfigAssemblyInspector");
            ICustomConfigAssemblyInspector customConfigAssemblyInspector = anObject as ICustomConfigAssemblyInspector;

            object anObject1 = workerAppDomain.CreateInstanceAndUnwrap("OMCustomConfigImplementation",
                                                                       "OMCustomConfigImplementation.UserCustomConfig.UserConfig");
            IUserConfig conn = anObject1 as IUserConfig;
            CustomConfigInspectorObject.CustomUserConfig = conn;

            return(customConfigAssemblyInspector);
        }
示例#3
0
        public bool LoadAppDomain(ISearchPath searchPath)
        {
            try
            {
                if (customConfigAssemblyInspector == null)
                    customConfigAssemblyInspector = CreateAppDomain();

                if (searchPath.Paths.Any())
                {

                    if (!customConfigAssemblyInspector.LoadAssembly(searchPath))
                    {
                        AppDomain.Unload(workerAppDomain);
                        workerAppDomain = null;
                        CustomConfigInspectorObject.ClearAll(); 
                        return false;

                    }
                }
                return true;
            }
            catch (Exception)
            {
                return false;
            }
          
        }
示例#4
0
        public bool LoadAppDomain(string searchPath)
        {
            if (customConfigAssemblyInspector == null)
                customConfigAssemblyInspector = CreateAppDomain();

            customConfigAssemblyInspector.LoadAssembly(searchPath);
            bool check = CustomConfigInspectorObject.CustomUserConfig.CheckIfCustomConfigImplemented(checkLocal);
            UnloadCustomConfigAppDomain();
            return check;
        }
示例#5
0
        public bool LoadAppDomain(string searchPath)
        {
            if (customConfigAssemblyInspector == null)
            {
                customConfigAssemblyInspector = CreateAppDomain();
            }

            customConfigAssemblyInspector.LoadAssembly(searchPath);
            bool check = CustomConfigInspectorObject.CustomUserConfig.CheckIfCustomConfigImplemented(checkLocal);

            UnloadCustomConfigAppDomain();
            return(check);
        }
 public static void ClearAll()
 {
     CustomConfigAssemblyInspector = null;
     CustomUserConfig = null;
 }
        public static void ClearAll()
        {
            CustomConfigAssemblyInspector = null;
            CustomUserConfig = null;

        }