コード例 #1
0
        public static void Parse(string code, string fileName, CodeParts parts, bool add = true)
        {
            foreach (Match match in Regex.Matches(code, "\\/\\*\\*([^*]*(?:\\*(?!\\/)[^*]*)*)\\*\\/"))
            {
                string val = Convert.ToString(match.Groups[1].Value); //Group 0 which contains only the internal text without the start and the end.

                if (!val.Contains("<summary>") || !val.Contains("</summary>"))
                {
                    continue;
                }

                try
                {
                    var pwn = new PawnDocParser(val);
                    if (add)
                    {
                        parts.PawnDocs.Add(pwn);
                    }
                    else
                    {
                        parts.PawnDocs.RemoveAll(x => x.Summary == pwn.Summary);
                    }
                }
                catch (ParserException ex)
                {
                    throw (new ParserException(ex.Message, ""));
                }
            }
        }
コード例 #2
0
ファイル: IfDefines.cs プロジェクト: 2002a1116/ExtremeStudio
        public static void Parse(string code, string filePath, string prjPath, ref CodeParts parts, bool add = true)
        {
            foreach (Match match in Regex.Matches(code, "\\#if[ \\t]+(!)?defined[ \\t]+(.+)([\\s\\S]*?)\\#endif",
                                                  RegexOptions.Multiline))
            {
                bool   isNt      = (match.Groups[1].Value != "");
                string condition = "";
                string mainCode  = "";
                string elseClode = " ";

                //Start filling the vars.
                condition = Convert.ToString(match.Groups[2].Value.Trim());

                if (match.Groups[3].Value.Contains("#else"))
                {
                    string[] s = Convert.ToString(match.Groups[3].Value).Split(new [] { "#else" }, StringSplitOptions.None);
                    mainCode  = s[0].Trim();
                    elseClode = s[1].Trim();
                }
                else
                {
                    mainCode = Convert.ToString(match.Groups[3].Value.Trim());
                }

                //The result of the parse will be saved here for deletion.
                Parser result = null;

                //Now check which part needs to be parsed by seeing isNt and the else.
                if (isNt == false)
                {
                    //Here the thing should BE defined
                    if (IsDefined(parts, condition) == false)
                    {
                        //Parse the main.
                        result = new Parser(parts, mainCode, filePath, prjPath, false, true);
                    }
                    else
                    {
                        //Parse the else.
                        result = new Parser(parts, elseClode, filePath, prjPath, false, true);
                    }
                }
                else
                {
                    //It should NOT be defined.
                    if (IsDefined(parts, condition) == true)
                    {
                        //Parse the main.
                        result = new Parser(parts, mainCode, filePath, prjPath, false, true);
                    }
                    else
                    {
                        //Parse the else.
                        result = new Parser(parts, elseClode, filePath, prjPath, false, true);
                    }
                }
            }
        }
コード例 #3
0
        public static void Parse(string code, string fileName, CodeParts parts, bool add = true)
        {
            foreach (Match match in Regex.Matches(code, "(?:\\s?stock\\s+static|\\s?static\\s+stock|\\s?new\\s+stock|\\s?new|\\s?static|\\s?stock)\\s*([\\s\\S]*?);", RegexOptions.Multiline))
            {
                string varName = Convert.ToString(match.Groups[1].Value);

                //Remove all whitespace.
                varName = varName.Replace(" ", "");
                varName = varName.Replace(Convert.ToString("\t"), "");

                //Now if there is multiple variables in one.. Split it.
                string[] allVars;

                if (varName.Contains(","))
                {
                    allVars = varName.Split(",".ToCharArray());
                }
                else
                {
                    allVars = new[] { varName };
                }

                //Loop through all.
                foreach (string strtmp in allVars)
                {
                    string str = strtmp;
                    //Get tag and remove.
                    string tag = "";
                    if (str.Contains(":"))
                    {
                        tag = str.Substring(0, str.IndexOf(":") + 1);
                        str = str.Remove(0, str.IndexOf(":") + 1);
                    }

                    //Get and Remove all arrays.
                    List <string> arrays = (from Match mtch in Regex.Matches(str, "(?<=\\[)(?>[^\\[\\]]+|\\[(?<DEPTH>)|\\](?<-DEPTH>))*(?(DEPTH)(?!))(?=\\])") select mtch.Value).ToList();
                    str = Convert.ToString(Regex.Replace(str, "\\[(?<=\\[)(?>[^\\[\\]]+|\\[(?<DEPTH>)|\\](?<-DEPTH>))*(?(DEPTH)(?!))(?=\\])\\]", ""));

                    //Get then Remove default
                    string def = "";
                    if (str.Contains("="))
                    {
                        def = str.Substring(str.IndexOf("="), str.Length - str.IndexOf("="));
                        str = str.Remove(str.IndexOf("="), str.Length - str.IndexOf("="));
                    }

                    //Add
                    if (add)
                    {
                        parts.PublicVariables.Add(new VarStruct(str, tag, def, arrays));
                    }
                    else
                    {
                        parts.PublicVariables.RemoveAll(x => x.VarName == str);
                    }
                }
            }
        }
