private void bwNewScan_DoWork(object sender, DoWorkEventArgs e) { //scan_worker_DoWorker(sender, e, true); long processed_memory_len = 0; ulong total_memory_size = processManager.MappedSectionList.TotalMemorySize + 1; string value_0 = txtValue.Text; string value_1 = txtValue2.Text; bwNewScan.ReportProgress(0); for (int section_idx = 0; section_idx < processManager.MappedSectionList.Count; ++section_idx) { if (bwNewScan.CancellationPending) { break; } MappedSection mappedSection = processManager.MappedSectionList[section_idx]; mappedSection.UpdateResultList(processManager, memoryHelper, value_0, value_1, cbHex.Checked, true); if (mappedSection.Check) { processed_memory_len += mappedSection.Length; } bwNewScan.ReportProgress((int)(((float)processed_memory_len / total_memory_size) * 80)); } bwNewScan.ReportProgress(80); update_result_list_view(bwNewScan, false, 80, 0.2f); }
private void next_scan_worker_DoWork(object sender, DoWorkEventArgs e) { long processed_memory_len = 0; ulong total_memory_size = processManager.MappedSectionList.TotalMemorySize + 1; string value_0 = value_box.Text; string value_1 = value_1_box.Text; next_scan_worker.ReportProgress(0); for (int section_idx = 0; section_idx < processManager.MappedSectionList.Count; ++section_idx) { if (next_scan_worker.CancellationPending) break; MappedSection mappedSection = processManager.MappedSectionList[section_idx]; mappedSection.UpdateResultList(processManager, memoryHelper, value_0, value_1, hex_box.Checked, false); if (mappedSection.Check) processed_memory_len += mappedSection.Length; next_scan_worker.ReportProgress((int)(((float)processed_memory_len / total_memory_size) * 80)); } next_scan_worker.ReportProgress(80); update_result_list_view(next_scan_worker, false, 80, 0.2f); }
void new_scan_thread(string value_0, string value_1, int thread_id, int num_threads, ref long processed_memory_len, ulong total_memory_size) { for (int section_idx = 0; section_idx < processManager.MappedSectionList.Count; ++section_idx) { // Split work up between threads. if (section_idx % num_threads != thread_id) { continue; } if (new_scan_worker.CancellationPending) { break; } MappedSection mappedSection = processManager.MappedSectionList[section_idx]; mappedSection.UpdateResultList(processManager, memoryHelper, value_0, value_1, hex_box.Checked, true, thread_id); if (mappedSection.Check) { processed_memory_len += mappedSection.Length; } new_scan_worker.ReportProgress((int)(((float)processed_memory_len / total_memory_size) * 80)); } }