예제 #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;
 }
예제 #7
0
        public static void ClearAll()
        {
            CustomConfigAssemblyInspector = null;
            CustomUserConfig = null;

        }