static void Main(string[] args) { AppDomain.CurrentDomain.UnhandledException += (sender, e) => { Console.WriteLine(e.ExceptionObject); }; PrintNameVersionAndCopyright(); ArgOptions options; using (var consoleIconSwapper = new ConsoleIconSwapper()) { consoleIconSwapper.ShowConsoleIcon(CoreResources.FavIcon); try { options = new ArgOptions(args); if (options.ShowHelp) { ArgOptions.ShowHelpMessage(Console.Out, options); return; } if (!options.XapPaths.Any() && !options.Dlls.Any()) { throw new StatLightException("No xap or silverlight dll's specified."); } ILogger logger = GetLogger(options.IsRequestingDebug); var commandLineExecutionEngine = new CommandLineExecutionEngine(logger, options); TestReportCollection testReports = commandLineExecutionEngine.Run(); if (testReports.FinalResult == RunCompletedState.Failure) { Environment.ExitCode = ExitFailed; } else { Environment.ExitCode = ExitSucceeded; } } catch (AddressAccessDeniedException addressAccessDeniedException) { Environment.ExitCode = ExitFailed; var helpMessage = @" Cannot run StatLight. The current account does not have the correct privilages. Exception: {0} Try: (the following two steps that should allow StatLight to start a web server on the requested port) 1. Run cmd.exe as Administrator. 2. Enter the following command in the command prompt. netsh http add urlacl url=http://+:8887/ user=DOMAIN\user ".FormatWith(addressAccessDeniedException.Message); WriteErrorToConsole(helpMessage, "Error"); } catch (FileNotFoundException fileNotFoundException) { HandleKnownError(fileNotFoundException); } catch (StatLightException statLightException) { HandleKnownError(statLightException); } catch (Exception exception) { HandleUnknownError(exception); } } }
static void Main(string[] args) { AppDomain.CurrentDomain.UnhandledException += (sender, e) => { Console.WriteLine(e.ExceptionObject); }; PrintNameVersionAndCopyright(); ArgOptions options; using (var consoleIconSwapper = new ConsoleIconSwapper()) { consoleIconSwapper.ShowConsoleIcon(CoreResources.FavIcon); try { options = new ArgOptions(args); if (options.ShowHelp) { ArgOptions.ShowHelpMessage(Console.Out, options); return; } if (!options.XapPaths.Any() && !options.Dlls.Any()) { throw new StatLightException("No xap or silverlight dll's specified."); } ILogger logger = GetLogger(options.IsRequestingDebug); var commandLineExecutionEngine = new CommandLineExecutionEngine(logger, options); TestReportCollection testReports = commandLineExecutionEngine.Run(); if (testReports.FinalResult == RunCompletedState.Failure) Environment.ExitCode = ExitFailed; else Environment.ExitCode = ExitSucceeded; } catch (AddressAccessDeniedException addressAccessDeniedException) { Environment.ExitCode = ExitFailed; var helpMessage = @" Cannot run StatLight. The current account does not have the correct privilages. Exception: {0} Try: (the following two steps that should allow StatLight to start a web server on the requested port) 1. Run cmd.exe as Administrator. 2. Enter the following command in the command prompt. netsh http add urlacl url=http://+:8887/ user=DOMAIN\user ".FormatWith(addressAccessDeniedException.Message); WriteErrorToConsole(helpMessage, "Error"); } catch (FileNotFoundException fileNotFoundException) { HandleKnownError(fileNotFoundException); } catch (StatLightException statLightException) { HandleKnownError(statLightException); } catch (Exception exception) { HandleUnknownError(exception); } } }