1- // NPP plugin platform for .Net v0.93.96 by Kasper B. Graversen etc.
1+ // NPP plugin platform for .Net v0.94.00 by Kasper B. Graversen etc.
22using System ;
33using System . Text ;
44using NppPluginNET . PluginInfrastructure ;
@@ -12,7 +12,9 @@ public interface INotepadPPGateway
1212 string GetCurrentFilePath ( ) ;
1313 unsafe string GetFilePath ( int bufferId ) ;
1414 void SetCurrentLanguage ( LangType language ) ;
15- }
15+ string GetCurrentFileName ( ) ;
16+ string GetCurrentDirectory ( ) ;
17+ }
1618
1719 /// <summary>
1820 /// This class holds helpers for sending messages defined in the Msgs_h.cs file. It is at the moment
@@ -51,7 +53,29 @@ public void SetCurrentLanguage(LangType language)
5153 {
5254 Win32 . SendMessage ( PluginBase . nppData . _nppHandle , ( uint ) NppMsg . NPPM_SETCURRENTLANGTYPE , Unused , ( int ) language ) ;
5355 }
54- }
56+
57+ /// <summary>
58+ /// Returns the response from NPPM_GETCURRENTDIRECTORY
59+ /// </summary>
60+ /// <returns></returns>
61+ public string GetCurrentDirectory ( )
62+ {
63+ var path = new StringBuilder ( Win32 . MAX_PATH ) ;
64+ Win32 . SendMessage ( PluginBase . nppData . _nppHandle , ( uint ) NppMsg . NPPM_GETCURRENTDIRECTORY , 0 , path ) ;
65+ return path . ToString ( ) ;
66+ }
67+
68+ /// <summary>
69+ /// Returns the response from NPPM_GETFILENAME
70+ /// </summary>
71+ /// <returns></returns>
72+ public string GetCurrentFileName ( )
73+ {
74+ var fileName = new StringBuilder ( Win32 . MAX_PATH ) ;
75+ Win32 . SendMessage ( PluginBase . nppData . _nppHandle , ( uint ) NppMsg . NPPM_GETFILENAME , 0 , fileName ) ;
76+ return fileName . ToString ( ) ;
77+ }
78+ }
5579
5680 /// <summary>
5781 /// This class holds helpers for sending messages defined in the Resource_h.cs file. It is at the moment
0 commit comments