예제 #1
0
파일: BotHost.cs 프로젝트: wildbunny/MT
        private async Task StartBots()
        {
            foreach (var bot in Bots)
            {
                var tryCount = 0;
                while (true)
                {
                    if (tryCount >= 3)
                    {
                        break;
                    }
                    tryCount++;

                    var createUser = false;
                    try
                    {
                        await bot.Initialize(_settings.MTServerAddress, _settings.MTAuthorizationAddress, _settings.ActionScriptInterval, _settings.TransactionFrequencyMin, _settings.TransactionFrequencyMax);

                        break;
                    }
                    catch (Exception ex)
                    {
                        if (ex.Message == "Invalid username or password")
                        {
                            createUser = true;
                        }
                    }
                    if (createUser)
                    {
                        LogInfo("StartBots", $"Creating user: {bot.Email}");
                        try
                        {
                            await MtUserHelper.Registration(bot.Email, bot.Password, _settings.MTAuthorizationAddress);

                            LogInfo("StartBots", $"User {bot.Email} created successfully");
                            System.Threading.Thread.Sleep(1000);
                        }
                        catch (Exception ex01)
                        {
                            LogError("MtUserHelper.Registration", ex01);
                            break;
                        }
                    }
                }
            }
        }
예제 #2
0
파일: BotConsole.cs 프로젝트: wildbunny/MT
        private static async void RegisterUser()
        {
            Console.Write("Email: ");
            var email = Console.ReadLine();

            try
            {
                await MtUserHelper.EmailVerification(email, _settings.MTAuthorizationAddress);
            }
            catch (Exception ex)
            {
                LogError("MtUserHelper.EmailVerification", ex);
                return;
            }

            Console.Write("Password: ");
            var pass = Console.ReadLine();

            await MtUserHelper.Registration(email, pass, _settings.MTAuthorizationAddress);
        }