using System; using Decal.Adapter.Support; using Decal.Adapter.Wrappers; using Decal.Interop.Core; namespace Decal.Adapter; /// /// /// public sealed class PluginProxy : IPlugin2, IDecalDirectory { private PluginHost mySite; private PluginBase myWrapped; internal PluginProxy(PluginBase toWrap) { myWrapped = toWrap; } void IPlugin2.Initialize(PluginSite2 Site) { mySite = new PluginHost(Site); myWrapped.SetHost(mySite); try { myWrapped.standardEvent(ExtensionEvents.InternalWireup); } catch (Exception ex) { Util.WriteLine("InternalWireup Exception: " + ex.Message); } try { myWrapped.standardEvent(ExtensionEvents.Startup); } catch (Exception ex2) { Util.WriteLine("Startup Exception: " + ex2.Message); } } void IPlugin2.Terminate() { try { myWrapped.standardEvent(ExtensionEvents.Shutdown); } catch (Exception ex) { Util.WriteLine("Shutdown Exception: " + ex.Message); } try { myWrapped.standardEvent(ExtensionEvents.InternalUnwire); } catch (Exception ex2) { Util.WriteLine("InternalUnwire Exception: " + ex2.Message); } mySite.Dispose(); mySite = null; myWrapped = null; } object IDecalDirectory.Lookup(string strName) { return myWrapped.ResolvePath(strName); } }