예제 #1
0
 private async Task SendPokemon()
 {
     while (true)
     {
         var listToSend = _pokemons.Where(t => !EncounterSpawnList.Contains(t.EncounterId + t.SpawnPointId));
         var request    = new RestRequest("api/pokemon", Method.POST);
         var removeList = listToSend.ToList();
         EncounterSpawnList.AddRange(removeList.Select(t => t.EncounterId + t.SpawnPointId));
         if (removeList.Count != 0)
         {
             request.AddJsonBody(removeList.Select(x => new PokemonModel(x)));
             //request.RequestFormat = DataFormat.Json;
             //request.AddBody(JsonConvert.SerializeObject(removeList.Select(x => new PokemonModel(x))).Encrypt(""));
             foreach (var mapPokemon in removeList)
             {
                 _pokemons.Remove(mapPokemon);
             }
             Rc.ExecuteAsync(request, response => { });
         }
         await Task.Delay(15000);
     }
 }