Files
wjones 477045704e Enforce NuGet warnings as errors; refactor field access
Added "allWarningsAsErrors": true to NuGet config files across the solution to treat all warnings as errors, increasing build strictness. Updated project cache hashes and assembly info files to reflect these changes. Refactored C# code to use explicit `this.` for field and property assignments, improving clarity. Note: some method signatures were incorrectly changed to use `this.` as a prefix, which is invalid C# syntax and must be corrected before compiling. Binary files updated due to build changes.
2026-02-21 11:07:54 -05:00

75 lines
2.5 KiB
C#

// <copyright file="EpisodeExpression.cs" company="PlaceholderCompany">
// Copyright (c) PlaceholderCompany. All rights reserved.
// </copyright>
namespace Emby.Naming.Common
{
using System;
using System.Text.RegularExpressions;
/// <summary>
/// Regular expressions for parsing TV Episodes.
/// </summary>
public class EpisodeExpression
{
private string _expression;
private Regex? _regex;
/// <summary>
/// Initializes a new instance of the <see cref="EpisodeExpression"/> class.
/// </summary>
/// <param name="expression">Regular expressions.</param>
/// <param name="byDate">True if date is expected.</param>
public EpisodeExpression(string expression, bool byDate = false)
{
this._expression = expression;
this.IsByDate = byDate;
this.DateTimeFormats = Array.Empty<string>();
this.SupportsAbsoluteEpisodeNumbers = true;
}
/// <summary>
/// Gets or sets raw expressions string.
/// </summary>
public string Expression
{
get => this._expression;
set
{
this._expression = value;
this._regex = null;
}
}
/// <summary>
/// Gets or sets a value indicating whether gets or sets property indicating if date can be find in expression.
/// </summary>
public bool IsByDate { get; set; }
/// <summary>
/// Gets or sets a value indicating whether gets or sets property indicating if expression is optimistic.
/// </summary>
public bool IsOptimistic { get; set; }
/// <summary>
/// Gets or sets a value indicating whether gets or sets property indicating if expression is named.
/// </summary>
public bool IsNamed { get; set; }
/// <summary>
/// Gets or sets a value indicating whether gets or sets property indicating if expression supports episodes with absolute numbers.
/// </summary>
public bool SupportsAbsoluteEpisodeNumbers { get; set; }
/// <summary>
/// Gets or sets optional list of date formats used for date parsing.
/// </summary>
public string[] DateTimeFormats { get; set; }
/// <summary>
/// Gets a <see cref="Regex"/> expressions objects (creates it if null).
/// </summary>
public Regex Regex => this._regex ??= new Regex(this.Expression, RegexOptions.IgnoreCase | RegexOptions.Compiled);
}
}