예제 #1
0
 public void UnLoad()
 {
 
     if (mLoader != null)
     {
         try
         {
             Log.Info("<{0}> domain unloading ...", AppName);
             mLoader.UnLoad();
             System.Threading.Thread.Sleep(1000);
             AppDomain.Unload(mAppDomain);
             Status = DomainStatus.Stop;
             Log.Info("<{0}> domain unloaded!", AppName);
         }
         catch (Exception e_)
         {
             if (Log != null)
             {
                 Log.Error("<{0}> domain unload error {1}!", AppName,e_.Message);
             }
         }
         mLoader = null;
     }
     
 }
예제 #2
0
 public void Load()
 {
     try
     {
         Log.Info("<{0}> domain creating ...", AppName);
         Type loadertype = typeof(AssemblyLoader);
         AppDomainSetup setup = new AppDomainSetup();
         setup.ApplicationName = AppName;
         setup.ApplicationBase = AppPath;
         setup.CachePath = CachePath;
         setup.ShadowCopyFiles = "true";
         setup.ShadowCopyDirectories = AppPath;
         setup.ConfigurationFile = AppPath + "app.config";
         mAppDomain = AppDomain.CreateDomain(
            AppPath, null, setup);
         mLoader = (AssemblyLoader)mAppDomain.CreateInstanceAndUnwrap(
             loadertype.Assembly.GetName().Name,
             loadertype.FullName);
         if (mArgs != null)
             mLoader.CompilerFiles = mArgs.Compiler;
         mLoader.SetLog(Log);
         mLoader.AppName = AppName;
         mLoader.LoadAssembly(AppPath);
         mLoader.Load();
         Log.Info("<{0}> domain created!", AppName);
         Status = DomainStatus.Start;
     }
     catch (Exception e_)
     {
         if (Log != null)
         {
             Log.Error("<{0}> domain Creating error {1}!", AppName, e_.Message);
         }
     }
 }