Example #1
0
        /// <summary>
        /// Gets the file path of each file currently opened
        /// </summary>
        /// <returns></returns>
        public static List <string> GetOpenedFiles()
        {
            var output = new List <string>();
            int nbFile = (int)WinApi.SendMessage(HandleNpp, NppMsg.NPPM_GETNBOPENFILES, 0, (int)NppMsg.ALL_OPEN_FILES);

            using (WinApi.ClikeStringArray cStrArray = new WinApi.ClikeStringArray(nbFile, WinApi.MaxPath)) {
                if (WinApi.SendMessage(HandleNpp, NppMsg.NPPM_GETOPENFILENAMES, cStrArray.NativePointer, nbFile) != IntPtr.Zero)
                {
                    output.AddRange(cStrArray.ManagedStringsUnicode);
                }
            }
            return(output);
        }
Example #2
0
        /// <summary>
        /// Gets the file path of each file in the session file, return
        /// the files separated by a new line
        /// </summary>
        /// <param name="sessionFilePath"></param>
        /// <returns></returns>
        public static string GetSessionFiles(string sessionFilePath)
        {
            var output = new StringBuilder();
            int nbFile = (int)WinApi.SendMessage(HandleNpp, NppMsg.NPPM_GETNBSESSIONFILES, 0, sessionFilePath);

            if (nbFile > 0)
            {
                using (WinApi.ClikeStringArray cStrArray = new WinApi.ClikeStringArray(nbFile, WinApi.MaxPath)) {
                    if (WinApi.SendMessage(HandleNpp, NppMsg.NPPM_GETSESSIONFILES, cStrArray.NativePointer, sessionFilePath) != IntPtr.Zero)
                    {
                        foreach (string file in cStrArray.ManagedStringsUnicode)
                        {
                            output.AppendLine(file);
                        }
                    }
                }
            }
            return(output.ToString());
        }
Example #3
0
File: Npp.cs Project: jcaillon/3P
 /// <summary>
 /// Gets the file path of each file in the session file, return
 /// the files separated by a new line
 /// </summary>
 /// <param name="sessionFilePath"></param>
 /// <returns></returns>
 public static string GetSessionFiles(string sessionFilePath)
 {
     var output = new StringBuilder();
     int nbFile = (int)WinApi.SendMessage(HandleNpp, NppMsg.NPPM_GETNBSESSIONFILES, 0, sessionFilePath);
     if (nbFile > 0) {
         using (WinApi.ClikeStringArray cStrArray = new WinApi.ClikeStringArray(nbFile, WinApi.MaxPath)) {
             if (WinApi.SendMessage(HandleNpp, NppMsg.NPPM_GETSESSIONFILES, cStrArray.NativePointer, sessionFilePath) != IntPtr.Zero)
                 foreach (string file in cStrArray.ManagedStringsUnicode) output.AppendLine(file);
         }
     }
     return output.ToString();
 }
Example #4
0
File: Npp.cs Project: jcaillon/3P
 /// <summary>
 /// Gets the file path of each file currently opened in the secondary view
 /// </summary>
 /// <returns></returns>
 public static List<string> GetOpenedFilesSecondary()
 {
     var output = new List<string>();
     int nbFile = (int)WinApi.SendMessage(HandleNpp, NppMsg.NPPM_GETNBOPENFILES, 0, (int)NppMsg.SECOND_VIEW);
     using (WinApi.ClikeStringArray cStrArray = new WinApi.ClikeStringArray(nbFile, WinApi.MaxPath)) {
         if (WinApi.SendMessage(HandleNpp, NppMsg.NPPM_GETOPENFILENAMESSECOND, cStrArray.NativePointer, nbFile) != IntPtr.Zero)
             output.AddRange(cStrArray.ManagedStringsUnicode);
     }
     return output;
 }