public void UpdateChecks(string c)
 {
     updating = true;
     try
     {
         tStartingItemsString.Text    = c;
         CustomStartingItemListString = c;
         CustomStartingItemList.Clear();
         string[] v  = c.Split('-');
         int[]    vi = new int[ItemGroupCount];
         if (v.Length != vi.Length)
         {
             ExternalLabel = "Invalid custom starting item string";
             return;
         }
         for (int i = 0; i < ItemGroupCount; i++)
         {
             if (v[ItemGroupCount - 1 - i] != "")
             {
                 vi[i] = Convert.ToInt32(v[ItemGroupCount - 1 - i], 16);
             }
         }
         for (int i = 0; i < 32 * ItemGroupCount; i++)
         {
             int j = i / 32;
             int k = i % 32;
             if (((vi[j] >> k) & 1) > 0)
             {
                 if (i >= ItemUtils.AllLocations().Count())
                 {
                     throw new IndexOutOfRangeException();
                 }
                 CustomStartingItemList.Add(_startingItems[i]);
             }
         }
         foreach (ListViewItem l in lStartingItems.Items)
         {
             if (CustomStartingItemList.Contains((Item)l.Tag))
             {
                 l.Checked = true;
             }
             else
             {
                 l.Checked = false;
             }
         }
         ExternalLabel = $"{CustomStartingItemList.Count}/{_startingItems.Count} items selected";
     }
     catch
     {
         CustomStartingItemList.Clear();
         ExternalLabel = "Invalid custom starting item string";
     }
     finally
     {
         updating = false;
     }
 }
 private void PrintToListView()
 {
     foreach (var item in _startingItems)
     {
         if (!item.Name().ToLower().Contains(tSearchString.Text.ToLower()))
         {
             continue;
         }
         lStartingItems.Items.Add(new ListViewItem {
             Text = item.Name(), Tag = item, Checked = CustomStartingItemList.Contains(item)
         });
     }
 }
 private void lStartingItems_ItemChecked(object sender, ItemCheckedEventArgs e)
 {
     if (updating)
     {
         return;
     }
     updating = true;
     if (e.Item.Checked)
     {
         CustomStartingItemList.Add((Item)e.Item.Tag);
     }
     else
     {
         CustomStartingItemList.Remove((Item)e.Item.Tag);
     }
     UpdateString(CustomStartingItemList);
     updating = false;
 }