コード例 #4
0
ファイル: Enums.cs プロジェクト: 2002a1116/ExtremeStudio
        public static void Parse(string code, string fileName, CodeParts parts, bool add = true)
        {
            foreach (Match match in Regex.Matches(code, "enum\\s+([^\\n;\\(\\)\\{\\}\\s]*)\\s+(?:(?:[{])([^}]+)(?:[}]))"))
            {
                string[] enumds = match.Groups[2].Value.Split(',');

                //Variable to store the enums contents.
                List <EnumsContentsClass> enumStuff = new List <EnumsContentsClass>();

                foreach (string enumatmp in enumds)
                {
                    string enuma = enumatmp;
                    //Check if empty
                    if (ReferenceEquals(enuma, null) || enuma.Trim() == "")
                    {
                        continue;
                    }

                    int length = enuma.Length + 1;
                    enuma = enuma.Trim();
                    var type = FunctionParameters.GetVarType(enuma);

                    //Do what needs to be changed
                    if (type == FunctionParameters.VarTypes.TypeFloat)
                    {
                        enuma = enuma.Remove(0, 6);
                    }
                    else if (type == FunctionParameters.VarTypes.TypeArray)
                    {
                        enuma = enuma.Remove(enuma.IndexOf("["), (enuma.IndexOf("]") - enuma.IndexOf("[")) + 1);
                    }
                    else if (type == FunctionParameters.VarTypes.TypeTagged)
                    {
                        enuma = enuma.Remove(0, enuma.IndexOf(":") + 1);
                    }

                    try
                    {
                        enumStuff.Add(new EnumsContentsClass(enuma, type));
                    }
                    catch (Exception)
                    {
                    }
                }

                //Now add it to the actual list.
                if (add)
                {
                    parts.Enums.Add(new EnumsStruct(match.Groups[1].Value.Trim(), enumStuff));
                }
                else
                {
                    parts.Enums.RemoveAll(x => x.EnumName == match.Groups[1].Value.Trim());
                }
            }
        }
コード例 #5
0
        private static bool IsCode(string line)
        {
            var checkedLine = line.Replace(" ", "").Replace("\t", "");

            return
                ((CodeEndings.Any(ending => checkedLine.EndsWith(ending, StringComparison.Ordinal)) ||
                  CodeParts.Any(part => checkedLine.Contains(part)) ||
                  (checkedLine.Length - checkedLine.Replace("&&", "").Replace("||", "").Length) / 2 >= 3) &&
                 !checkedLine.Contains("License"));
        }
コード例 #6
0
 public static void Parse(string code, string fileName, CodeParts parts, bool add = true)
 {
     foreach (var part in parts.FlattenIncludes())
     {
         for (int i = 0; i <= part.Defines.Count - 1; i++)
         {
             DefineReplacer.Replace(ref code, part.Defines[i].DefineName, part.Defines[i].DefineValue, false);
         }
         for (int i = 0; i <= part.Macros.Count - 1; i++)
         {
             DefineReplacer.Replace(ref code, part.Macros[i].DefineName, part.Macros[i].DefineValue, true);
         }
     }
 }
