Exemple #1
0
        private void update_result_list_view(BackgroundWorker worker, string value_type, bool refresh, int start, float percent)
        {
            worker.ReportProgress(start, 0);

            List <ListViewItem> listViewItems          = new List <ListViewItem>();
            HashSet <int>       mappedSectionCheckeSet = new HashSet <int>();

            ulong totalAddressCount = processManager.TotalAddressCount();
            ulong curAddressCount   = 0;

            for (int idx = 0; idx < processManager.MappedSectionList.Count; ++idx)
            {
                MappedSection mapped_section = processManager.MappedSectionList[idx];
                AddressList   address_list   = mapped_section.AddressList;
                if (address_list.Count > 0)
                {
                    mappedSectionCheckeSet.Add(idx);
                }
                for (int i = 0; i < address_list.Count; i++)
                {
                    if (curAddressCount >= 0x10000)
                    {
                        break;
                    }

                    curAddressCount++;
                    ListViewItem lvi = new ListViewItem();

                    lvi.Text = String.Format("{0:X}", address_list[i].AddressOffset + mapped_section.Start);

                    byte[] match_bytes = BitConverter.GetBytes(address_list[i].MemoryValue);

                    if (refresh)
                    {
                        match_bytes = memoryHelper.GetBytesByType(address_list[i].AddressOffset + mapped_section.Start);
                        Address address_tmp = new Address();
                        address_tmp.AddressOffset = address_list[i].AddressOffset;
                        address_tmp.MemoryValue   = memoryHelper.BytesToUlong(match_bytes);
                        address_list[i]           = address_tmp;
                    }

                    string value_output = memoryHelper.BytesToString(match_bytes);

                    lvi.SubItems.Add(value_type);
                    lvi.SubItems.Add(value_output);
                    lvi.SubItems.Add(MemoryHelper.bytes_to_hex_string(match_bytes));
                    lvi.SubItems.Add(processManager.GetSectionName(idx));

                    listViewItems.Add(lvi);

                    if (i % 500 == 0)
                    {
                        worker.ReportProgress(start + (int)(i / (float)curAddressCount * 100 * percent));
                    }
                }
            }

            WorkerReturn workerReturn = new WorkerReturn();

            workerReturn.ListViewItems          = listViewItems;
            workerReturn.MappedSectionCheckeSet = mappedSectionCheckeSet;
            workerReturn.Results = totalAddressCount;

            worker.ReportProgress(start + (int)(100 * percent), workerReturn);
        }