program
This commit is contained in:
		
							
								
								
									
										37
									
								
								Program.cs
									
									
									
									
									
								
							
							
						
						
									
										37
									
								
								Program.cs
									
									
									
									
									
								
							@@ -4,30 +4,25 @@ static class Program
 | 
				
			|||||||
{
 | 
					{
 | 
				
			||||||
    internal static void Main(string[] args)
 | 
					    internal static void Main(string[] args)
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        List<string> authors = new List<string>();
 | 
					        try 
 | 
				
			||||||
        Dictionary<string, int> commitReport = new Dictionary<string, int>();
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        using (var repo = new Repository(Directory.GetCurrentDirectory()))
 | 
					 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            foreach (var c in repo.Commits)
 | 
					            CommitDetail commits = new CommitDetail();
 | 
				
			||||||
            {
 | 
					            commits.GetAllCommitsByName();
 | 
				
			||||||
                if (!authors.Contains(c.Author.Name))
 | 
					            // SortedList<string, int> results = commits.OrderCommitsByCount();
 | 
				
			||||||
                {
 | 
					            //StdOutDataService outDataService = new StdOutDataService();
 | 
				
			||||||
                    authors.Add(c.Author.Name);
 | 
					            ExcelDataService excelDataService = new ExcelDataService();
 | 
				
			||||||
                }
 | 
					            //DataAccess dataAccess = new DataAccess(outDataService);
 | 
				
			||||||
            }
 | 
					            DataAccess dataAccess = new DataAccess(excelDataService);
 | 
				
			||||||
            
 | 
					            dataAccess.WriteData(commits.CommitDetails);
 | 
				
			||||||
            foreach (var a in authors)
 | 
					 | 
				
			||||||
            {
 | 
					 | 
				
			||||||
                int commitCount = repo.Commits.Where(r => r.Author.Name == a).Count();
 | 
					 | 
				
			||||||
                commitReport.Add(a, commitCount);
 | 
					 | 
				
			||||||
            }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					        catch (System.IO.DirectoryNotFoundException e)
 | 
				
			||||||
        foreach (var r in commitReport)
 | 
					 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            System.Console.WriteLine($"{r.ToString()}");
 | 
					            Console.WriteLine($"Are you in a git repository? {e}");
 | 
				
			||||||
 | 
					            Environment.Exit(1);
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        catch (System.Exception e)
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					            Console.WriteLine(e);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user