コード例 #7
0
        public void RefreshTreeView(CodeParts parts)
        {
            if (parts == null)
            {
                return;
            }

            //Save.
            _nodeState.SaveTreeState(treeView.Nodes);

            //Clear All.
            treeView.Nodes.Clear();

            //Start by adding the current file.
            TreeNode node = GetTreeViewPart(parts, Convert.ToString(SearchTextBox.Text), "current");

            node.Text = "Current File";
            if (node.Nodes.Count > 0)
            {
                treeView.Nodes.Add(node);
            }

            //Loop through all includes and put them.
            TreeNode parentNode = new TreeNode
            {
                Text = "Includes"
            };
            var allIncs     = parts.FlattenIncludes();
            var codePartses = allIncs as CodeParts[] ?? allIncs.ToArray();

            for (int i = 1; i <= codePartses.Count() - 1; i++) //Loop through all skipping ID 0.
            {
                var nds = GetTreeViewPart(codePartses[i], Convert.ToString(SearchTextBox.Text),
                                          Convert.ToString(codePartses[i].FilePath));
                if (nds.Nodes.Count > 0)
                {
                    parentNode.Nodes.Add(nds);
                }
            }

            //Add to list.
            if (parentNode.Nodes.Count > 0)
            {
                treeView.Nodes.Add(parentNode);
            }

            _nodeState.RestoreTreeState(treeView); //Restore
        }
コード例 #8
0
ファイル: IfDefines.cs プロジェクト: 2002a1116/ExtremeStudio
        private static dynamic IsDefined(CodeParts parts, string str)
        {
            if (parts.Defines.FindIndex(x => x.DefineName == str) != -1)
            {
                return(true);
            }

            if (parts.Macros.FindIndex(x => x.DefineName == str) != -1)
            {
                return(true);
            }

            if (parts.Enums.FindIndex(x => x.EnumName == str) != -1)
            {
                return(true);
            }

            if (parts.Publics.FindIndex(x => x.FuncName == str) != -1)
            {
                return(true);
            }

            if (parts.Stocks.FindIndex(x => x.FuncName == str) != -1)
            {
                return(true);
            }

            if (parts.Functions.FindIndex(x => x.FuncName == str) != -1)
            {
                return(true);
            }

            if (parts.Natives.FindIndex(x => x.FuncName == str) != -1)
            {
                return(true);
            }

            if (parts.PublicVariables.FindIndex(x => x.VarName == str) != -1)
            {
                return(true);
            }

            return(false);
        }
コード例 #9
0
ファイル: Defines.cs プロジェクト: 2002a1116/ExtremeStudio
        public static void Parse(string code, string fileName, CodeParts parts, bool add = true)
        {
            foreach (Match match in Regex.Matches(code, "^[ \\t]*[#]define[ \\t]+(?<name>[^\\s\\\\;]+)[ \\t]*(?:\\\\\\s+)?(?>(?<value>[^\\\\\\n\\r]+)[ \\t]*(?:\\\\\\s+)?)*", RegexOptions.Multiline))
            {
                string defineName  = Convert.ToString(match.Groups[1].Value);
                string defineValue = match.Groups[2].Captures.Cast <Capture>().Aggregate("", (current, capt) => current + (capt.Value.Trim() + "\r\n"));

                try
                {
                    if (defineName.Contains("%"))
                    {
                        if (add)
                        {
                            parts.Macros.Insert(0, new DefinesStruct(defineName.Trim(), defineValue.Trim()));
                        }
                        else
                        {
                            parts.Macros.RemoveAll(x => x.DefineName == defineName);
                        }
                    }
                    else
                    {
                        if (add)
                        {
                            parts.Defines.Insert(0, new DefinesStruct(defineName.Trim(), defineValue.Trim()));
                        }
                        else
                        {
                            parts.Defines.RemoveAll(x => x.DefineName == defineName);
                        }
                    }
                }
                catch (Exception)
                {
                }
            }
        }
