Esempio n. 1
0
        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());
        }
Esempio n. 2
0
        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);
        }
Esempio n. 3
0
        private void OpenMember(string Lib, string Obj, string Mbr, Boolean Editing)
        {
            Thread gothread = new Thread((ThreadStart) delegate {
                string resultFile = IBMiUtilities.DownloadMember(Lib, Obj, Mbr);
                if (Main.CommandWindow != null)
                {
                    Main.CommandWindow.loadNewOutput();
                }

                if (resultFile != "")
                {
                    NppFunctions.OpenFile(resultFile, !Editing);
                    if (Editing)
                    {
                        OpenMembers.AddMember(IBMi.GetConfig("system"), resultFile, Lib, Obj, Mbr);
                    }
                }
                else
                {
                    MessageBox.Show("Unable to download member " + Lib + "/" + Obj + "." + Mbr + ". Please check it exists and that you have access to the remote system.");
                }
            });

            gothread.Start();
        }
Esempio n. 4
0
        private void button1_Click(object sender, EventArgs e)
        {
            this.isReadonly = checkBox1.Checked;
            textBox1.Text   = textBox1.Text.ToUpper();
            textBox2.Text   = textBox2.Text.ToUpper();
            textBox3.Text   = textBox3.Text.ToUpper();

            if (!IBMiUtilities.IsValidQSYSObjectName(textBox1.Text))
            {
                MessageBox.Show("Library name is not valid.");
                return;
            }
            if (!IBMiUtilities.IsValidQSYSObjectName(textBox2.Text))
            {
                MessageBox.Show("Object name is not valid.");
                return;
            }
            if (!IBMiUtilities.IsValidQSYSObjectName(textBox3.Text))
            {
                MessageBox.Show("Member name is not valid.");
                return;
            }

            string resultFile = IBMiUtilities.DownloadMember(textBox1.Text, textBox2.Text, textBox3.Text);

            if (Main.CommandWindow != null)
            {
                Main.CommandWindow.loadNewOutput();
            }

            if (resultFile != "")
            {
                //Open File
                NppFunctions.OpenFile(resultFile, this.isReadonly);
                OpenMembers.AddMember(textBox4.Text, resultFile, textBox1.Text, textBox2.Text, textBox3.Text, !this.isReadonly);

                this.Close();
            }
            else
            {
                MessageBox.Show("Unable to download member " + textBox1.Text + "/" + textBox2.Text + "." + textBox3.Text + ". Please check it exists and that you have access to the remote system.");
            }
        }