-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProgram.cs
More file actions
51 lines (43 loc) · 1.84 KB
/
Program.cs
File metadata and controls
51 lines (43 loc) · 1.84 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
using CodeLineCounter.Services;
using CodeLineCounter.Utils;
namespace CodeLineCounter
{
static class Program
{
static void Main(string[] args)
{
try
{
var settings = CoreUtils.ParseArguments(args);
if (!settings.IsValid() || settings.DirectoryPath == null)
return;
List<string> solutionFiles = FileUtils.GetSolutionFiles(settings.DirectoryPath);
if (solutionFiles.Count == 0)
{
Console.WriteLine("No solution (.sln) found in the specified directory.");
return;
}
// If only one solution found in directory, select it automatically
// if more than one waiting for user selection
if (solutionFiles.Count == 1)
{
SolutionAnalyzer.AnalyzeAndExportSolution(solutionFiles[0], settings.Verbose, settings.Format, settings.OutputPath);
return;
}
var solutionFilenameList = CoreUtils.GetFilenamesList(solutionFiles);
CoreUtils.DisplaySolutions(solutionFilenameList);
Console.Write($"Choose a solution to analyze (1-{solutionFiles.Count}): ");
string? input = Console.ReadLine();
var choice = CoreUtils.CheckInputUserChoice(input, solutionFiles.Count);
if (choice == -1)
return;
var solutionPath = Path.GetFullPath(solutionFiles[choice - 1]);
SolutionAnalyzer.AnalyzeAndExportSolution(solutionPath, settings.Verbose, settings.Format, settings.OutputPath);
}
catch (Exception ex)
{
Console.WriteLine($"Error: {ex.Message}");
}
}
}
}