using System; using System.Runtime.Serialization; namespace ConfusedPolarBear.Plugin.IntroSkipper.Data; /// /// Represents an item to ignore. /// [DataContract(Namespace = "http://schemas.datacontract.org/2004/07/ConfusedPolarBear.Plugin.IntroSkipper")] public class IgnoreListItem { /// /// Initializes a new instance of the class. /// public IgnoreListItem() { } /// /// Initializes a new instance of the class. /// /// The season id. public IgnoreListItem(Guid seasonId) { SeasonId = seasonId; } /// /// Initializes a new instance of the class. /// /// The item to copy. public IgnoreListItem(IgnoreListItem item) { SeasonId = item.SeasonId; IgnoreIntro = item.IgnoreIntro; IgnoreCredits = item.IgnoreCredits; } /// /// Gets or sets the season id. /// [DataMember] public Guid SeasonId { get; set; } = Guid.Empty; /// /// Gets or sets a value indicating whether to ignore the intro. /// [DataMember] public bool IgnoreIntro { get; set; } = false; /// /// Gets or sets a value indicating whether to ignore the credits. /// [DataMember] public bool IgnoreCredits { get; set; } = false; /// /// Toggles the provided mode to the provided value. /// /// Analysis mode. /// Value to set. public void Toggle(AnalysisMode mode, bool value) { switch (mode) { case AnalysisMode.Introduction: IgnoreIntro = value; break; case AnalysisMode.Credits: IgnoreCredits = value; break; } } /// /// Checks if the provided mode is ignored. /// /// Analysis mode. /// True if ignored, false otherwise. public bool IsIgnored(AnalysisMode mode) { return mode switch { AnalysisMode.Introduction => IgnoreIntro, AnalysisMode.Credits => IgnoreCredits, _ => false, }; } }