477045704e
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.
82 lines
2.5 KiB
C#
82 lines
2.5 KiB
C#
// <copyright file="AudioBookFileInfo.cs" company="PlaceholderCompany">
|
|
// Copyright (c) PlaceholderCompany. All rights reserved.
|
|
// </copyright>
|
|
|
|
namespace Emby.Naming.AudioBook
|
|
{
|
|
using System;
|
|
|
|
/// <summary>
|
|
/// Represents a single video file.
|
|
/// </summary>
|
|
public class AudioBookFileInfo : IComparable<AudioBookFileInfo>
|
|
{
|
|
/// <summary>
|
|
/// Initializes a new instance of the <see cref="AudioBookFileInfo"/> class.
|
|
/// </summary>
|
|
/// <param name="path">Path to audiobook file.</param>
|
|
/// <param name="container">File type.</param>
|
|
/// <param name="partNumber">Number of part this file represents.</param>
|
|
/// <param name="chapterNumber">Number of chapter this file represents.</param>
|
|
public AudioBookFileInfo(string path, string container, int? partNumber = default, int? chapterNumber = default)
|
|
{
|
|
this.Path = path;
|
|
this.Container = container;
|
|
this.PartNumber = partNumber;
|
|
this.ChapterNumber = chapterNumber;
|
|
}
|
|
|
|
/// <summary>
|
|
/// Gets or sets the path.
|
|
/// </summary>
|
|
/// <value>The path.</value>
|
|
public string Path { get; set; }
|
|
|
|
/// <summary>
|
|
/// Gets or sets the container.
|
|
/// </summary>
|
|
/// <value>The container.</value>
|
|
public string Container { get; set; }
|
|
|
|
/// <summary>
|
|
/// Gets or sets the part number.
|
|
/// </summary>
|
|
/// <value>The part number.</value>
|
|
public int? PartNumber { get; set; }
|
|
|
|
/// <summary>
|
|
/// Gets or sets the chapter number.
|
|
/// </summary>
|
|
/// <value>The chapter number.</value>
|
|
public int? ChapterNumber { get; set; }
|
|
|
|
/// <inheritdoc />
|
|
public int CompareTo(AudioBookFileInfo? other)
|
|
{
|
|
if (ReferenceEquals(this, other))
|
|
{
|
|
return 0;
|
|
}
|
|
|
|
if (ReferenceEquals(null, other))
|
|
{
|
|
return 1;
|
|
}
|
|
|
|
var chapterNumberComparison = Nullable.Compare(this.ChapterNumber, other.ChapterNumber);
|
|
if (chapterNumberComparison != 0)
|
|
{
|
|
return chapterNumberComparison;
|
|
}
|
|
|
|
var partNumberComparison = Nullable.Compare(this.PartNumber, other.PartNumber);
|
|
if (partNumberComparison != 0)
|
|
{
|
|
return partNumberComparison;
|
|
}
|
|
|
|
return string.Compare(this.Path, other.Path, StringComparison.Ordinal);
|
|
}
|
|
}
|
|
}
|