static void Main(string[] args) { try { //Variables int linecount = 0; //Instantiating listclass ListClass cl = new ListClass(); //Reading the file and creating an array of lines. string[] lines = File.ReadAllLines(filePathSrc); //Adding file headings cl.AddItemsToList("Revision_No", "Author_Name", "Date_Time", 0, "Changed_Paths", "Comments"); while (linecount < lines.Length) { if ((lines[linecount].LastIndexOf("-") == 71) && (linecount + 1 < lines.Length)) { linecount++; //moving to the next line string[] commitprop = ConvertLine1(lines[linecount]); int noOfComms = GetNumber(commitprop[3]); linecount++; //moving to the next line //Instantiating stringbuilder objects to hold the data StringBuilder cp = new StringBuilder(); //1st changepaths object StringBuilder cp1 = new StringBuilder(); //2nd changepaths object - limited cell capacity in excel StringBuilder comms = new StringBuilder(); //comments object if (lines[linecount].IndexOf(':') == 13) //validating linecount is @ changedPaths: { linecount = ConvertBlock1(linecount, cl, lines, commitprop, noOfComms, cp, cp1); } else { cp.Append($"File format has changed_review file source: {filePathSrc}"); while (lines[linecount] != string.Empty && noOfComms > 0) { linecount++; } } linecount++;//moving to the next line //creating the comments datablock ConvertBlock2(linecount, lines, noOfComms, comms); //adding data to the commitList cl.AddItemsToList(commitprop[0], commitprop[1], commitprop[2], noOfComms, cp.ToString(), comms.ToString()); } else { linecount++; } } //Write the list out to a new file "Commit-Output_datatime.csv" CreateCommitFile(cl.commitList); } catch (FileNotFoundException) { Console.WriteLine($"File not found error: {filePathSrc}"); } }