private static int Main(string[] args) { try { var exitCode = 0; if (args.Length != 3 && args.Length != 4) { PrintUsage(); return(1); } var rewriterToolArguments = ParseRewriterToolArgumentsFile(args[0], args[1], args[2]); if (rewriterToolArguments == null) { return(1); } AzureFileInformationCollection azureFileInformationCollection = new AzureFileInformationCollection(); if (args.Length == 4) { azureFileInformationCollection.AzureVideoInfoMapping = AzureVideoHelper.ParseAzureVideoFile(args[3], rewriterToolArguments.IsMigration); } if (rewriterToolArguments.IsMigration) { GenerateAzureFileInfoForMigration(args[0], rewriterToolArguments, args[2], azureFileInformationCollection); } else { GenerateAzureFileInfo(args[0], rewriterToolArguments, args[2], azureFileInformationCollection); } foreach (var azureTransformArguments in rewriterToolArguments.AzureTransformArgumentsList) { var p = new Program(rewriterToolArguments.IsMigration, azureTransformArguments.SourceDir, azureTransformArguments.DestDir, azureFileInformationCollection); if (!p.CheckParameters()) { continue; } var result = p.Rewrite(); if (result != 0) { exitCode = result; } } return(exitCode); } catch (Exception ex) { Console.Error.WriteLine(ex); return(1); } }
private static int Main(string[] args) { try { var exitCode = 0; if (args.Length != 3 && args.Length != 4) { PrintUsage(); return(1); } // Parse the basic arguments var rewriterToolArguments = ParseRewriterToolArgumentsFile(args[0], args[1], args[2]); if (rewriterToolArguments == null) { return(1); } // Register logger var consoleLogListener = new ConsoleLogListener(); var htmlLogFile = Path.Combine(rewriterToolArguments.AzureTransformArgumentsList.First().SourceDir, "log", "log.html"); if (File.Exists(htmlLogFile)) { File.Delete(htmlLogFile); } var htmlLogListener = new HtmlLogListener(htmlLogFile); Logger.RegisterListener(consoleLogListener); Logger.RegisterListener(htmlLogListener); // Parse advanced migration parameters AzureFileInformationCollection azureFileInformationCollection = new AzureFileInformationCollection(); if (args.Length == 4) { azureFileInformationCollection.AzureVideoInfoMapping = AzureVideoHelper.ParseAzureVideoFile(args[3], rewriterToolArguments.IsMigration); } if (rewriterToolArguments.IsMigration) { GenerateAzureFileInfoForMigration(args[0], rewriterToolArguments, args[2], azureFileInformationCollection); } else { GenerateAzureFileInfo(args[0], rewriterToolArguments, args[2], azureFileInformationCollection); } foreach (var azureTransformArguments in rewriterToolArguments.AzureTransformArgumentsList) { var p = new Program(rewriterToolArguments.IsMigration, azureTransformArguments.SourceDir, azureTransformArguments.DestDir, azureFileInformationCollection); if (!p.CheckParameters()) { continue; } var result = p.Rewrite(); if (result != 0) { exitCode = result; } } return(exitCode); } catch (Exception ex) { Console.Error.WriteLine(ex); return(1); } finally { Logger.Flush(); Logger.UnregisterAllListeners(); } }