/// <summary> /// Loads the results for the current page. /// </summary> private void LoadScanResults() { Snapshot snapshot = SnapshotManager.GetSnapshot(Snapshot.SnapshotRetrievalMode.FromActiveSnapshot, this.ActiveType); IList <ScanResult> newAddresses = new List <ScanResult>(); if (snapshot != null) { UInt64 startIndex = Math.Min(ScanResultsViewModel.PageSize * this.CurrentPage, snapshot.ElementCount); UInt64 endIndex = Math.Min((ScanResultsViewModel.PageSize * this.CurrentPage) + ScanResultsViewModel.PageSize, snapshot.ElementCount); for (UInt64 index = startIndex; index < endIndex; index++) { SnapshotElementIndexer element = snapshot[index]; String label = element.GetElementLabel() != null?element.GetElementLabel().ToString() : String.Empty; Object currentValue = element.HasCurrentValue() ? element.LoadCurrentValue() : null; Object previousValue = element.HasPreviousValue() ? element.LoadPreviousValue() : null; String moduleName = String.Empty; UInt64 address = Query.Default.AddressToModule(element.BaseAddress, out moduleName); PointerItem pointerItem = new PointerItem(baseAddress: address, dataType: this.ActiveType, moduleName: moduleName, value: currentValue); newAddresses.Add(new ScanResult(new PointerItemView(pointerItem), previousValue, label)); } } this.Addresses = new FullyObservableCollection <ScanResult>(newAddresses); // Ensure results are visible this.IsVisible = true; this.IsSelected = true; this.IsActive = true; }
private void StartScan(int index, Int64 searchAddress, bool validatingProcess = false) { if (index > 0) { SnapshotManager.ClearSnapshots(); } ConstraintNode scanConstraints = new ScanConstraint(ScanConstraint.ConstraintType.Equal, searchAddress, dataType); TrackableTask <Snapshot> valueCollectorTask = ValueCollector.CollectValues( SnapshotManager.GetSnapshot(Snapshot.SnapshotRetrievalMode.FromActiveSnapshotOrPrefilter, dataType), TrackableTask.UniversalIdentifier); valueCollectorTask.OnCompletedEvent += ((completedValueCollectionTask) => { Snapshot snapshot = valueCollectorTask.Result; TrackableTask <Snapshot> scanTask = ManualScanner.Scan( snapshot, scanConstraints, TrackableTask.UniversalIdentifier); SnapshotManager.SaveSnapshot(scanTask.Result); snapshot = scanTask.Result; scannedAddresses.Add(new List <Int64>()); if (snapshot != null) { for (UInt64 i = 0; i < snapshot.ElementCount; ++i) { SnapshotElementIndexer element = snapshot[i]; Object currentValue = element.HasCurrentValue() ? element.LoadCurrentValue() : null; Object previousValue = element.HasPreviousValue() ? element.LoadPreviousValue() : null; String moduleName = String.Empty; UInt64 address = Query.Default.AddressToModule(element.BaseAddress, out moduleName); PointerItem pointerItem = new PointerItem(baseAddress: address, dataType: dataType, moduleName: moduleName, value: currentValue); pointerItem.ForceResolveAddress(); scannedAddresses[index].Add(Int64.Parse(pointerItem.AddressSpecifier, NumberStyles.HexNumber, CultureInfo.CurrentCulture)); } } int nextIteration = index + 1; if (nextIteration < addressesToFind.Count) { StartScan(nextIteration, addressesToFind[nextIteration], validatingProcess); } else { SearchLogic(validatingProcess); } }); }