コード例 #10
0
 private static bool ContainsCodeParts(string checkedLine)
 {
     return(CodeParts.Any(checkedLine.Contains));
 }
コード例 #11
0
        private dynamic GetTreeViewPart(CodeParts parser, string searchTerm, string tag)
        {
            if (ReferenceEquals(parser, null))
            {
                return(null);
            }

            TreeNode mainNode = new TreeNode
            {
                Text = Path.GetFileNameWithoutExtension(Convert.ToString(parser.FilePath))
            };

            TreeNode defines   = null;
            TreeNode macros    = null;
            TreeNode functions = null;
            TreeNode publics   = null;
            TreeNode stocks    = null;
            TreeNode natives   = null;

            if (parser.Defines.FindAll(x => x.DefineName.Contains(searchTerm)).Any())
            {
                defines = mainNode.Nodes.Add("Defines");
            }

            if (parser.Macros.FindAll(x => x.DefineName.Contains(searchTerm)).Any())
            {
                macros = mainNode.Nodes.Add("Macros");
            }

            if (parser.Functions.FindAll(x => x.FuncName.Contains(searchTerm)).Any())
            {
                functions = mainNode.Nodes.Add("Functions");
            }

            if (parser.Publics.FindAll(x => x.FuncName.Contains(searchTerm)).Any())
            {
                publics = mainNode.Nodes.Add("Publics");
            }

            if (parser.Stocks.FindAll(x => x.FuncName.Contains(searchTerm)).Any())
            {
                stocks = mainNode.Nodes.Add("Stocks");
            }

            if (parser.Natives.FindAll(x => x.FuncName.Contains(searchTerm)).Any())
            {
                natives = mainNode.Nodes.Add("Natives");
            }

            //Create the custom Roots.
            List <TreeNode> listCustom = new List <TreeNode>();

            foreach (var itm in Program.MainForm.CurrentProject.ObjectExplorerItems)
            {
                var bla = mainNode.Nodes.Add(itm.Name);
                bla.Tag = itm
                          .Identifier; //Here I set its tag to the identifer temporarly, It will be changed to `Root` again in Functions loop.
                listCustom.Add(bla);
            }

            //Start
            foreach (var key in parser.Defines.FindAll(x => x.DefineName.Contains(searchTerm)))
            {
                var nde = defines.Nodes.Add(key.DefineName);
                nde.ToolTipText = "Define Value: " + "\r\n" + key.DefineValue;
                nde.Tag         = "define|" + tag;
            }

            foreach (var key in parser.Macros.FindAll(x => x.DefineName.Contains(searchTerm)))
            {
                var nde = macros.Nodes.Add(key.DefineName);
                nde.ToolTipText = "Define Value: " + "\r\n" + key.DefineValue;
                nde.Tag         = "define|" + tag;
            }

            foreach (var funcs in parser.Functions.FindAll(x => x.FuncName.Contains(searchTerm)))
            {
                bool done = false;

                //Check if it crosponds to a custom one first.
                foreach (var itm in listCustom)
                {
                    if (funcs.FuncName.StartsWith((string)itm.Tag))
                    {
                        var node = itm.Nodes.Add(funcs.FuncName);
                        node.ToolTipText =
                            new AutoCompleteItemEx(AutoCompleteItemEx.AutoCompeleteTypes.TypeFunction, funcs)
                            .ToolTipText;
                        done     = true; //To skip the `Else if it wasn't used.`
                        node.Tag = "function|" + tag;
                        break;
                    }
                }

                if (done)
                {
                    continue;
                }

                //Else if it wasn't used.
                var nde = functions.Nodes.Add(funcs.FuncName);
                nde.ToolTipText = new AutoCompleteItemEx(AutoCompleteItemEx.AutoCompeleteTypes.TypeFunction, funcs)
                                  .ToolTipText;
                nde.Tag = "function|" + tag;
            }

            foreach (var publicFunc in parser.Publics.FindAll(x => x.FuncName.Contains(searchTerm)))
            {
                bool done = false;

                //Check if it crosponds to a custom one first.
                foreach (var itm in listCustom)
                {
                    if (publicFunc.FuncName.StartsWith((string)itm.Tag))
                    {
                        var node = itm.Nodes.Add(publicFunc.FuncName);
                        node.ToolTipText =
                            new AutoCompleteItemEx(AutoCompleteItemEx.AutoCompeleteTypes.TypeFunction, publicFunc)
                            .ToolTipText;
                        done     = true; //To skip the `Else if it wasn't used.`
                        node.Tag = "public|" + tag;
                        break;
                    }
                }

                if (done)
                {
                    continue;
                }

                //Else if it wasn't used.
                var nde = publics.Nodes.Add(publicFunc.FuncName);
                nde.ToolTipText = new AutoCompleteItemEx(AutoCompleteItemEx.AutoCompeleteTypes.TypeFunction, publicFunc)
                                  .ToolTipText;
                nde.Tag = "public|" + tag;
            }

            foreach (var stock in parser.Stocks.FindAll(x => x.FuncName.Contains(searchTerm)))
            {
                bool done = false;

                //Check if it crosponds to a custom one first.
                foreach (var itm in listCustom)
                {
                    if (stock.FuncName.StartsWith((string)itm.Tag))
                    {
                        var node = itm.Nodes.Add(stock.FuncName);
                        node.ToolTipText =
                            new AutoCompleteItemEx(AutoCompleteItemEx.AutoCompeleteTypes.TypeFunction, stock)
                            .ToolTipText;
                        done     = true; //To skip the `Else if it wasn't used.`
                        node.Tag = "stock|" + tag;
                        break;
                    }
                }

                if (done)
                {
                    continue;
                }

                //Else if it wasn't used.
                var nde = stocks.Nodes.Add(stock.FuncName);
                nde.ToolTipText = new AutoCompleteItemEx(AutoCompleteItemEx.AutoCompeleteTypes.TypeFunction, stock)
                                  .ToolTipText;
                nde.Tag = "stock|" + tag;
            }

            foreach (var native in parser.Natives.FindAll(x => x.FuncName.Contains(searchTerm)))
            {
                bool done = false;

                //Check if it crosponds to a custom one first.
                foreach (var itm in listCustom)
                {
                    if (native.FuncName.StartsWith((string)itm.Tag))
                    {
                        var node = itm.Nodes.Add(native.FuncName);
                        node.ToolTipText =
                            new AutoCompleteItemEx(AutoCompleteItemEx.AutoCompeleteTypes.TypeFunction, native)
                            .ToolTipText;
                        done     = true; //To skip the `Else if it wasn't used.`
                        node.Tag = "native|" + tag;
                        break;
                    }
                }

                if (done)
                {
                    continue;
                }

                //Else if it wasn't used.
                var nde = natives.Nodes.Add(native.FuncName);
                nde.ToolTipText = new AutoCompleteItemEx(AutoCompleteItemEx.AutoCompeleteTypes.TypeFunction, native)
                                  .ToolTipText;
                nde.Tag = "native|" + tag;
            }

            return(mainNode);
        }
