コード例 #1
0
ファイル: cmdBindings.cs プロジェクト: ymurata1967/IBMiCmd
        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);
        }
コード例 #2
0
        public void LoadList(ListViewItem[] List)
        {
            this.Invoke(new MethodInvoker(delegate()
            {
                bool Show = (List != null);

                if (Show)
                {
                    Show = List.Length != 0;
                }

                if (Show)
                {
                    listView1.Items.Clear();
                    listView1.Items.AddRange(List);
                }

                Point newLoc = NppFunctions.GetCaretPos();
                if (Show && this.Opacity == 0)
                {
                    this.Location = newLoc;
                }

                if (Show)
                {
                    NppFunctions.CancelNPPAutoC();
                }

                this.Opacity = (Show ? 100 : 0);
            }));
        }
コード例 #3
0
        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();
        }
コード例 #4
0
        internal static void DisplayEdit()
        {
            DialogResult buttonPress = (IBMi.GetConfig("dspfNotice") == "yes" ? DialogResult.Yes : DialogResult.No);

            if (buttonPress == DialogResult.No)
            {
                buttonPress = MessageBox.Show("Do you understand that you use the Display File Editor at your own risk? Currently, the Display File Editor is not ready for production use and therefore holds no responsibility of changes made to source when saving.", "Notice!", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);
                if (buttonPress == DialogResult.Yes)
                {
                    IBMi.SetConfig("dspfNotice", "yes");
                }
            }

            if (buttonPress == DialogResult.Yes)
            {
                dspfEdit Editor = new dspfEdit();
                string   path   = NppFunctions.GetCurrentFileName();
                if (path.Trim() != "")
                {
                    DisplayParse parser = new LanguageTools.DisplayParse();
                    parser.ParseFile(path);
                    Editor = new dspfEdit(parser.GetRecordFormats(), path);
                    NppFunctions.RefreshWindow(path);
                }

                Editor.ShowDialog();
            }
        }
コード例 #5
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();
        }
コード例 #6
0
ファイル: errorListing.cs プロジェクト: ymurata1967/IBMiCmd
        private void onSelectError(string File, int Line, int Col)
        {
            string[] OpenFiles = NppFunctions.GetOpenFiles();
            string[] files     = new string[2];

            //Compare by file name and extension first
            files[0] = Path.GetFileName(File);
            foreach (string OpenFile in OpenFiles)
            {
                files[1] = Path.GetFileName(OpenFile);

                IBMi.AddOutput(files[0] + " == " + files[1]);
                if (files[0] == files[1])
                {
                    NppFunctions.SwitchToFile(OpenFile, Line, Col);
                    return;
                }
            }

            //Compare just by file name afterwards
            files[0] = Path.GetFileNameWithoutExtension(File);
            foreach (string OpenFile in OpenFiles)
            {
                files[1] = Path.GetFileNameWithoutExtension(OpenFile);

                IBMi.AddOutput(files[0] + " == " + files[1]);
                if (files[0] == files[1])
                {
                    NppFunctions.SwitchToFile(OpenFile, Line, Col);
                    return;
                }
            }

            //Compare just by file name & try MEMBER name
            files[0] = GetQSYSMemberName(File);
            foreach (string OpenFile in OpenFiles)
            {
                files[1] = Path.GetFileNameWithoutExtension(OpenFile);

                IBMi.AddOutput(files[0] + " == " + files[1]);
                if (files[0] == files[1])
                {
                    NppFunctions.SwitchToFile(OpenFile, Line, Col);
                    return;
                }
            }

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

            MessageBox.Show("Unable to open error. Please open the source manually first and then try again.", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information);
        }
コード例 #7
0
ファイル: cmdBindings.cs プロジェクト: ymurata1967/IBMiCmd
        public void runCommands(string[] commands, string[] errDsp)
        {
            IBMi.RunCommands(commands);
            if (Main.CommandWindow != null)
            {
                Main.CommandWindow.loadNewOutput();
            }

            if (errDsp != null)
            {
                toolStripStatusLabel1.Text = "Fetching errors... ";
                NppFunctions.DisplayErrors(errDsp[0], errDsp[1]);
            }

            toolStripStatusLabel1.Text = "Finished at " + DateTime.Now.ToString("h:mm:ss tt");
        }
コード例 #8
0
        private void rpgForm_Load(object sender, EventArgs e)
        {
            string freeOut = "", fixedLine = "";

            fixedLine = NppFunctions.GetLine(NppFunctions.GetLineNumber());

            freeOut = RPGFree.getFree(fixedLine);
            if (freeOut != "")
            {
                textBox1.Text = fixedLine;
                textBox2.Text = freeOut;
            }
            else
            {
                this.Close();
                MessageBox.Show("Unable to convert line.");
            }
        }
