public void findNumber(NumberMarker n, List <NumberMarker> lNumbers)
 {
     if (lNumbers.Any(x => x.QidIn.Equals(n.QidOut)))
     {
         var find = lNumbers.FindIndex(x => x.QidIn.Equals(n.QidOut));
         if (find != 0)
         {
             n.QidIn = n.QidOut;
             File.AppendAllText(Path.Combine(PathFile, NameFile), n.QidIn + ":b:i\n", Encoding.ASCII);
             n.QidOut = lNumbers[find].QidOut;
             string saveQidIn = n.QidIn;
             findNumber(n, lNumbers);
             File.AppendAllText(Path.Combine(PathFile, NameFile), saveQidIn + ":b:o\n", Encoding.ASCII);
         }
     }
     else
     {
         File.AppendAllText(Path.Combine(PathFile, NameFile), n.QidOut + ":b:i\n", Encoding.ASCII);
         File.AppendAllText(Path.Combine(PathFile, NameFile), n.QidOut + ":b:o\n", Encoding.ASCII);
     }
 }
        public void findLinkBranch(string path)
        {
            List <string> lBranchKey = new List <string> {
                "do", "if", "forrange", "while", "catch", "for"
            };

            if (CopyForm.CheckReportBranchBranch)
            {
                string[] allLinesInFile = File.ReadAllLines(path);

                lLinkBranchBranch = new List <LinkBranchBranch>();

                foreach (var line in allLinesInFile)
                {
                    bool call = callAndNotCallFuncOrBranch(line);
                    while (call)
                    {
                        LinkBranchBranch linkBranBran = new LinkBranchBranch();
                        string           paternFind   = "[0-9]{1,7}:[0-9]{1,7}";
                        Match            match        = new Regex(paternFind).Match(line);

                        if (match.Success)
                        {
                            linkBranBran.QidOut = match.Value;

                            paternFind = "\\w+\\:{0,2}[\\w!=]+\\({1}[\\w\\s:;<>*,&]*\\){1}";
                            match      = new Regex(paternFind).Match(line);

                            if (match.Success)
                            {
                                linkBranBran.NameBranchQidOut = match.Value;

                                paternFind = "[0-9]{1,7}:[0-9]{1,7}";
                                match      = new Regex(paternFind).Match(line);

                                match = match.NextMatch().NextMatch().NextMatch();

                                if (match.Success)
                                {
                                    linkBranBran.QidIn = match.Value;

                                    paternFind = "\\w+\\:{0,2}[\\w!=]+\\({1}[\\w\\s:;<>*,&]*\\){1}";
                                    match      = new Regex(paternFind).Match(line);

                                    match = match.NextMatch().NextMatch();
                                    if (match.Success)
                                    {
                                        linkBranBran.NameBranchQidIn = match.Value;
                                    }
                                    else
                                    {
                                        foreach (var item2 in lBranchKey)
                                        {
                                            paternFind = item2;
                                            match      = new Regex(paternFind).Match(line);

                                            if (!match.Success)
                                            {
                                                continue;
                                            }
                                            else
                                            {
                                                linkBranBran.NameBranchQidIn = match.Value;
                                                break;
                                            }
                                        }
                                    }
                                }
                            }
                            else
                            {
                                foreach (var item1 in lBranchKey)
                                {
                                    paternFind = item1;
                                    match      = new Regex(paternFind).Match(line);

                                    if (!match.Success)
                                    {
                                        continue;
                                    }

                                    linkBranBran.NameBranchQidOut = match.Value;

                                    paternFind = "[0-9]{1,7}:[0-9]{1,7}";
                                    match      = new Regex(paternFind).Match(line);

                                    match = match.NextMatch().NextMatch().NextMatch();

                                    if (match.Success)
                                    {
                                        linkBranBran.QidIn = match.Value;

                                        paternFind = "\\w+\\:{0,2}[\\w!=]+\\({1}[\\w\\s:;<>*,&]*\\){1}";
                                        match      = new Regex(paternFind).Match(line);

                                        match = match.NextMatch().NextMatch();
                                        if (match.Success)
                                        {
                                            linkBranBran.NameBranchQidIn = match.Value;
                                        }
                                        else
                                        {
                                            foreach (var item2 in lBranchKey)
                                            {
                                                paternFind = item2;
                                                match      = new Regex(paternFind).Match(line);

                                                if (!match.Success)
                                                {
                                                    continue;
                                                }
                                                else
                                                {
                                                    linkBranBran.NameBranchQidIn = match.Value;
                                                    break;
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                        lLinkBranchBranch.Add(linkBranBran);
                        break;
                    }
                }

                if (CopyForm.CheckReportBranchBranch & CopyForm.CheckExportInFileExcel)
                {
                    workExcel = new WorkExcel();
                    workExcel.DisplayLinkBranchBranch(lLinkBranchBranch);
                }

                if (CopyForm.CheckReportBranchBranch & CopyForm.CheckSaveInFile)
                {
                    NameFile = "akvs_dyn_thread_5.log";

                    List <NumberMarker>    lNumbers    = new List <NumberMarker>();
                    LinkFunctionsFunctions buildReport = new LinkFunctionsFunctions();

                    foreach (var line in allLinesInFile)
                    {
                        bool call = callAndNotCallFuncOrBranch(line);

                        if (call)
                        {
                            NumberMarker number = new NumberMarker();

                            string paternFind = "[0-9]{1,7}:[0-9]{1,7}";
                            Match  match      = new Regex(paternFind).Match(line);

                            if (match.Success)
                            {
                                number.QidIn = match.Value;
                                match        = match.NextMatch().NextMatch().NextMatch();
                                if (match.Success)
                                {
                                    number.QidOut = match.Value;
                                }
                            }
                            lNumbers.Add(number);
                        }
                    }
                    recursing(lNumbers);
                }
            }
        }