コード例 #12
0
ファイル: Functions.cs プロジェクト: 2002a1116/ExtremeStudio
        public static void Parse(string code, string fileName, CodeParts parts, bool add = true)
        {
            //Publics.
            foreach (Match match in Regex.Matches(code, "public[ \\t]+([a-zA-Z1-3_@: \\t]+)[ \\t]*\\((.*)\\)\\s*{",
                                                  RegexOptions.Multiline))
            {
                string funcName   = Convert.ToString(Regex.Replace(match.Groups[1].Value, "\\s", ""));
                string funcParams = Convert.ToString(Regex.Replace(match.Groups[2].Value, "\\s", ""));
                try
                {
                    //Get the tag if exists.
                    string tag = "";
                    if (funcName.Contains(":"))
                    {
                        tag = funcName.Substring(0,
                                                 funcName.IndexOf(":", Convert.ToInt32(StringComparison.Ordinal)) + 1);
                        funcName = funcName.Remove(0, funcName.IndexOf(":") + 1);
                    }

                    //Get the PawnDoc for it.
                    PawnDocParser pwndoc = null;
                    if (parts.PawnDocs != null)
                    {
                        pwndoc = parts.PawnDocs.Find(x => x.Summary == funcName);
                    }

                    if (add)
                    {
                        parts.Publics.Add(new FunctionsStruct(funcName, funcParams, tag, pwndoc));
                    }
                    else
                    {
                        parts.Publics.RemoveAll(x => x.FuncName == funcName);
                    }
                }
                catch (Exception)
                {
                }
            }

            //Stocks
            foreach (Match match in Regex.Matches(code, "stock[ \\t]+([a-zA-Z1-3_@: \\t]+)[ \\t]*\\((.*)\\)\\s*{",
                                                  RegexOptions.Multiline))
            {
                string funcName   = Convert.ToString(Regex.Replace(match.Groups[1].Value, "\\s", ""));
                string funcParams = Convert.ToString(Regex.Replace(match.Groups[2].Value, "\\s", ""));
                try
                {
                    //Get the tag if exists.
                    string tag = "";
                    if (funcName.Contains(":"))
                    {
                        tag      = funcName.Substring(0, funcName.IndexOf(":") + 1);
                        funcName = funcName.Remove(0, funcName.IndexOf(":") + 1);
                    }

                    //Get the PawnDoc for it.
                    PawnDocParser pwndoc = null;
                    if (parts.PawnDocs != null)
                    {
                        pwndoc = parts.PawnDocs.Find(x => x.Summary == funcName);
                    }

                    if (add)
                    {
                        parts.Stocks.Add(new FunctionsStruct(funcName, funcParams, tag, pwndoc));
                    }
                    else
                    {
                        parts.Stocks.RemoveAll(x => x.FuncName == funcName);
                    }
                }
                catch (Exception)
                {
                }
            }

            //Functions in General.
            foreach (Match match in Regex.Matches(code,
                                                  "^[ \\t]*(?!" + FuncLikeKeywords +
                                                  ")(?:\\sstatic\\s+stock\\s+|\\sstock\\s+static\\s+|\\sstatic\\s+)?([a-zA-Z1-3_@:]+)\\((.*)\\)(?!;)\\s*{",
                                                  RegexOptions.Multiline))
            {
                string funcName   = Convert.ToString(Regex.Replace(match.Groups[1].Value, "\\s", ""));
                string funcParams = Convert.ToString(Regex.Replace(match.Groups[2].Value, "\\s", ""));
                try
                {
                    //Get the tag if exists.
                    string tag = "";
                    if (funcName.Contains(":"))
                    {
                        tag      = funcName.Substring(0, funcName.IndexOf(":") + 1);
                        funcName = funcName.Remove(0, funcName.IndexOf(":") + 1);
                    }

                    //Get the PawnDoc for it.
                    PawnDocParser pwndoc = null;
                    if (parts.PawnDocs != null)
                    {
                        pwndoc = parts.PawnDocs.Find(x => x.Summary == funcName);
                    }

                    if (add)
                    {
                        parts.Functions.Add(new FunctionsStruct(funcName, funcParams, tag, pwndoc));
                    }
                    else
                    {
                        parts.Functions.RemoveAll(x => x.FuncName == funcName);
                    }
                }
                catch (Exception)
                {
                }
            }

            //Natives
            foreach (Match match in Regex.Matches(code, "native[ \\t]+([a-zA-Z1-3_@: \\t]+)[ \\t]*?\\((.*)\\);",
                                                  RegexOptions.Multiline))
            {
                string funcName   = Convert.ToString(Regex.Replace(match.Groups[1].Value, "\\s", ""));
                string funcParams = Convert.ToString(Regex.Replace(match.Groups[2].Value, "\\s", ""));
                try
                {
                    //Get the tag if exists.
                    string tag = "";
                    if (funcName.Contains(":"))
                    {
                        tag      = funcName.Substring(0, funcName.IndexOf(":") + 1);
                        funcName = funcName.Remove(0, funcName.IndexOf(":") + 1);
                    }

                    //Get the PawnDoc for it.
                    PawnDocParser pwndoc = null;
                    if (parts.PawnDocs != null)
                    {
                        pwndoc = parts.PawnDocs.Find(x => x.Summary == funcName);
                    }

                    if (add)
                    {
                        parts.Natives.Add(new FunctionsStruct(funcName, funcParams, tag, pwndoc));
                    }
                    else
                    {
                        parts.Natives.RemoveAll(x => x.FuncName == funcName);
                    }
                }
                catch (Exception)
                {
                }
            }
        }
