/// <summary> /// Gets a snapshot based on the provided mode. Will not read any memory. /// </summary> /// <param name="snapshotCreationMode">The method of snapshot retrieval.</param> /// <returns>The collected snapshot.</returns> public Snapshot GetSnapshot(SnapshotRetrievalMode snapshotCreationMode) { switch (snapshotCreationMode) { case SnapshotRetrievalMode.FromActiveSnapshot: return(this.GetActiveSnapshot()); case SnapshotRetrievalMode.FromActiveSnapshotOrPrefilter: return(this.GetActiveSnapshotCreateIfNone()); case SnapshotRetrievalMode.FromSettings: return(this.CreateSnapshotFromSettings()); case SnapshotRetrievalMode.FromUserModeMemory: return(this.CreateSnapshotFromUsermodeMemory()); case SnapshotRetrievalMode.FromModules: return(this.CreateSnapshotFromModules()); case SnapshotRetrievalMode.FromHeap: return(this.CreateSnapshotFromHeaps()); case SnapshotRetrievalMode.FromStack: throw new NotImplementedException(); default: OutputViewModel.GetInstance().Log(OutputViewModel.LogLevel.Error, "Unknown snapshot retrieval mode"); return(null); } }
/// <summary> /// Gets a snapshot based on the provided mode. Will not read any memory. /// </summary> /// <param name="snapshotCreationMode">The method of snapshot retrieval.</param> /// <returns>The collected snapshot.</returns> public static Snapshot GetSnapshot(Process process, SnapshotRetrievalMode snapshotCreationMode) { switch (snapshotCreationMode) { case SnapshotRetrievalMode.FromSettings: return(SnapshotQuery.CreateSnapshotFromSettings(process)); case SnapshotRetrievalMode.FromUserModeMemory: return(SnapshotQuery.CreateSnapshotFromUsermodeMemory(process)); case SnapshotRetrievalMode.FromModules: return(SnapshotQuery.CreateSnapshotFromModules(process)); case SnapshotRetrievalMode.FromHeaps: return(SnapshotQuery.CreateSnapshotFromHeaps(process)); case SnapshotRetrievalMode.FromStack: throw new NotImplementedException(); default: Logger.Log(LogLevel.Error, "Unknown snapshot retrieval mode"); return(null); } }