Пример #1
0
        public static void ScanFile()
        {
            string currentFile = NppFunctions.GetCurrentFileName().ToUpper();

            if (currentFile.Contains("RPG"))
            {
                FileItems = RPGParser.ScanFile(currentFile).ToArray();
            }
            else
            {
                FileItems = null;
            }

            if (Main.CommandWindow != null)
            {
                Main.CommandWindow.loadNewOutput();
            }
        }
Пример #2
0
        public static ListViewItem[] ParseLine()
        {
            List <ListViewItem> Keysout = new List <ListViewItem>();;
            string currentFile          = NppFunctions.GetCurrentFileName().ToUpper();
            string currentPiece         = NppFunctions.GetLine(NppFunctions.GetLineNumber()).Trim();
            int    currentLine          = NppFunctions.GetLineNumber();
            string DataStructureName    = "";
            int    number;

            string[] pieces;

            pieces = currentPiece.Split(new char[] { ' ', ':', '(', ')', '.', '=' });
            if (pieces.Length == 0)
            {
                return(null);
            }

            currentPiece = pieces[pieces.Length - 1];
            currentPiece = currentPiece.ToUpper();

            if (currentFile.Contains("RPG"))
            {
                if (currentPiece.EndsWith(";"))
                {
                    return(null);
                }
                else if (currentPiece.Length >= 2)
                {
                    Keysout.AddRange(Array.FindAll(Values["RPG"], c => c.Text.StartsWith(currentPiece)));

                    if (FileItems != null)
                    {
                        Keysout.AddRange(Array.FindAll(FileItems, c => c.Text.ToUpper().StartsWith(currentPiece)));
                    }
                }
                else if (pieces.Length >= 2)
                {
                    if (FileItems != null)
                    {
                        if (pieces.Length >= 3)
                        {
                            if (int.TryParse(pieces[pieces.Length - 3], out number))
                            {
                                DataStructureName = pieces[pieces.Length - 4];
                            }
                            else
                            {
                                DataStructureName = pieces[pieces.Length - 2];
                            }
                        }
                        else
                        {
                            DataStructureName = pieces[pieces.Length - 2];
                        }

                        DataStructureName = DataStructureName.ToUpper();
                        if (DataStructureName != "")
                        {
                            Keysout.AddRange(Array.FindAll(FileItems, c => c.Tag.ToString() == DataStructureName));
                        }
                    }
                }
            }
            else if (currentFile.Contains("CL"))
            {
                if (currentPiece.Length >= 4)
                {
                    if (pieces.Length == 1)
                    {
                        Keysout.AddRange(Array.FindAll(Values["CL"], c => c.Text.StartsWith(currentPiece)));
                    }
                }
            }

            if (Keysout.Count >= 1)
            {
                Main.IntelliSenseWindow.SetKey(currentPiece);
            }

            if (Keysout == null)
            {
                return(null);
            }
            else
            {
                return(Keysout.ToArray());
            }
        }