public uploadMember() { InitializeComponent(); StringBuilder path = new StringBuilder(Win32.MAX_PATH); Win32.SendMessage(PluginBase.nppData._nppHandle, NppMsg.NPPM_GETFULLCURRENTPATH, 0, path); if (!OpenMembers.Contains(path.ToString())) { MessageBox.Show("Unable to save this file to a member. You are only able to save to member which has been opened in this same Notepad++ session."); this._CloseOnShow = true; return; } this._Member = OpenMembers.GetMember(path.ToString()); if (this._Member.GetSystemName() != IBMi.GetConfig("system")) { MessageBox.Show("You can only save this member when you are connected to " + this._Member.GetSystemName() + "."); this._CloseOnShow = true; return; } textBox1.Text = this._Member.GetLibrary(); textBox2.Text = this._Member.GetObject(); textBox3.Text = this._Member.GetMember(); textBox4.Text = this._Member.GetSystemName(); textBox5.Text = Path.GetFileName(this._Member.GetLocalFile()); }
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); }