Skip to content
This repository was archived by the owner on Jan 13, 2024. It is now read-only.

Commit d839950

Browse files
committed
added NotepadPPGateway methods
1 parent 26e48df commit d839950

File tree

2 files changed

+29
-0
lines changed

2 files changed

+29
-0
lines changed

Visual Studio Project Template C#/PluginInfrastructure/IScintillaGateway.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ namespace Kbg.NppPluginNET
77
public interface INotepadPPGateway
88
{
99
void FileNew();
10+
11+
string GetCurrentFilePath();
12+
unsafe string GetFilePath(int bufferId);
13+
void SetCurrentLanguage(LangType language);
1014
}
1115

1216
/// <summary>

Visual Studio Project Template C#/PluginInfrastructure/ScintillaGateway.cs

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,31 @@ public void FileNew()
1313
{
1414
Win32.SendMessage(PluginBase.nppData._nppHandle, NppMsg.NPPM_MENUCOMMAND, Unused, NppMenuCmd.IDM_FILE_NEW);
1515
}
16+
17+
/// <summary>
18+
/// Gets the path of the current document.
19+
/// </summary>
20+
public string GetCurrentFilePath()
21+
{
22+
var path = new StringBuilder(2000);
23+
Win32.SendMessage(PluginBase.nppData._nppHandle, NppMsg.NPPM_GETFULLCURRENTPATH, 0, path);
24+
return path.ToString();
25+
}
26+
27+
/// <summary>
28+
/// Gets the path of the current document.
29+
/// </summary>
30+
public unsafe string GetFilePath(int bufferId)
31+
{
32+
var path = new StringBuilder(2000);
33+
Win32.SendMessage(PluginBase.nppData._nppHandle, NppMsg.NPPM_GETFULLPATHFROMBUFFERID, bufferId, path);
34+
return path.ToString();
35+
}
36+
37+
public void SetCurrentLanguage(LangType language)
38+
{
39+
Win32.SendMessage(PluginBase.nppData._nppHandle, NppMsg.NPPM_SETCURRENTLANGTYPE, Unused, (int) language);
40+
}
1641
}
1742

1843
/// <summary>

0 commit comments

Comments
 (0)