簡體   English   中英

如何在我的項目中使用記事本++

[英]how can use notepad++ in my project

我有一些保存在數據庫中的PHP代碼。 我想編寫一個程序,從數據庫讀取php,然后在notepad ++中加載,並在編輯后保存到數據庫。

有可能在我們的php項目中使用notepad ++作為編輯器?

還是可以將notepad ++加載到我們的C#項目中並用作編輯器?

問題:如何將notepad ++作為編輯器加載到(c#或php)項目中?

據我了解,您的問題(可能是錯誤的)1.在程序中,單擊文件時,使用此命令調用notepad ++

<Path to your notepad++> -n<line>  <Path to your source code file>
  1. 通過使用此類FileSystemWatcher檢測更改或文件https://msdn.microsoft.com/zh-cn/library/system.io.filesystemwatcher%28v=vs.110%29.aspx

在C#中,您可以先將PHP代碼保存到C:\\ temp \\(或您指定的位置)中的臨時文件中

然后

System.Diagnostics.Process.Start(@"C:\Program Files\Notepad++\notepad++.exe", @"C:\temp\tmpfile.php");

(我猜在文件路徑名,請適當更改)

然后如VõQuangHòa所說,使用FileSystemWatcher類監視要保存的文件,當文件保存時,程序將讀取該文件並將其保存回數據庫。

FileSystemWatcher fsw = new FileSystemWatcher(@"C:\temp\");
fsw.Filter = "tmpfile.php";
fsw.NotifyFilter = NotifyFilters.LastWrite;
fsw.Changed += new FileSystemEventHandler(fsw_Changed);
fsw.EnableRaisingEvents = true;

並添加功能

private static void fsw_Changed(object sender, FileSystemEventArgs e) 
{
   // Code to save file to DB and delete temp file.
}

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM