private async Task ImportMasteries(RiotAccount account)
 {
     string str;
     Func<MasteryBookPageDTO, string> func = (MasteryBookPageDTO page) => page.PageId.ToString(CultureInfo.InvariantCulture);
     MasteryBookDTO masteryBookDTO = await account.InvokeAsync<MasteryBookDTO>("masteryBookService", "getMasteryBook", account.SummonerId);
     MasteryBookDTO masteryBookDTO1 = masteryBookDTO;
     List<MasteryBookPageDTO> bookPages = masteryBookDTO1.BookPages;
     IOrderedEnumerable<MasteryBookPageDTO> pageId =
         from page in bookPages
         orderby page.PageId
         select page;
     IEnumerable<MasterySetup> talentEntries =
         from page in pageId
         let masteries =
             from x in page.TalentEntries
             select new Mastery()
             {
                 Id = x.TalentId,
                 Rank = x.Rank
             }
         select new MasterySetup()
         {
             Id = func(page),
             Name = page.Name,
             Masteries = masteries.ToArray<Mastery>()
         };
     List<MasteryBookPageDTO> masteryBookPageDTOs = masteryBookDTO1.BookPages;
     MasteryBookPageDTO masteryBookPageDTO = masteryBookPageDTOs.FirstOrDefault<MasteryBookPageDTO>((MasteryBookPageDTO x) => x.Current);
     if (masteryBookPageDTO != null)
     {
         str = func(masteryBookPageDTO);
     }
     else
     {
         str = null;
     }
     string str1 = str;
     LittleClient client = JsApiService.Client;
     object[] objArray = new object[] { "masteries", null };
     MasteryBook masteryBook = new MasteryBook()
     {
         ActiveId = str1,
         Setups = talentEntries.ToArray<MasterySetup>()
     };
     objArray[1] = masteryBook;
     await client.Invoke("storage.set", objArray);
 }
 private async Task ProcessData(RiotAccount account, object obj)
 {
     bool flag;
     object[] objArray;
     long num2;
     SearchingForMatchNotification searchingForMatchNotification = obj as SearchingForMatchNotification;
     if (searchingForMatchNotification == null)
     {
         GameNotification gameNotification = obj as GameNotification;
         if (gameNotification == null)
         {
             GameDTO gameDTO = obj as GameDTO;
             if (gameDTO != null && gameDTO.StatusOfParticipants != null)
             {
                 char[] charArray = gameDTO.StatusOfParticipants.ToCharArray();
                 int[] array = (
                     from x in (IEnumerable<char>)charArray
                     select int.Parse(x.ToString(CultureInfo.InvariantCulture))).ToArray<int>();
                 if (gameDTO.GameState == "START_REQUESTED" || gameDTO.GameState == "IN_PROGRESS")
                 {
                     JsApiService.PushIfActive(account, "game:queue:done", null);
                 }
                 if (gameDTO.GameState != "JOINING_CHAMP_SELECT")
                 {
                     JsApiService.PushIfActive(account, "game:queue:dropped", null);
                 }
                 string gameState = gameDTO.GameState;
                 string str = gameState;
                 if (gameState != null)
                 {
                     if (str == "JOINING_CHAMP_SELECT")
                     {
                         JsApiService.PushIfActive(account, "game:queue:found", QueueNotificationService.GetAcceptDeclineStatus(gameDTO.StatusOfParticipants));
                     }
                     else if (str == "FAILED_TO_START" || str == "START_REQUESTED" || str == "IN_PROGRESS")
                     {
                         this.SetLeftQueue(account);
                     }
                     else if (str == "TERMINATED")
                     {
                         int num3 = 0;
                         var collection = gameDTO.TeamOne.Concat<IParticipant>(gameDTO.TeamTwo).Select((IParticipant x) => {
                             int[] cSu0024u003cu003e8_locals25 = array;
                             int num = num3;
                             int num1 = num;
                             num3 = num + 1;
                             return new { Participant = x as PlayerParticipant, Status = cSu0024u003cu003e8_locals25[num1] };
                         });
                         var array1 = (
                             from x in collection
                             where x.Participant != null
                             select x).ToArray();
                         var variable1 = array1;
                         var variable2 = "";
                         variable2 = null;
                         var variable2 = ((IEnumerable<<>f__AnonymousType14<PlayerParticipant, int>>)variable1).FirstOrDefault((x) => x.Participant.SummonerId == (double)account.SummonerId);
                         if (variable2 != null)
                         {
                             var variable3 = array1;
                             var hasValue = 
                                 from x in (IEnumerable<<>f__AnonymousType14<PlayerParticipant, int>>)variable3
                                 where x.Participant.TeamParticipantId.HasValue
                                 select x;
                             var teamParticipantId = 
                                 from x in hasValue
                                 group x by x.Participant.TeamParticipantId;
                             var list = 
                                 from x in teamParticipantId
                                 select x.ToList();
                             var lists = list;
                             var collection1 = lists.FirstOrDefault((g) => g.Any((x) => x.Participant.SummonerId == (double)account.SummonerId));
                             if (collection1 != null)
                             {
                                 var collection2 = collection1;
                                 if (!collection2.Any((x) => x.Status != 1))
                                 {
                                     goto Label2;
                                 }
                                 this.SetLeftQueue(account);
                                 var collection3 = collection1;
                                 var status = 
                                     from x in collection3
                                     where x.Status != 1
                                     select x;
                                 IEnumerable<string> summonerName = 
                                     from x in status
                                     select x.Participant.SummonerName;
                                 JsApiService.PushIfActive(account, "game:queue:acceptFail", summonerName);
                                 goto Label1;
                             }
                         Label2:
                            
                             if (variable2.Status != 1)
                             {
                                 this.SetLeftQueue(account);
                                 RiotAccount riotAccount = account;
                                 string[] strArrays = new string[] { account.SummonerName };
                                 JsApiService.PushIfActive(riotAccount, "game:queue:acceptFail", strArrays);
                             }
                         }
                         else
                         {
                             return;
                         }
                     }
                 }
             //Label1;
             }
         }
         else
         {
             string type = gameNotification.Type;
             string str1 = type;
             if (type != null && (str1 == "PLAYER_QUIT" || str1 == "TEAM_REMOVED" || str1 == "PLAYER_REMOVED"))
             {
                 string summonerNameBySummonerId = null;
                 if (long.TryParse(gameNotification.MessageArgument, out num2))
                 {
                     summonerNameBySummonerId = await JsApiService.GetSummonerNameBySummonerId(account.RealmId, num2);
                 }
                 this.SetLeftQueue(account);
                 if (!string.IsNullOrEmpty(summonerNameBySummonerId))
                 {
                     JsApiService.PushIfActive(account, "game:queue:leave", summonerNameBySummonerId);
                 }
             }
         }
     }
     else if (account == JsApiService.RiotAccount)
     {
         flag = (searchingForMatchNotification.JoinedQueues == null ? false : searchingForMatchNotification.JoinedQueues.Count > 0);
         if (flag)
         {
             QueueInfo queueInfo = searchingForMatchNotification.JoinedQueues.First<QueueInfo>();
             this.SetEnteredQueue(account, queueInfo.QueueId);
         }
         List<QueueInfo> joinedQueues = searchingForMatchNotification.JoinedQueues;
         IEnumerable<int> queueId = 
             from x in joinedQueues
             select x.QueueId;
         objArray = (searchingForMatchNotification.PlayerJoinFailures != null ? searchingForMatchNotification.PlayerJoinFailures.Select<FailedJoinPlayer, object>(new Func<FailedJoinPlayer, object>(RiotJsTransformer.TransformFailedJoinPlayer)).ToArray<object>() : new object[0]);
         var variable4 = new { JoinedQueues = queueId, JoinFailures = objArray };
         JsApiService.PushIfActive(account, "game:queue:joinStatus", variable4);
     }
     else
     {
         account.InvokeAsync<object>("matchmakerService", "purgeFromQueues");
     }
 }
 private async Task ProcessData(RiotAccount account, object obj)
 {
   SearchingForMatchNotification queue = obj as SearchingForMatchNotification;
   if (queue != null)
   {
     if (account != JsApiService.RiotAccount)
     {
       account.InvokeAsync<object>("matchmakerService", "purgeFromQueues");
     }
     else
     {
       if ((queue.JoinedQueues == null ? 0 : (queue.JoinedQueues.Count > 0 ? 1 : 0)) != 0)
         this.SetEnteredQueue(account, Enumerable.First<QueueInfo>((IEnumerable<QueueInfo>) queue.JoinedQueues).QueueId);
       var fAnonymousType13 = new
       {
         JoinedQueues = Enumerable.Select<QueueInfo, int>((IEnumerable<QueueInfo>) queue.JoinedQueues, (Func<QueueInfo, int>) (x => x.QueueId)),
         JoinFailures = queue.PlayerJoinFailures != null ? Enumerable.ToArray<object>(Enumerable.Select<FailedJoinPlayer, object>((IEnumerable<FailedJoinPlayer>) queue.PlayerJoinFailures, new Func<FailedJoinPlayer, object>(RiotJsTransformer.TransformFailedJoinPlayer))) : new object[0]
       };
       JsApiService.PushIfActive(account, "game:queue:joinStatus", (object) fAnonymousType13);
     }
   }
   else
   {
     GameNotification gameNotification = obj as GameNotification;
     if (gameNotification != null)
     {
       switch (gameNotification.Type)
       {
         case "PLAYER_QUIT":
         case "TEAM_REMOVED":
         case "PLAYER_REMOVED":
           string summonerName = (string) null;
           long summonerId;
           if (long.TryParse(gameNotification.MessageArgument, out summonerId))
             summonerName = await JsApiService.GetSummonerNameBySummonerId(account.RealmId, summonerId);
           this.SetLeftQueue(account);
           if (!string.IsNullOrEmpty(summonerName))
           {
             JsApiService.PushIfActive(account, "game:queue:leave", (object) summonerName);
             break;
           }
           else
             break;
       }
     }
     else
     {
       GameDTO game = obj as GameDTO;
       if (game != null && game.StatusOfParticipants != null)
       {
         int[] statuses = Enumerable.ToArray<int>(Enumerable.Select<char, int>((IEnumerable<char>) game.StatusOfParticipants.ToCharArray(), (Func<char, int>) (x => int.Parse(x.ToString((IFormatProvider) CultureInfo.InvariantCulture)))));
         if (game.GameState == "START_REQUESTED" || game.GameState == "IN_PROGRESS")
           JsApiService.PushIfActive(account, "game:queue:done", (object) null);
         if (game.GameState != "JOINING_CHAMP_SELECT")
           JsApiService.PushIfActive(account, "game:queue:dropped", (object) null);
         switch (game.GameState)
         {
           case "JOINING_CHAMP_SELECT":
             JsApiService.PushIfActive(account, "game:queue:found", (object) QueueNotificationService.GetAcceptDeclineStatus(game.StatusOfParticipants));
             break;
           case "FAILED_TO_START":
           case "START_REQUESTED":
           case "IN_PROGRESS":
             this.SetLeftQueue(account);
             break;
           case "TERMINATED":
             int idx = 0;
             \u003C\u003Ef__AnonymousType14<PlayerParticipant, int>[] source1 = Enumerable.ToArray(Enumerable.Where(Enumerable.Select(Enumerable.Concat<IParticipant>((IEnumerable<IParticipant>) game.TeamOne, (IEnumerable<IParticipant>) game.TeamTwo), x => new
             {
               Participant = x as PlayerParticipant,
               Status = statuses[idx++]
             }), x => x.Participant != null));
             var fAnonymousType14 = Enumerable.FirstOrDefault(source1, x => x.Participant.SummonerId == (double) account.SummonerId);
             if (fAnonymousType14 != null)
             {
               List<\u003C\u003Ef__AnonymousType14<PlayerParticipant, int>> source2 = Enumerable.FirstOrDefault<List<\u003C\u003Ef__AnonymousType14<PlayerParticipant, int>>>(Enumerable.Select<IGrouping<double?, \u003C\u003Ef__AnonymousType14<PlayerParticipant, int>>, List<\u003C\u003Ef__AnonymousType14<PlayerParticipant, int>>>(Enumerable.GroupBy(Enumerable.Where(source1, x => x.Participant.TeamParticipantId.HasValue), x => x.Participant.TeamParticipantId), x => Enumerable.ToList(x)), g => Enumerable.Any(g, x => x.Participant.SummonerId == (double) account.SummonerId));
               if (source2 != null && Enumerable.Any(source2, x => x.Status != 1))
               {
                 this.SetLeftQueue(account);
                 JsApiService.PushIfActive(account, "game:queue:acceptFail", (object) Enumerable.Select(Enumerable.Where(source2, x => x.Status != 1), x => x.Participant.SummonerName));
                 break;
               }
               else if (fAnonymousType14.Status != 1)
               {
                 this.SetLeftQueue(account);
                 JsApiService.PushIfActive(account, "game:queue:acceptFail", (object) new string[1]
                 {
                   account.SummonerName
                 });
                 break;
               }
               else
                 break;
             }
             else
               break;
         }
       }
     }
   }
 }
 private async void UpdateTradersAsync(RiotAccount account)
 {
   try
   {
     PotentialTradersDTO traders = await account.InvokeAsync<PotentialTradersDTO>("lcdsChampionTradeService", "getPotentialTraders");
     if (account == JsApiService.RiotAccount)
     {
       IEnumerable<PlayerParticipant> players = account.Game.AllPlayers;
       JsApiService.Push("game:current:trade:targets", (object) Enumerable.Select(Enumerable.Select((IEnumerable<string>) traders.PotentialTraders, traderInternalName => new
       {
         traderInternalName = traderInternalName,
         player = Enumerable.First<PlayerParticipant>(players, (Func<PlayerParticipant, bool>) (player => player.SummonerInternalName == traderInternalName))
       }), param0 => param0.player.SummonerId));
     }
   }
   catch (Exception ex)
   {
   }
 }
 private void UpdateGame(RiotAccount account, GameDTO game)
 {
     GameDTO gameDTO;
     GameDTO gameDTO1 = JsApiService.RiotAccount.Game;
     if (GameNotificationService.IsGameTerminated(game))
     {
         gameDTO = null;
     }
     else
     {
         gameDTO = game;
     }
     GameDTO gameDTO2 = gameDTO;
     account.Game = gameDTO2;
     if (JsApiService.AccountBag.Active != account)
     {
         if (gameDTO2 != null)
         {
             account.InvokeAsync<object>("gameService", "quitGame");
         }
         return;
     }
     if (!GameNotificationService.IsChampSelect(gameDTO1) && GameNotificationService.IsChampSelect(gameDTO2))
     {
         object[] id = new object[] { game.Id, "CHAMP_SELECT_CLIENT" };
         account.InvokeAsync<object>("gameService", "setClientReceivedGameMessage", id);
     }
     if (!GameNotificationService.IsGameInProgressStrict(gameDTO1) && GameNotificationService.IsGameInProgressStrict(gameDTO2))
     {
         this.GetFullGameAsync(account);
     }
     this.NotifyGameChanged(account, game);
 }
 private void UpdateGame(RiotAccount account, GameDTO game)
 {
   GameDTO game1 = JsApiService.RiotAccount.Game;
   GameDTO game2 = GameNotificationService.IsGameTerminated(game) ? (GameDTO) null : game;
   account.Game = game2;
   if (JsApiService.AccountBag.Active != account)
   {
     if (game2 == null)
       return;
     account.InvokeAsync<object>("gameService", "quitGame");
   }
   else
   {
     if (!GameNotificationService.IsChampSelect(game1) && GameNotificationService.IsChampSelect(game2))
       account.InvokeAsync<object>("gameService", "setClientReceivedGameMessage", new object[2]
       {
         (object) game.Id,
         (object) "CHAMP_SELECT_CLIENT"
       });
     if (!GameNotificationService.IsGameInProgressStrict(game1) && GameNotificationService.IsGameInProgressStrict(game2))
       this.GetFullGameAsync(account);
     this.NotifyGameChanged(account, game);
   }
 }
 private async void UpdateTradersAsync(RiotAccount account)
 {
     try
     {
         PotentialTradersDTO potentialTradersDTO = await account.InvokeAsync<PotentialTradersDTO>("lcdsChampionTradeService", "getPotentialTraders");
         if (account == JsApiService.RiotAccount)
         {
             IEnumerable<PlayerParticipant> allPlayers = account.Game.AllPlayers;
             JsApiService.JsPush push = JsApiService.Push;
             var potentialTraders = 
                 from traderInternalName in potentialTradersDTO.PotentialTraders
                 select new { traderInternalName = traderInternalName, player = allPlayers.First<PlayerParticipant>((PlayerParticipant player) => player.SummonerInternalName == traderInternalName) };
             push("game:current:trade:targets", 
                 from TransparentIdentifier4a in potentialTraders
                 select TransparentIdentifier4a.player.SummonerId);
         }
         else
         {
             return;
         }
     }
     catch (Exception exception)
     {
     }
 }
 private async Task ImportMasteries(RiotAccount account)
 {
   Func<MasteryBookPageDTO, string> getId = (Func<MasteryBookPageDTO, string>) (page => page.PageId.ToString((IFormatProvider) CultureInfo.InvariantCulture));
   MasteryBookDTO book = await account.InvokeAsync<MasteryBookDTO>("masteryBookService", "getMasteryBook", (object) account.SummonerId);
   IEnumerable<MasterySetup> pages = Enumerable.Select(Enumerable.Select((IEnumerable<MasteryBookPageDTO>) Enumerable.OrderBy<MasteryBookPageDTO, double>((IEnumerable<MasteryBookPageDTO>) book.BookPages, (Func<MasteryBookPageDTO, double>) (page => page.PageId)), page => new
   {
     page = page,
     masteries = Enumerable.Select<TalentEntry, Mastery>((IEnumerable<TalentEntry>) page.TalentEntries, (Func<TalentEntry, Mastery>) (x => new Mastery()
     {
       Id = x.TalentId,
       Rank = x.Rank
     }))
   }), param0 => new MasterySetup()
   {
     Id = getId(param0.page),
     Name = param0.page.Name,
     Masteries = Enumerable.ToArray<Mastery>(param0.masteries)
   });
   MasteryBookPageDTO activePage = Enumerable.FirstOrDefault<MasteryBookPageDTO>((IEnumerable<MasteryBookPageDTO>) book.BookPages, (Func<MasteryBookPageDTO, bool>) (x => x.Current));
   string activeId = activePage != null ? getId(activePage) : (string) null;
   await JsApiService.Client.Invoke("storage.set", new object[2]
   {
     (object) "masteries",
     (object) new MasteryBook()
     {
       ActiveId = activeId,
       Setups = Enumerable.ToArray<MasterySetup>(pages)
     }
   });
 }