static int Main(string[] args) { var telemetryClient = GetTelemiteryClient(); Log.Logger = BuildLogger(); ApplicationStartup(args); var doService = new DetectOnlineService(telemetryClient); if (doService.IsOnline()) { var dvService = new DetectVersionService(telemetryClient); Version latestVersion = dvService.GetLatestVersion(); Log.Information("Latest version detected as {Version_Latest}", latestVersion); var version = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version; if (latestVersion > version) { Log.Warning("You are currently running version {Version_Current} and a newer version ({Version_Latest}) is available. You should upgrade now using Chocolatey command 'choco upgrade vsts-sync-migrator' from the command line.", version, latestVersion); #if !DEBUG Console.WriteLine("Do you want to continue? (y/n)"); if (Console.ReadKey().Key != ConsoleKey.Y) { Log.Warning("User aborted to update version"); return(2); } #endif } } int result = (int)Parser.Default.ParseArguments <InitOptions, ExecuteOptions>(args).MapResult( (InitOptions opts) => RunInitAndReturnExitCode(opts, telemetryClient), (ExecuteOptions opts) => RunExecuteAndReturnExitCode(opts, telemetryClient, AddPlatformSpecificServices, StartEngine), errs => 1); ApplicationShutdown(); return(result); }
public static int Main(string[] args) { var telemetryClient = GetTelemiteryClient(); Log.Logger = BuildLogger(); ///////////////////////////////////////////////////////// Trace.Listeners.Add(new TextWriterTraceListener(Console.Out)); // TODO: Remove once Trace replaced with log var oldlogPath = Path.Combine(CreateLogsPath(), "old-migration.log"); // TODO: Remove once Trace replaced with log Trace.Listeners.Add(new TextWriterTraceListener(oldlogPath, "myListener")); // TODO: Remove once Trace replaced with log /////////////////////////////////////////////////////////////////////////// ApplicationStartup(args); var doService = new DetectOnlineService(telemetryClient); if (doService.IsOnline()) { var dvService = new DetectVersionService(telemetryClient); Version latestVersion = dvService.GetLatestVersion(); Log.Information("Latest version detected as {Version_Latest}", latestVersion); var version = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version; if (latestVersion > version) { Log.Warning("You are currently running version {Version_Current} and a newer version ({Version_Latest}) is available. You should upgrade now using Chocolatey command 'choco upgrade vsts-sync-migrator' from the command line.", version, latestVersion); #if !DEBUG Console.WriteLine("Do you want to continue? (y/n)"); if (Console.ReadKey().Key != ConsoleKey.Y) { Log.Warning("User aborted to update version"); return(2); } #endif } } int result = (int)Parser.Default.ParseArguments <InitOptions, ExecuteOptions>(args).MapResult( (InitOptions opts) => RunInitAndReturnExitCode(opts, telemetryClient), (ExecuteOptions opts) => RunExecuteAndReturnExitCode(opts, telemetryClient, AddPlatformSpecificServices, ExecuteEntryPoint), (ExportADGroupsOptions opts) => ExportADGroupsCommand.Run(opts, oldlogPath), errs => 1); ApplicationShutdown(); #if DEBUG Log.Information("App paused so you can check the output. Press a key to close."); Console.ReadKey(); #endif return(result); }
public void DetectOnlineServiceTest() { var dos = new DetectOnlineService(new TelemetryLoggerMock()); var result = dos.IsOnline(); //Assert.IsTrue(result); }