コード例 #9
0
ファイル: selectMember.cs プロジェクト: ymurata1967/IBMiCmd
        private void loadErrorsToolStripMenuItem_Click(object sender, EventArgs e)
        {
            //Show errors
            if (listView1.SelectedItems.Count == 1)
            {
                ListViewItem selection = listView1.SelectedItems[0];
                string       tag       = (string)selection.Tag;
                if (tag != "")
                {
                    string[] path = tag.Split('|');

                    Thread gothread = new Thread((ThreadStart) delegate {
                        NppFunctions.DisplayErrors(path[0], selection.Text);
                    });
                    gothread.Start();
                }
            }
        }
コード例 #10
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.");
            }
        }
コード例 #11
0
 internal static void ManageCL()
 {
     CLFile.CorrectLines(NppFunctions.GetCurrentFileName(), 80);
     NppFunctions.RefreshWindow(NppFunctions.GetCurrentFileName());
 }
コード例 #12
0
 private void button1_Click(object sender, EventArgs e)
 {
     NppFunctions.SetLine(textBox2.Text);
     this.Close();
 }
コード例 #13
0
ファイル: rpgFileConvert.cs プロジェクト: ymurata1967/IBMiCmd
        private void rpgFileConvert_Load(object sender, EventArgs e)
        {
            this._curFile = NppFunctions.GetCurrentFileName();
            this.Text     = "RPG Conversion - " + this._curFile;
            if (File.Exists(this._curFile))
            {
                string[] lines = File.ReadAllLines(this._curFile);
                //string[] newLines = new string[lines.Length];

                Boolean isPI = false, isPR = false, isDS = false;
                string  curLine = "", curLineStart = "", extraLine = "";
                for (int i = 0; i < lines.Length; i++)
                {
                    curLine = RPGFree.getFree(lines[i]);

                    if (curLine.Contains(" "))
                    {
                        curLineStart = curLine.TrimStart().Split(' ')[0].ToUpper().Trim();
                    }
                    else
                    {
                        curLineStart = "*linestart";
                    }

                    if (curLineStart != "DCL-PARM" && curLineStart != "DCL-SUBF" && curLine != "*NAMEREM")
                    {
                        if (isPR)
                        {
                            extraLine = "".PadLeft(7) + "End-Pr;";
                            isPR      = false;
                        }
                        else if (isPI)
                        {
                            extraLine = "".PadLeft(7) + "End-Pi;";
                            isPI      = false;
                        }
                        else if (isDS)
                        {
                            extraLine = "".PadLeft(7) + "End-Ds;";
                            isDS      = false;
                        }
                        else
                        {
                            extraLine = "";
                        }

                        if (extraLine != "")
                        {
                            AppendNewText(richTextBox2, extraLine, Color.Green);
                            AppendNewText(richTextBox2, "", Color.Black);
                        }
                    }

                    if (curLine == "*BLANK" || curLine == "*NAMEREM")
                    {
                        AppendNewText(richTextBox1, lines[i].TrimEnd(), Color.Red);
                    }
                    else if (curLine != "")
                    {
                        #region adding end-** blocks

                        switch (curLineStart)
                        {
                        case "DCL-PR":
                            isPR = true;
                            break;

                        case "DCL-PI":
                            isPI = true;
                            break;

                        case "DCL-DS":
                            isDS = true;
                            break;
                        }

                        #endregion

                        AppendNewText(richTextBox2, curLine, Color.Green);
                        AppendNewText(richTextBox1, lines[i].TrimEnd(), Color.Red);
                    }
                    else
                    {
                        AppendNewText(richTextBox2, lines[i].TrimEnd(), Color.Black);
                        AppendNewText(richTextBox1, lines[i].TrimEnd(), Color.Black);
                    }
                }
            }
            else
            {
                this.Close();
                MessageBox.Show("To convert a large section of source the file must be stored locally. Save the file first and then try again.", "Information about file conversion", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
コード例 #14
0
ファイル: rpgFileConvert.cs プロジェクト: ymurata1967/IBMiCmd
 private void acceptToolStripMenuItem_Click(object sender, EventArgs e)
 {
     File.WriteAllLines(this._curFile, richTextBox2.Lines);
     NppFunctions.RefreshWindow(this._curFile);
     this.Close();
 }
コード例 #15
0
ファイル: Main.cs プロジェクト: ymurata1967/IBMiCmd
 internal static void ManageCL()
 {
     CLFile.CorrectLines(NppFunctions.GetCurrentFileName(), Convert.ToInt32(IBMi.GetConfig("clrcdlen")));
     NppFunctions.RefreshWindow(NppFunctions.GetCurrentFileName());
 }
コード例 #16
0
ファイル: Main.cs プロジェクト: ymurata1967/IBMiCmd
 internal static void OpenLogFile()
 {
     NppFunctions.OpenFile(IBMiUtilities.GetLogPath(), true);
 }