static InventoryHelper()
 {
     InventoryHelper.Instance = new InventoryHelper();
 }
 private static SpellBookPageDTO ToSpellBookPage(InventoryHelper.RuneSetup setup)
 {
     List<SlotEntry> slotEntries = new List<SlotEntry>();
     IGrouping<RuneType, InventoryHelper.Rune>[] array = (
         from x in (IEnumerable<InventoryHelper.Rune>)setup.Runes
         group x by InventoryHelper.GetRuneType(x.Id) into x
         orderby x.Key
         select x).ToArray<IGrouping<RuneType, InventoryHelper.Rune>>();
     for (int i = 0; i < (int)array.Length; i++)
     {
         IGrouping<RuneType, InventoryHelper.Rune> runeTypes = array[i];
         RuneType key = runeTypes.Key;
         InventoryHelper.Rune[] runeArray = runeTypes.ToArray<InventoryHelper.Rune>();
         int num = (byte)key * 9 + (byte)RuneType.Yellow;
         for (int j = 0; j < (int)runeArray.Length; j++)
         {
             InventoryHelper.Rune rune = runeArray[j];
             for (int k = 0; k < rune.Count; k++)
             {
                 SlotEntry slotEntry = new SlotEntry()
                 {
                     RuneId = rune.Id,
                     RuneSlotId = num
                 };
                 slotEntries.Add(slotEntry);
                 num++;
             }
         }
     }
     SpellBookPageDTO spellBookPageDTO = new SpellBookPageDTO()
     {
         PageId = setup.Id,
         Name = setup.Name,
         SlotEntries = slotEntries.ToList<SlotEntry>(),
         Current = true
     };
     return spellBookPageDTO;
 }
 private static SpellBookPageDTO ToSpellBookPage(InventoryHelper.RuneSetup setup)
 {
   List<SlotEntry> list = new List<SlotEntry>();
   foreach (IGrouping<RuneType, InventoryHelper.Rune> grouping in Enumerable.ToArray<IGrouping<RuneType, InventoryHelper.Rune>>((IEnumerable<IGrouping<RuneType, InventoryHelper.Rune>>) Enumerable.OrderBy<IGrouping<RuneType, InventoryHelper.Rune>, RuneType>(Enumerable.GroupBy<InventoryHelper.Rune, RuneType>((IEnumerable<InventoryHelper.Rune>) setup.Runes, (Func<InventoryHelper.Rune, RuneType>) (x => InventoryHelper.GetRuneType(x.Id))), (Func<IGrouping<RuneType, InventoryHelper.Rune>, RuneType>) (x => x.Key))))
   {
     RuneType key = grouping.Key;
     InventoryHelper.Rune[] runeArray = Enumerable.ToArray<InventoryHelper.Rune>((IEnumerable<InventoryHelper.Rune>) grouping);
     int num = (int) key * 9 + 1;
     for (int index1 = 0; index1 < runeArray.Length; ++index1)
     {
       InventoryHelper.Rune rune = runeArray[index1];
       for (int index2 = 0; index2 < rune.Count; ++index2)
       {
         list.Add(new SlotEntry()
         {
           RuneId = rune.Id,
           RuneSlotId = num
         });
         ++num;
       }
     }
   }
   SpellBookPageDTO spellBookPageDto = new SpellBookPageDTO();
   spellBookPageDto.PageId = setup.Id;
   spellBookPageDto.Name = setup.Name;
   spellBookPageDto.SlotEntries = Enumerable.ToList<SlotEntry>((IEnumerable<SlotEntry>) list);
   spellBookPageDto.Current = true;
   return spellBookPageDto;
 }