コード例 #13
0
ファイル: Includes.cs プロジェクト: 2002a1116/ExtremeStudio
        public static void Parse(string code, string filePath, string prjPath, CodeParts parts, ExceptionsList errors,
                                 bool add = true)
        {
            foreach (Match match in Regex.Matches(code, "\\#include[ \\t]+([^\\s]+)", RegexOptions.Multiline))
            {
                string text     = Convert.ToString(match.Groups[1].Value);
                string fullPath = "";

                var type = text.Substring(0, 1);

                var dirs = Directory.GetDirectories(prjPath + "\\dependencies").ToList();
                if (Directory.Exists(prjPath + "\\pawno\\include"))
                {
                    dirs.Add(prjPath + "\\pawno\\include");
                }

                if (char.Parse(type) == (char)34)
                {
                    //Remove the quotes.
                    try
                    {
                        text = text.Remove(text.IndexOf((char)34), 1);
                        text = text.Remove(text.IndexOf((char)34), 1);
                    }
                    catch (Exception)
                    {
                        continue;
                    }

                    fullPath = Path.Combine(Path.GetDirectoryName(Path.GetFullPath(filePath)), text);
                    AddExtension(ref fullPath);
                }
                else if (type == "<")
                {
                    //Remove the brackets.
                    try
                    {
                        text = text.Remove(text.IndexOf("<"), 1);
                        text = text.Remove(text.IndexOf(">"), 1);
                    }
                    catch (Exception)
                    {
                        continue;
                    }

                    foreach (var dir in dirs)
                    {
                        string pth = Path.Combine(dir, text);
                        AddExtension(ref pth);
                        if (File.Exists(pth))
                        {
                            fullPath = pth;
                            break;
                        }
                    }
                }
                else
                {
                    foreach (var dir in dirs)
                    {
                        string pth = Path.Combine(dir, text);
                        AddExtension(ref pth);
                        if (File.Exists(pth))
                        {
                            fullPath = pth;
                            break;
                        }
                    }
                }

                try
                {
                    //Create a new codeparts object for the includes cause they are needed.
                    if (add)
                    {
                        //Check if was already parsed or not.
                        if (Parser.IsParsed(parts.RootInclude, fullPath))
                        {
                            continue;
                        }

                        //Else:
                        //Check if exists or not:
                        if (File.Exists(fullPath))
                        {
                            CodeParts part = new CodeParts
                            {
                                //Setup and add to list.
                                FilePath = fullPath
                            };
                            parts.AddInclude(part);

                            Parser prs = new Parser(part, File.ReadAllText(fullPath), fullPath, prjPath, true);
                            errors.ExceptionsList_Renamed.AddRange(prs.Errors.ExceptionsList_Renamed);
                        }
                        else
                        {
                            errors.ExceptionsList_Renamed.Add(
                                new IncludeNotFoundException(Path.GetFileNameWithoutExtension(text)));
                        }
                    }
                    else
                    {
                        try
                        {
                            //Here if the include is REMOVED, There is no need to parse it all again cause we already know that we just need to remove the whole include.
                            parts.RemoveIncludeByHash(GeneralFunctions.GetFileHash(fullPath));
                        }
                        catch (Exception)
                        {
                            // ignored
                        }
                    }

                    //Exceptions.
                }
                catch (DirectoryNotFoundException)
                {
                    errors.ExceptionsList_Renamed.Add(new IncludeNotFoundException(Path.GetFileNameWithoutExtension(text)));
                }
                catch (FileNotFoundException)
                {
                    errors.ExceptionsList_Renamed.Add(new IncludeNotFoundException(Path.GetFileNameWithoutExtension(text)));
                }
            }
        }