private async Task HandleAutoGimiAsync(int times) { Context.Account.CanAutoGimi = false; times = times > 100 ? 100 : times <= 0 ? 1 : times; long result = 0; TimeSpan duration = TimeSpan.FromSeconds(times - 1); Discord.IUserMessage reference = await Context.Channel.SendMessageAsync($"> Gathering results in {Format.Counter(duration.TotalSeconds)}..."); var gimi = new Gimi(true); for (int i = 0; i < times; i++) { GimiResult innerResult = gimi.Next(); // this should be easier on the mem innerResult.Apply(Context.Account); result += innerResult.IsSuccess ? innerResult.Reward : -innerResult.Reward; if (times > 1) { await Task.Delay(1000); } } await reference.ModifyAsync($"> 〽️ **The results are in!**\n> **Net Outcome**: **{result:##,0}**").ConfigureAwait(false); Context.Account.CanAutoGimi = true; }
private void LoginFunction(object sender, RoutedEventArgs e) { string email = textBoxEmail.Text; string pass = passwordTextBox.Password; if (email.Trim().Length == 0 || pass.Trim().Length == 0) { MessageBox.Show("Veuillez remplir tous les champs"); } else { //pass = Hash(pass); if (CheckCredentials(email, pass)) { Gimi gimi = API.API.Instance.GetGimi(email, pass).Result; Dashboard menu = new Dashboard(gimi); menu.Show(); Close(); } else { MessageBox.Show("E-mail ou mot de passe incorrect."); } } }
public Dashboard(Gimi gimi) { InitializeComponent(); frame.NavigationService.Navigate(new PageFestivals()); this.gimi = gimi; ChargerGimi(); }
public async Task <ActionResult <Gimi> > PostGimi(Gimi gimi) { _context.Gimi.Add(gimi); await _context.SaveChangesAsync(); return(CreatedAtAction("GetGimi", new { id = gimi.IdG }, gimi)); }
public async Task <IActionResult> PutGimi(int id, Gimi gimi) { if (id != gimi.IdG) { return(BadRequest()); } _context.Entry(gimi).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!GimiExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task GimiAsync() { var gimi = new Gimi(); GimiResult result = gimi.Next(); Message message = result.ApplyAndDisplay(Context.Account); await Context.Channel.SendMessageAsync(Context.Account, message).ConfigureAwait(false); }
private bool CheckCredentials(string email, string pass) { Gimi gimi = API.API.Instance.GetGimi(email, pass).Result; try { return(email == gimi.Login && pass == gimi.Pwd); } catch { return(false); } }
public async Task <Gimi> GetGimi(string login, string pwd) { Gimi gimi = null; HttpResponseMessage response = client.GetAsync("api/gimis/" + login + "/" + pwd).Result; if (response.IsSuccessStatusCode) { var resp = await response.Content.ReadAsStringAsync(); gimi = JsonConvert.DeserializeObject <Gimi>(resp); } return(gimi); }
public PageCompte(Gimi gimi) { InitializeComponent(); this.gimi = gimi; ChargerGimi(); }