theMasterpc d867ede882
add ignore list (#281)
* add block list

* better block list system.
todo:
-change the name blocklist.
-fixing small bugs.
-maybe moving from Dictionary to List<BlockListItem>.

* - moving from ConcurrentDictionary to List<BlackListItem>, for better xml file.
- changing block to black.
- small fixes.

todo:
- maybe changing the blacklist naming.

* moving to ignorelist.
moving the blacklisting to Manage Fingerprints.
changing the object BlackListItem.

todo:
- moving to the naming "ignorelist", instead of "blacklist".
- adding "save for series" button.
- improving the ui of the blacklist section".
- fixing some more bugs.
- changing the "Manage Fingerprints" to "Manage Timestamps & Fingerprints".

* adding the option to apply ignorelist changes into a series.
moving to ignorelist naming.
changing "Manage Fingerprints" to "Manage Timestamps & Fingerprints".
improving the ui of the ignorelist editor

* small fixes

* fix some bugs. improving the ignore feature

* fix some stuff

* Refactor CSS styles for ignore list checkboxes

* small fixes

* small changes

* small changes

* big changes

* small fixes

* Refactor IgnoreListItem to use SeasonId instead of Id

* Refactor IgnoreListItem to use SeasonId instead of Id.

changes to the ExecuteAsync function and to its documentation
2024-09-20 07:18:04 -04:00

90 lines
2.4 KiB
C#

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