private static string replaceVars(string cmd) { OpenMember currentMember = null; string path = Path.GetFileName(NppFunctions.GetCurrentFileName()); string[] name; if (path.Contains(".")) { name = path.Split('.'); } else { name = new string[2]; name[0] = path; name[1] = ""; } cmd = cmd.Replace("%file%", name[0]); cmd = cmd.Replace("%ext%", name[1]); cmd = cmd.Replace("%host%", IBMi.GetConfig("system")); cmd = cmd.Replace("%user%", IBMi.GetConfig("user")); cmd = cmd.Replace("%curlib%", IBMi.GetConfig("curlib")); if (OpenMembers.Contains(path)) { currentMember = OpenMembers.GetMember(path); cmd = cmd.Replace("%openlib%", currentMember.GetLibrary()); cmd = cmd.Replace("%openspf%", currentMember.GetObject()); cmd = cmd.Replace("%openmbr%", currentMember.GetMember()); } return(cmd); }
internal static void OpenInclude() { Thread gothread = new Thread((ThreadStart) delegate { string LineNum = NppFunctions.GetLine(NppFunctions.GetLineNumber()); OpenMember Member = Include.HandleInclude(LineNum); if (Member != null) { string FileLoc = ""; FileLoc = IBMiUtilities.DownloadMember(Member.GetLibrary(), Member.GetObject(), Member.GetMember()); if (FileLoc != "") { NppFunctions.OpenFile(FileLoc, true); } else { MessageBox.Show("Unable to download member " + Member.GetLibrary() + "/" + Member.GetObject() + "." + Member.GetMember() + ". Please check it exists and that you have access to the remote system."); } } else { MessageBox.Show("Unable to parse out member."); } }); gothread.Start(); }