private void TearDownAppDomain(object sender, EventArgs e) { if (m_remoteDomain == null) { return; } OnBeforeUnload((ActionShim)(() => NestedToolset.Unload())); AppDomain.Unload(m_remoteDomain); var expected = Path.Combine( Deployment.Path, WkhtmltoxBindings.DLLNAME); foreach (ProcessModule module in Process.GetCurrentProcess().Modules) { if (module.FileName == expected) { while (WinApiHelper.FreeLibrary(module.BaseAddress)) { } break; } } m_remoteDomain = null; Loaded = false; if (Unloaded != null) { Unloaded(this, EventArgs.Empty); } }
public void Load(IDeployment deployment) { if (Loaded) { return; } if (deployment != null) { Deployment = deployment; } WinApiHelper.SetDllDirectory(Deployment.Path); WkhtmltoxBindings.wkhtmltoimage_init(0); Loaded = true; }