Exemple #1
0
        private void BtnSearchAll_Click(object sender, EventArgs e)
        {
            var listOfItems = new List <int>();

            for (int i = 0; i <= LstUnhashed.Items.Count - 1; i++)
            {
                if (ItemFound(i))
                {
                    listOfItems.Add(i);
                }
            }

            if (listOfItems.Any())
            {
                LstUnhashed.ClearSelected();

                LstUnhashed.BeginUpdate();

                foreach (var item in listOfItems)
                {
                    LstUnhashed.SetSelected(item, true);
                }

                LstUnhashed.EndUpdate();
            }
            LstUnhashed.Focus();
        }
Exemple #2
0
 private void BtnSearchPrevious_Click(object sender, EventArgs e)
 {
     for (int i = LstUnhashed.SelectedIndex - 1; i >= 0; i--)
     {
         if (ItemFound(i))
         {
             LstUnhashed.ClearSelected();
             LstUnhashed.SetSelected(i, true);
             LstUnhashed.Focus();
             break;
         }
     }
 }
Exemple #3
0
 private void BtnSearchNext_Click(object sender, EventArgs e)
 {
     for (int i = LstUnhashed.SelectedIndex + 1; i <= LstUnhashed.Items.Count - 1; i++)
     {
         if (ItemFound(i))
         {
             LstUnhashed.ClearSelected();
             LstUnhashed.SetSelected(i, true);
             LstUnhashed.Focus();
             break;
         }
     }
 }
Exemple #4
0
        private void ChangedListBoxDataSource()
        {
            LstUnhashed.BeginUpdate();

            var listBoxDataSource = ListBoxDataSource.AsEnumerable();

            if (ChkReverseHashes.Checked)
            {
                listBoxDataSource = listBoxDataSource
                                    .Select(c => new RaiderResult {
                    Hash = Hashes.Reverse(c.Hash), IsKnown = c.IsKnown, Value = c.Value
                });
            }

            switch (OrderOption)
            {
            case OrderOptions.HashAsc:
                listBoxDataSource = listBoxDataSource
                                    .OrderBy(c => c.Hash);
                break;

            case OrderOptions.HashDesc:
                listBoxDataSource = listBoxDataSource
                                    .OrderByDescending(c => c.Hash);
                break;

            case OrderOptions.StringAsc:
                listBoxDataSource = listBoxDataSource
                                    .OrderBy(c => c.Value);
                break;

            case OrderOptions.StringDesc:
                listBoxDataSource = listBoxDataSource
                                    .OrderByDescending(c => c.Value);
                break;

            default:
                break;
            }

            if (ChkIgnoreRepeatedStrings.Checked)
            {
                listBoxDataSource = listBoxDataSource
                                    .GroupBy(c => c.Value)
                                    .Select(c => c.First());
            }

            if (ChkIgnoreRepeatedHashes.Checked)
            {
                listBoxDataSource = listBoxDataSource
                                    .GroupBy(c => c.Hash)
                                    .Select(c => new RaiderResult {
                    Hash = c.Key, IsKnown = c.Any(d => d.IsKnown), Value = string.Join(" / ", c.Select(d => d.Value).Distinct())
                });
            }

            var currentSelectedItem = LstUnhashed.SelectedIndex;

            var format = TxtExportFormat.Text;

            var knownHashes   = 0;
            var unknownHashes = 0;

            var dataSource = new List <string>();

            foreach (var item in listBoxDataSource)
            {
                if (item.IsKnown)
                {
                    knownHashes++;
                }
                else
                {
                    unknownHashes++;
                }

                dataSource.Add(format.Replace("(HASH)", item.Hash.ToString("X8")).Replace("(STRING)", item.Value));
            }

            var listBoxDataSourceCount = knownHashes + unknownHashes;

            if (listBoxDataSourceCount <= currentSelectedItem && listBoxDataSourceCount > 0)
            {
                currentSelectedItem = listBoxDataSourceCount - 1;
            }
            else if (listBoxDataSourceCount == 0)
            {
                currentSelectedItem = -1;
            }

            LblKnownHashes.Text    = knownHashes.ToString();
            LblUnknownHashes.Text  = unknownHashes.ToString();
            LblTotalHashes.Text    = listBoxDataSourceCount.ToString();
            LstUnhashed.DataSource = dataSource;
            LstUnhashed.ClearSelected();
            LstUnhashed.SelectedIndex = currentSelectedItem;

            LstUnhashed.EndUpdate();
        }