public RenderHookWrapper(Decal.Adapter.Wrappers.PluginHost Host) { bool Is_Direct3D9_Container = false; try { if (string.Compare(System.Diagnostics.Process.GetCurrentProcess().ProcessName, "Direct3D9_Container", StringComparison.OrdinalIgnoreCase) == 0) { Is_Direct3D9_Container = true; } } catch { } //Attempting to hook while running in the d3d container rather than AC will cause a crash. if (!Is_Direct3D9_Container) { iRenderHook = new RenderHookLib.SVRenderHookClass(); //Init renderhook object netsvc = Host.Decal.GetObject("services\\DecalNet.NetService", "{AA405035-E001-4CC3-B43A-156206843D64}"); iRenderHook.Init(netsvc); Marshal.ReleaseComObject(netsvc); netsvc = null; iRenderHook.fEnabled = false; LightColor = iLightColor; SlopeColor = iSlopeColor; WaterColor = iWaterColor; } }
public void Dispose() { if (disposed) { return; } disposed = true; GC.SuppressFinalize(this); if (iRenderHook != null) { iRenderHook.fEnabled = false; iRenderHook.Finalize(); Marshal.ReleaseComObject(iRenderHook); iRenderHook = null; } }