Change Output format to match PR feedback

Don't use Environment.Exit()

PR Feedback, Unecessary Usings and Immutable types
This commit is contained in:
Bryan 2015-12-15 18:09:08 -08:00
commit 3b848c0487
9 changed files with 169 additions and 56 deletions

View file

@ -10,7 +10,17 @@ namespace MultiProjectValidator
{
public static int Main(string[] args)
{
var rootPath = ParseAndValidateArgs(args);
string rootPath = null;
try
{
rootPath = ParseAndValidateArgs(args);
}
catch
{
return 1;
}
List<ProjectContext> projects = null;
try
@ -20,7 +30,7 @@ namespace MultiProjectValidator
catch(Exception e)
{
Console.WriteLine("Failed to load projects from path: " + rootPath);
Exit(1);
return 1;
}
var analyzer = ProjectAnalyzer.Create(projects);
@ -80,7 +90,7 @@ namespace MultiProjectValidator
if (args.Length != 1)
{
PrintHelp();
Exit(1);
throw new Exception();
}
string rootPath = args[0];
@ -88,16 +98,11 @@ namespace MultiProjectValidator
if (!Directory.Exists(rootPath))
{
Console.WriteLine("Root Directory does not exist: " + rootPath);
Exit(1);
throw new Exception();
}
return rootPath;
}
private static void Exit(int code)
{
Environment.Exit(code);
}
private static void PrintHelp()
{