Example #1
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);
        }
Example #2
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();
            }
        }
Example #3
0
 internal static void ManageCL()
 {
     CLFile.CorrectLines(NppFunctions.GetCurrentFileName(), 80);
     NppFunctions.RefreshWindow(NppFunctions.GetCurrentFileName());
 }
Example #4
0
        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);
            }
        }
Example #5
0
 internal static void ManageCL()
 {
     CLFile.CorrectLines(NppFunctions.GetCurrentFileName(), Convert.ToInt32(IBMi.GetConfig("clrcdlen")));
     NppFunctions.RefreshWindow(NppFunctions.GetCurrentFileName());
 }