private static async Task Sync() { var context = AppServices.GetService <ExplorerDbContext>(); await context.Database.EnsureCreatedAsync(); ExplorerSync.StartSync(context); }
private static async Task StartMenu() { bool exit = false; while (!exit) { Console.WriteLine(); Console.WriteLine("MENU"); Console.WriteLine("1 - Init DB"); Console.WriteLine("2 - Sync DB"); Console.WriteLine("3 - Stop sync"); Console.WriteLine("4 - Change RPC server"); Console.WriteLine("5 - Ensure no missing blocks"); Console.WriteLine("6 - Update all address balances"); Console.WriteLine("7 - Delete DB"); Console.WriteLine("8 - Exit"); var option = Console.ReadKey().KeyChar; switch (option) { case '1': ExplorerSync.ContinueSync = false; Console.Clear(); Console.WriteLine("Initializing db..."); await InitDb(); break; case '2': Console.Clear(); ExplorerSync.ContinueSync = true; Console.WriteLine("Starting sync process"); await Sync(); break; case '3': ExplorerSync.ContinueSync = false; break; case '4': Console.Clear(); exit = true; await ChangeRpcServer(); break; case '5': ExplorerSync.ContinueSync = false; Console.Clear(); EnsureNoMissingBlocks(); break; case '6': ExplorerSync.ContinueSync = false; Console.Clear(); ExplorerSync.UpdateAllAddressBalances(); break; case '7': ExplorerSync.ContinueSync = false; Console.Clear(); await DropDb(); break; case '8': exit = true; break; } } }