/* Copyright (C) 2014-2019 de4dot@gmail.com This file is part of dnSpy dnSpy is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. dnSpy is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with dnSpy. If not, see . */ using System; using System.Collections.ObjectModel; namespace dnSpy.Contracts.Debugger.Breakpoints.Code { /// /// Breakpoint hit count service /// public abstract class DbgCodeBreakpointHitCountService { /// /// Raised when the hit count is updated /// public abstract event EventHandler? HitCountChanged; /// /// Gets the hit count or null if we're not debugging /// /// Breakpoint /// public abstract int? GetHitCount(DbgCodeBreakpoint breakpoint); /// /// Resets the hit count /// /// Breakpoint public void Reset(DbgCodeBreakpoint breakpoint) => Reset(new[] { breakpoint ?? throw new ArgumentNullException(nameof(breakpoint)) }); /// /// Resets the hit count /// /// Breakpoints public abstract void Reset(DbgCodeBreakpoint[] breakpoints); } /// /// Breakpoint and hit count /// public readonly struct DbgCodeBreakpointAndHitCount { /// /// Gets the breakpoint /// public DbgCodeBreakpoint Breakpoint { get; } /// /// Gets the current hit count. It's null if we're not debugging /// public int? HitCount { get; } /// /// Constructor /// /// Breakpoint /// Current hit count or null if we're not debugging public DbgCodeBreakpointAndHitCount(DbgCodeBreakpoint breakpoint, int? hitCount) { Breakpoint = breakpoint ?? throw new ArgumentNullException(nameof(breakpoint)); HitCount = hitCount; } } /// /// event args /// public readonly struct DbgHitCountChangedEventArgs { /// /// Gets breakpoints and hit counts /// public ReadOnlyCollection Breakpoints { get; } /// /// Constructor /// /// Breakpoints and hit counts public DbgHitCountChangedEventArgs(ReadOnlyCollection breakpoints) => Breakpoints = breakpoints ?? throw new ArgumentNullException(nameof(breakpoints)); } }