/* 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; namespace dnSpy.Contracts.Debugger.Breakpoints.Modules { /// /// Module breakpoint settings /// public struct DbgModuleBreakpointSettings : IEquatable { /// /// true if the breakpoint is enabled /// public bool IsEnabled { get; set; } /// /// Name of module (case insensitive) or null/empty string if any name. Wildcards can be used /// public string? ModuleName { get; set; } /// /// true if dynamic, false if not dynamic, and null if any value /// public bool? IsDynamic { get; set; } /// /// true if in-memory, false if not in-memory, and null if any value /// public bool? IsInMemory { get; set; } /// /// true if it was loaded, false if it was unloaded, and null if any value /// public bool? IsLoaded { get; set; } /// /// Module load order or null if any value /// public int? Order { get; set; } /// /// App domain name (case insensitive) or null/empty string if any name. Wildcards can be used /// public string? AppDomainName { get; set; } /// /// Process name (case insensitive) or null/empty string if any name. Wildcards can be used /// public string? ProcessName { get; set; } #pragma warning disable CS1591 // Missing XML comment for publicly visible type or member public static bool operator ==(DbgModuleBreakpointSettings left, DbgModuleBreakpointSettings right) => left.Equals(right); public static bool operator !=(DbgModuleBreakpointSettings left, DbgModuleBreakpointSettings right) => !left.Equals(right); #pragma warning restore CS1591 // Missing XML comment for publicly visible type or member /// /// Compares this instance to /// /// Other instance /// public bool Equals(DbgModuleBreakpointSettings other) => IsEnabled == other.IsEnabled && ModuleName == other.ModuleName && IsDynamic == other.IsDynamic && IsInMemory == other.IsInMemory && IsLoaded == other.IsLoaded && Order == other.Order && AppDomainName == other.AppDomainName && ProcessName == other.ProcessName; /// /// Compares this instance to /// /// Other instance /// public override bool Equals(object? obj) => obj is DbgModuleBreakpointSettings other && Equals(other); /// /// Gets the hash code /// /// public override int GetHashCode() => (IsEnabled ? 1 : 0) ^ (ModuleName ?? string.Empty).GetHashCode() ^ ((IsDynamic ?? false) ? 2 : 0) ^ ((IsInMemory ?? false) ? 4 : 0) ^ ((IsLoaded ?? false) ? 8 : 0) ^ (Order ?? 0) ^ (AppDomainName ?? string.Empty).GetHashCode() ^ (ProcessName ?? string.Empty).GetHashCode(); } }