private static MasteryBookPageDTO ToMasteryBookPage(MasterySetup setup)
 {
     IEnumerable<TalentEntry> masteries =
         from x in (IEnumerable<Mastery>)setup.Masteries
         select new TalentEntry()
         {
             TalentId = x.Id,
             Rank = x.Rank
         };
     MasteryBookPageDTO masteryBookPageDTO = new MasteryBookPageDTO()
     {
         Name = setup.Name,
         TalentEntries = masteries.ToList<TalentEntry>(),
         Current = false
     };
     return masteryBookPageDTO;
 }
 private static MasteryBookPageDTO ToMasteryBookPage(MasterySetup setup)
 {
   IEnumerable<TalentEntry> source = Enumerable.Select<Mastery, TalentEntry>((IEnumerable<Mastery>) setup.Masteries, (Func<Mastery, TalentEntry>) (x => new TalentEntry()
   {
     TalentId = x.Id,
     Rank = x.Rank
   }));
   MasteryBookPageDTO masteryBookPageDto = new MasteryBookPageDTO();
   masteryBookPageDto.Name = setup.Name;
   masteryBookPageDto.TalentEntries = Enumerable.ToList<TalentEntry>(source);
   masteryBookPageDto.Current = false;
   return masteryBookPageDto;
 }
 public static async Task SetActiveMasterySetup(MasterySetup setup)
 {
     bool flag;
     JsApiService.Client.Invoke("storage.masteries.active.set", setup.Id);
     LittleClient client = JsApiService.Client;
     object[] objArray = new object[] { "masteries" };
     MasteryBook id = await client.InvokeCached<MasteryBook>("storage.get", objArray);
     IEnumerable<MasterySetup> masterySetups = id.Setups.Take<MasterySetup>(19);
     MasterySetup[] masterySetupArray = new MasterySetup[] { setup };
     MasterySetup[] array = masterySetups.Concat<MasterySetup>(masterySetupArray).ToArray<MasterySetup>();
     for (int i = 0; i < (int)array.Length; i++)
     {
         array[i].Id = i.ToString(CultureInfo.InvariantCulture);
     }
     setup.Name = "[active]";
     id.Setups = array;
     id.ActiveId = setup.Id;
     InventoryHelper.SaveRiotMasteryBook(id);
     RiotAccount[] all = JsApiService.AccountBag.GetAll();
     for (int j = 0; j < (int)all.Length; j++)
     {
         InventoryHelper.ClearMasteryCache(all[j]);
     }
 }
 public static async Task SetActiveMasterySetup(MasterySetup setup)
 {
   JsApiService.Client.Invoke("storage.masteries.active.set", (object) setup.Id);
   MasteryBook book = await JsApiService.Client.InvokeCached<MasteryBook>("storage.get", new object[1]
   {
     (object) "masteries"
   });
   IEnumerable<MasterySetup> normalSetups = Enumerable.Take<MasterySetup>((IEnumerable<MasterySetup>) book.Setups, 19);
   MasterySetup[] activateSetups = new MasterySetup[1]
   {
     setup
   };
   MasterySetup[] setups = Enumerable.ToArray<MasterySetup>(Enumerable.Concat<MasterySetup>(normalSetups, (IEnumerable<MasterySetup>) activateSetups));
   for (int index = 0; index < setups.Length; ++index)
     setups[index].Id = index.ToString((IFormatProvider) CultureInfo.InvariantCulture);
   setup.Name = "[active]";
   book.Setups = setups;
   book.ActiveId = setup.Id;
   InventoryHelper.SaveRiotMasteryBook(book);
   foreach (RiotAccount account in JsApiService.AccountBag.GetAll())
     InventoryHelper.ClearMasteryCache(account);
 }