public static async Task Run(string[] args) { var argument = string.Join(" ", args); try { _pocoFileSystem = new PocoFileSystem(); #if NETFULL if (!(Console.IsOutputRedirected || Console.IsErrorRedirected)) #pragma warning disable PC001 // API not supported on all platforms { Console.BufferHeight = Int16.MaxValue - 1; } #pragma warning restore PC001 // API not supported on all platforms #endif // Catch all unhandled exceptions in all threads. AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException; Sw.Start(); RetCode = await RunOptionsAsync(args); Sw.Stop(); Console.WriteLine(); if (!ArgumentParser.ShowVersionOrHelp) { Logger.Sucess($"Total processing time: {Sw.ElapsedMilliseconds / 1000.0} sec"); } } catch (Exception ex) { RetCode = (int)ExitCodes.HandledException; Logger.Error($"Error in executing the command: o2pgen {argument}"); Logger.Error($"Error Message:\n {ex.FullExceptionMessage()}"); #if DEBUG Logger.Error("--------------------Exception Details---------------------"); Logger.Error($"Error Message:\n {ex.FullExceptionMessage(true)}"); Console.ReadKey(); #endif } finally { if (!ArgumentParser.ShowVersionOrHelp) { Logger.Info($"Application Exit code: {RetCode}"); } Environment.Exit(RetCode); } }
public CsCommand(Options options, IPocoFileSystem fileSystem) { if (fileSystem == null) { _fileSystem = new NullFileSystem(); } else { _fileSystem = fileSystem; } Errors = new List <string>(); ArgOptions = optionManager = new OptionManager(options); odataConnectionString = optionManager.GetOdataConnectionString(); PocoSettingOptions = optionManager.GetPocoSetting(); O2PGen = new O2P(PocoSettingOptions); }