/// <summary> /// Returns the memory regions associated with the current snapshot. If none exist, a query will be done. Will not read any memory. /// </summary> /// <returns>The current active snapshot of memory in the target process.</returns> private static Snapshot GetActiveSnapshotCreateIfNone(DataType dataType) { lock (SnapshotManager.AccessLock) { if (SnapshotManager.Snapshots.Count == 0 || SnapshotManager.Snapshots.Peek() == null || SnapshotManager.Snapshots.Peek().ElementCount == 0) { Snapshot snapshot = Prefilter.GetInstance().GetPrefilteredSnapshot(dataType); snapshot.Alignment = ScanSettings.Default.Alignment; return(snapshot); } // Return the snapshot return(SnapshotManager.Snapshots.Peek()); } }
/// <summary> /// Returns the memory regions associated with the current snapshot. If none exist, a query will be done. Will not read any memory. /// </summary> /// <returns>The current active snapshot of memory in the target process.</returns> private Snapshot GetActiveSnapshotCreateIfNone() { lock (this.AccessLock) { if (this.Snapshots.Count == 0 || this.Snapshots.Peek() == null || this.Snapshots.Peek().ElementCount == 0) { Snapshot snapshot = Prefilter.GetInstance().GetPrefilteredSnapshot(); snapshot.Alignment = SettingsViewModel.GetInstance().Alignment; snapshot.ElementDataType = ScanResultsViewModel.GetInstance().ActiveType; return(snapshot); } // Return the snapshot return(this.Snapshots.Peek()); } }
/// <summary> /// Returns the memory regions associated with the current snapshot. If none exist, a query will be done. /// </summary> /// <param name="createIfNone">Creates a snapshot if none exists.</param> /// <returns>The current active snapshot of memory in the target process.</returns> public Snapshot GetActiveSnapshot(Boolean createIfNone = true) { lock (this.AccessLock) { // Take a snapshot if there are none, or the current one is empty if (this.Snapshots.Count == 0 || this.Snapshots.Peek() == null || this.Snapshots.Peek().ElementCount == 0) { if (createIfNone) { Snapshot snapshot = Prefilter.GetInstance().GetPrefilteredSnapshot(); snapshot.UpdateSettings(ScanResultsViewModel.GetInstance().ActiveType, SettingsViewModel.GetInstance().Alignment); return(snapshot); } else { return(null); } } // Return the snapshot return(this.Snapshots.Peek()); } }