123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101 |
-
- using System;
- using System.Text;
- using NppPluginNET.PluginInfrastructure;
- namespace Kbg.NppPluginNET.PluginInfrastructure
- {
- public interface INotepadPPGateway
- {
- void FileNew();
- string GetCurrentFilePath();
- unsafe string GetFilePath(int bufferId);
- void SetCurrentLanguage(LangType language);
-
-
-
-
- string GetCurrentFileName();
-
-
-
-
- string GetCurrentDirectory();
- }
-
-
-
-
- public class NotepadPPGateway : INotepadPPGateway
- {
- private const int Unused = 0;
- public void FileNew()
- {
- Win32.SendMessage(PluginBase.nppData._nppHandle, (uint) NppMsg.NPPM_MENUCOMMAND, Unused, NppMenuCmd.IDM_FILE_NEW);
- }
-
-
-
-
- public string GetCurrentDirectory()
- {
- StringBuilder path = new StringBuilder(Win32.MAX_PATH);
- Win32.SendMessage(PluginBase.nppData._nppHandle, (uint)NppMsg.NPPM_GETCURRENTDIRECTORY, 0, path);
- return path.ToString();
- }
-
-
-
-
- public string GetCurrentFileName()
- {
- StringBuilder fileName = new StringBuilder(Win32.MAX_PATH);
- Win32.SendMessage(PluginBase.nppData._nppHandle, (uint)NppMsg.NPPM_GETFILENAME, 0, fileName);
- return fileName.ToString();
- }
-
-
-
- public string GetCurrentFilePath()
- {
- var path = new StringBuilder(2000);
- Win32.SendMessage(PluginBase.nppData._nppHandle, (uint) NppMsg.NPPM_GETFULLCURRENTPATH, 0, path);
- return path.ToString();
- }
-
-
-
- public unsafe string GetFilePath(int bufferId)
- {
- var path = new StringBuilder(2000);
- Win32.SendMessage(PluginBase.nppData._nppHandle, (uint) NppMsg.NPPM_GETFULLPATHFROMBUFFERID, bufferId, path);
- return path.ToString();
- }
- public void SetCurrentLanguage(LangType language)
- {
- Win32.SendMessage(PluginBase.nppData._nppHandle, (uint) NppMsg.NPPM_SETCURRENTLANGTYPE, Unused, (int) language);
- }
- }
-
-
-
-
- class NppResource
- {
- private const int Unused = 0;
- public void ClearIndicator()
- {
- Win32.SendMessage(PluginBase.nppData._nppHandle, (uint) Resource.NPPM_INTERNAL_CLEARINDICATOR, Unused, Unused);
- }
- }
- }
|