// // Construct a new compiler instance, backed against a given resource // accessor. // // N.B. The native compiler object is allocated on demand the first // time the user compiles a script. // public NscCompiler(ResourceAccessor ResourceAccessor, SettingsManager SettingsMgr) { m_Disposed = false; m_Compiler = IntPtr.Zero; m_ResourceAccessor = ResourceAccessor; m_SettingsManager = SettingsMgr; }
// // Construct a new instance with the given stock compiler that is to be // attached. // public ScriptCompilerHook(IScriptCompiler StandardCompiler, ResourceAccessor ResourceAccessor, SettingsManager SettingsMgr) { m_Disposed = false; m_StandardCompiler = StandardCompiler; m_ResourceAccessor = ResourceAccessor; m_SettingsManager = SettingsMgr; m_NscCompiler = new NscCompiler(ResourceAccessor, SettingsMgr); }
// // Called during early stage toolset deinitialization. // public virtual void Unload(INWN2PluginHost Host) { ListView Lv; // // Early toolset teardown; deinitialize the script compiler hook so // that we may unload cleanly. // Lv = PluginUI.GetVerifyOutputListView(); if (Lv != null) Lv.ItemActivate -= this.OnVerifyOutputListViewItemActivated; UnhookScriptCompiler(); if (NWN2ToolsetMainForm.VersionControlManager.Preferences != null) { if (NWN2ToolsetMainForm.VersionControlManager.Preferences.ActiveProvider == this) NWN2ToolsetMainForm.VersionControlManager.Preferences.ActiveProvider = m_OriginalVCPlugin; m_OriginalVCPlugin = null; } m_SettingsManager = null; }
// // Standard INWN2Plugin methods. // // // Called during late stage toolset initialization. // public virtual void Load(INWN2PluginHost Host) { ListView Lv; m_SettingsManager = new SettingsManager(); m_SettingsManager.NeedSettingsLoad = true; // // By the time Load is invoked, the compiler is present. Install // the compiler hook now. // m_CompilerField = GetMainFormCompilerField(); m_ResourceAccessor = new ResourceAccessor(this); HookScriptCompiler(); // // Hook the version control system for resource change notification // distribution if preferences were available at this point. // // Otherwise, wait for a change notification to install the hook. // // if (NWN2ToolsetMainForm.VersionControlManager.Preferences != null) { m_OriginalVCPlugin = NWN2ToolsetMainForm.VersionControlManager.Preferences.ActiveProvider; if (m_OriginalVCPlugin == this) m_OriginalVCPlugin = null; NWN2ToolsetMainForm.VersionControlManager.Preferences.ActiveProvider = this; } else { NWN2Toolset.Plugins.NWN2VersionControlManagerPreferences.PreferencesChanged += this.OnVersionControlManagerPrefsChanged; } Lv = PluginUI.GetVerifyOutputListView(); if (Lv != null) Lv.ItemActivate += this.OnVerifyOutputListViewItemActivated; }