Пример #1
0
        public void findFunc(string path)
        {
            if (CopyForm.CheckReportFunctions)
            {
                string[] allLinesInFile = File.ReadAllLines(path);
                lFunctions = new List <Functions>();

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

                    while (call)
                    {
                        Functions function = new Functions();

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

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

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

                            if (match.Success)
                            {
                                function.NameFunction = match.Value;
                            }
                            else
                            {
                                paternFind = "\\w+\\:{2}\\w+\\:{2}\\w+";
                                match      = new Regex(paternFind).Match(line);

                                function.NameFunction = match.Value;
                            }

                            lFunctions.Add(function);
                            break;
                        }
                    }
                }

                if (CopyForm.CheckReportFunctions & CopyForm.CheckExportInFileExcel)
                {
                    workExcel = new WorkExcel();
                    workExcel.DisplayFunctions(lFunctions);
                }

                if (CopyForm.CheckReportFunctions & CopyForm.CheckSaveInFile)
                {
                    NameFile = "akvs_dyn_thread_2.log";

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

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

                            if (match.Success)
                            {
                                File.AppendAllText(Path.Combine(PathFile, NameFile), match.Value + ":f:i\n", Encoding.ASCII);
                                File.AppendAllText(Path.Combine(PathFile, NameFile), match.Value + ":f:o\n", Encoding.ASCII);
                                break;
                            }
                        }
                    }
                }
            }
        }
Пример #2
0
        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);
                }
            }
        }