public static void Main(string[] args) { StartupConfiguration config = new StartupConfiguration(args); if (config.PrintHelp || config.PrintVersion) { if (config.PrintHelp) { InfoPrinter.PrintHelp(); } else if (config.PrintVersion) { InfoPrinter.PrintVersion(); } return; } UseConfigurationDirectory(config); if (config.CheckDatabaseAvailability) { DataSeed().CheckConnection(); } else if (ShouldUpdate(config)) { if (config.Migrate) { Migrations().Migrate(); } if (config.InitializeCoreData) { DataSeed().SeedInitialize(); } if (config.SeedWithTestData) { DataSeed().SeedAddTestData(config.CategoryTokensToSeed, config.SeedWithCategoryNames); } } else if (config.StartServer) { new ServerStartup().RunServer(config); } else { InfoPrinter.PrintNoArgumentsInfo(); } Migrations.Main Migrations() => new Migrations.Main(config.ConfigRootDir); DataSeed.Main DataSeed() => new DataSeed.Main(config.ConfigRootDir); }
/// <summary> /// Entry point of CLI /// </summary> public static void Main(string[] args) { StartupConfiguration config = new StartupConfiguration(args); if (config.NoLogo) { InfoPrinter.PrintVersion(); } else { InfoPrinter.PrintLogoAndVersion(); } if (config.PrintHelp || config.PrintVersion) { if (config.PrintHelp) { InfoPrinter.PrintHelp(); } else if (config.PrintVersion) { InfoPrinter.PrintVersion(); } return; } if (config.CheckNoArguments()) { InfoPrinter.PrintNoArgumentsInfo(); return; } config.InitConfigurationDirectory(); InfoPrinter.PrintServerInfo(config.ConfigRootDir); if (config.CheckDatabaseAvailability) { if (!DataSeed().PrintDbConnectionAvailability()) { Environment.Exit(1); } } else if (config.UsersPasswords.Count > 0) { DataSeed().SetUsersPasswords(config.UsersPasswords); } else if (ShouldUpdate(config)) { if (config.Migrate) { Migrations().Migrate(); } if (config.InitializeCoreData) { DataSeed().SeedInitialize(); } if (config.SeedWithTestData) { DataSeed().SeedAddTestData(config.CategoryTokensToSeed, config.SeedWithCategoryNames); } } else if (config.StartServer) { new ServerRun().RunServer(config); } else { InfoPrinter.PrintNoArgumentsInfo(); } Migrations.Main Migrations() => new Migrations.Main(config.ConfigRootDir); DataSeed.Main DataSeed() => new DataSeed.Main(config.ConfigRootDir); }