public CompilerErrorCollection JustCompile() { if (!File.Exists(Path) || PluginAppDomain != null) { return(null); } var pluginAppDomainSetup = new AppDomainSetup(); pluginAppDomainSetup.ApplicationBase = AppDomain.CurrentDomain.BaseDirectory; PluginAppDomain = AppDomain.CreateDomain(System.IO.Path.GetFileName(Path), null, pluginAppDomainSetup); script = new ScriptInAppDomain(Path, PluginAppDomain); PluginAppDomain.DoCallBack(script.JustCompileInAppDomain); var errors = script.CompilerErrors; //2015.04.10. AppDomain.Unload(PluginAppDomain); PluginAppDomain = null; return(errors); }
public bool Load() { if (!File.Exists(Path)) { return(false); } var pluginAppDomainSetup = new AppDomainSetup(); pluginAppDomainSetup.ApplicationBase = AppDomain.CurrentDomain.BaseDirectory; PluginAppDomain = AppDomain.CreateDomain(System.IO.Path.GetFileName(Path), null, pluginAppDomainSetup); script = new ScriptInAppDomain(Path, PluginAppDomain); PluginAppDomain.DoCallBack(script.LoadInAppDomain); bool success = script.Success; //2015.07.06. if (!script.Success) { AppDomain.Unload(PluginAppDomain); //2015.04.06. } //return script.Success; return(success); //2015.07.06. }