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); } } }
public void findLinkFunc(string path) { if (CopyForm.CheckReportFunctionsFunctions) { string[] allLinesInFile = File.ReadAllLines(path); lLinkFunctionFunction = new List <LinkFunctionsFunctions>(); foreach (var line in allLinesInFile) { bool call = callAndNotCallFuncOrBranch(line); while (call) { LinkFunctionsFunctions linkFunFun = new LinkFunctionsFunctions(); string paternFind = "[0-9]{1,7}:[0-9]{1,7}"; Match match = new Regex(paternFind).Match(line); if (match.Success) { linkFunFun.QidOut = match.Value; paternFind = "\\w+\\:{0,2}[\\w!=]+\\({1}[\\w\\s:;<>*,&]*\\){1}"; match = new Regex(paternFind).Match(line); if (match.Success) { linkFunFun.NameFunctionQidOut = 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) { linkFunFun.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) { linkFunFun.NameFunctionQidIn = match.Value; } } } } lLinkFunctionFunction.Add(linkFunFun); break; } } if (CopyForm.CheckReportFunctionsFunctions & CopyForm.CheckExportInFileExcel) { workExcel = new WorkExcel(); workExcel.DisplayLinkFunctionFunction(lLinkFunctionFunction); } if (CopyForm.CheckReportFunctionsFunctions & CopyForm.CheckSaveInFile) { NameFile = "akvs_dyn_thread_3.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); string second = match.Value; match = match.NextMatch().NextMatch().NextMatch(); 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); } File.AppendAllText(Path.Combine(PathFile, NameFile), second + ":f:o\n", Encoding.ASCII); break; } } } } } }