async Task Scan() { addressListView.Items.Clear(); var count = 0; var stopwatch = Stopwatch.StartNew(); Invoke((MethodInvoker)(() => { readyToolStripStatusLabel.Text = ScanState.Scanning.ToString(count); Text = Title + " (検索中...)"; })); var items = new Dictionary <ulong, ListViewItem>(); var query = GetQuery(); if (query == null) { return; } Watches = await MemoryScanner.FindMatches(query, exclusions : Exclusions, handler : (address, found) => { BeginInvoke((MethodInvoker)(() => { var c = Interlocked.Increment(ref count); Text = $"{Title} (検索中: {c})"; readyToolStripStatusLabel.Text = ScanState.Scanning.ToString(c); items[address] = addressListView.Items.Add(new ListViewItem(new[] { address.ToString("X8"), "", found.ToString() })); })); }); stopwatch.Stop(); Invoke((MethodInvoker)(() => { Text = $"{Title} ({Watches.Count})"; readyToolStripStatusLabel.Text = ScanState.Complete.ToString(Watches.Count) + " (" + stopwatch.ElapsedMilliseconds + " ms)"; })); Cancellation?.Cancel(); Cancellation = new CancellationTokenSource(); await MemoryScanner.Watch(Watches, 500, Cancellation.Token, t : query, handler : (k, v) => { Invoke((MethodInvoker)(() => { if (items.ContainsKey(k)) { items[k].SubItems[1].Text = v.ToString(); } else { items[k] = addressListView.Items.Add(new ListViewItem(new[] { k.ToString("X8"), v.ToString(), v.ToString() })); } })); }); }