diff options
| author | Fernando Fernández <ferferga.fer@gmail.com> | 2020-11-19 23:18:25 +0100 |
|---|---|---|
| committer | Fernando Fernández <ferferga.fer@gmail.com> | 2020-11-19 23:18:25 +0100 |
| commit | e21e00cad514159e22ddf99f26a4f8c13e16cc52 (patch) | |
| tree | 993002ddcb4815660de00392a7498b9dbbfa973e /Emby.Naming/Common/EpisodeExpression.cs | |
| parent | 2deda0437d32016a0c73158840c9c04bc729b261 (diff) | |
| parent | b5ff91c28159695858f24f768b5f6b5b33c0680c (diff) | |
Merge remote-tracking branch 'upstream/master' into no-scaling
Diffstat (limited to 'Emby.Naming/Common/EpisodeExpression.cs')
| -rw-r--r-- | Emby.Naming/Common/EpisodeExpression.cs | 42 |
1 files changed, 32 insertions, 10 deletions
diff --git a/Emby.Naming/Common/EpisodeExpression.cs b/Emby.Naming/Common/EpisodeExpression.cs index ed6ba8881..19d3c7aab 100644 --- a/Emby.Naming/Common/EpisodeExpression.cs +++ b/Emby.Naming/Common/EpisodeExpression.cs @@ -1,28 +1,32 @@ -#pragma warning disable CS1591 - using System; using System.Text.RegularExpressions; namespace Emby.Naming.Common { + /// <summary> + /// Regular expressions for parsing TV Episodes. + /// </summary> public class EpisodeExpression { private string _expression; - private Regex _regex; + private Regex? _regex; - public EpisodeExpression(string expression, bool byDate) + /// <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) { - Expression = expression; + _expression = expression; IsByDate = byDate; DateTimeFormats = Array.Empty<string>(); SupportsAbsoluteEpisodeNumbers = true; } - public EpisodeExpression(string expression) - : this(expression, false) - { - } - + /// <summary> + /// Gets or sets raw expressions string. + /// </summary> public string Expression { get => _expression; @@ -33,16 +37,34 @@ namespace Emby.Naming.Common } } + /// <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 => _regex ??= new Regex(Expression, RegexOptions.IgnoreCase | RegexOptions.Compiled); } } |
