// NPP plugin platform for .Net v0.94.00 by Kasper B. Graversen etc. using System; using System.Runtime.InteropServices; using Kbg.NppPluginNET.PluginInfrastructure; namespace Kbg.NppPluginNET { class UnmanagedExports { [DllExport(CallingConvention=CallingConvention.Cdecl)] static bool isUnicode() { return true; } [DllExport(CallingConvention = CallingConvention.Cdecl)] static void setInfo(NppData notepadPlusData) { PluginBase.nppData = notepadPlusData; Main.CommandMenuInit(); } [DllExport(CallingConvention = CallingConvention.Cdecl)] static IntPtr getFuncsArray(ref int nbF) { nbF = PluginBase._funcItems.Items.Count; return PluginBase._funcItems.NativePointer; } [DllExport(CallingConvention = CallingConvention.Cdecl)] static uint messageProc(uint Message, IntPtr wParam, IntPtr lParam) { return 1; } static IntPtr _ptrPluginName = IntPtr.Zero; [DllExport(CallingConvention = CallingConvention.Cdecl)] static IntPtr getName() { if (_ptrPluginName == IntPtr.Zero) _ptrPluginName = Marshal.StringToHGlobalUni(Main.PluginName); return _ptrPluginName; } [DllExport(CallingConvention = CallingConvention.Cdecl)] static void beNotified(IntPtr notifyCode) { ScNotification notification = (ScNotification)Marshal.PtrToStructure(notifyCode, typeof(ScNotification)); if (notification.Header.Code == (uint)NppMsg.NPPN_TBMODIFICATION) { PluginBase._funcItems.RefreshItems(); Main.SetToolBarIcon(); } else if (notification.Header.Code == (uint)NppMsg.NPPN_SHUTDOWN) { Main.PluginCleanUp(); Marshal.FreeHGlobal(_ptrPluginName); } else { Main.OnNotification(notification); } } } }