CodingStyle: Splitting multi-class files into multiple files

This commit is contained in:
Zoe Roux 2021-09-05 11:15:08 +02:00
parent fd122592f4
commit af285a7c6c
11 changed files with 210 additions and 159 deletions

View File

@ -6,7 +6,9 @@ namespace Kyoo.Abstractions.Controllers
public interface ITranscoder
{
Task<Track[]> ExtractInfos(Episode episode, bool reextract);
Task<string> Transmux(Episode episode);
Task<string> Transcode(Episode episode);
}
}

View File

@ -1,4 +1,5 @@
using System;
using System.Diagnostics.CodeAnalysis;
using Microsoft.Extensions.DependencyInjection;
namespace Kyoo.Abstractions.Controllers
@ -7,14 +8,44 @@ namespace Kyoo.Abstractions.Controllers
/// A list of constant priorities used for <see cref="IStartupAction"/>'s <see cref="IStartupAction.Priority"/>.
/// It also contains helper methods for creating new <see cref="StartupAction"/>.
/// </summary>
[SuppressMessage("StyleCop.CSharp.DocumentationRules", "SA1649:File name should match first type name",
Justification = "StartupAction is nested and the name SA is short to improve readability in plugin's startup.")]
public static class SA
{
/// <summary>
/// The highest predefined priority existing for <see cref="StartupAction"/>.
/// </summary>
public const int Before = 5000;
/// <summary>
/// Items defining routing (see IApplicationBuilder.UseRouting use this priority.
/// </summary>
public const int Routing = 4000;
/// <summary>
/// Actions defining new static files router use this priority.
/// </summary>
public const int StaticFiles = 3000;
/// <summary>
/// Actions calling IApplicationBuilder.UseAuthentication use this priority.
/// </summary>
public const int Authentication = 2000;
/// <summary>
/// Actions calling IApplicationBuilder.UseAuthorization use this priority.
/// </summary>
public const int Authorization = 1000;
/// <summary>
/// Action adding endpoint should use this priority (with a negative modificator if there is a catchall).
/// </summary>
public const int Endpoint = 0;
/// <summary>
/// The lowest predefined priority existing for <see cref="StartupAction"/>.
/// It should run after all other actions.
/// </summary>
public const int After = -1000;
/// <summary>
@ -58,28 +89,6 @@ namespace Kyoo.Abstractions.Controllers
/// <returns>A new <see cref="StartupAction"/></returns>
public static StartupAction<T, T2, T3> New<T, T2, T3>(Action<T, T2, T3> action, int priority)
=> new(action, priority);
}
/// <summary>
/// An action executed on kyoo's startup to initialize the asp-net container.
/// </summary>
/// <remarks>
/// This is the base interface, see <see cref="StartupAction"/> for a simpler use of this.
/// </remarks>
public interface IStartupAction
{
/// <summary>
/// The priority of this action. The actions will be executed on descending priority order.
/// If two actions have the same priority, their order is undefined.
/// </summary>
int Priority { get; }
/// <summary>
/// Run this action to configure the container, a service provider containing all services can be used.
/// </summary>
/// <param name="provider">The service provider containing all services can be used.</param>
void Run(IServiceProvider provider);
}
/// <summary>
/// A <see cref="IStartupAction"/> with no dependencies.
@ -218,3 +227,25 @@ namespace Kyoo.Abstractions.Controllers
}
}
}
/// <summary>
/// An action executed on kyoo's startup to initialize the asp-net container.
/// </summary>
/// <remarks>
/// This is the base interface, see <see cref="SA.StartupAction"/> for a simpler use of this.
/// </remarks>
public interface IStartupAction
{
/// <summary>
/// The priority of this action. The actions will be executed on descending priority order.
/// If two actions have the same priority, their order is undefined.
/// </summary>
int Priority { get; }
/// <summary>
/// Run this action to configure the container, a service provider containing all services can be used.
/// </summary>
/// <param name="provider">The service provider containing all services can be used.</param>
void Run(IServiceProvider provider);
}
}

View File

@ -0,0 +1,11 @@
using System;
using Kyoo.Abstractions.Controllers;
namespace Kyoo.Abstractions.Models.Attributes
{
/// <summary>
/// The targeted relation can be edited via calls to the repository's <see cref="IRepository{T}.Edit"/> method.
/// </summary>
[AttributeUsage(AttributeTargets.Property)]
public class EditableRelationAttribute : Attribute { }
}

View File

@ -1,13 +1,8 @@
using System;
using System;
using Kyoo.Abstractions.Controllers;
namespace Kyoo.Abstractions.Models.Attributes
{
/// <summary>
/// The targeted relation can be edited via calls to the repository's <see cref="IRepository{T}.Edit"/> method.
/// </summary>
[AttributeUsage(AttributeTargets.Property)]
public class EditableRelationAttribute : Attribute { }
/// <summary>
/// The targeted relation can be loaded via a call to <see cref="ILibraryManager.Load"/>.

View File

@ -25,7 +25,7 @@ namespace Kyoo.Abstractions.Models.Exceptions
{ }
/// <summary>
/// The serialization constructor
/// The serialization constructor.
/// </summary>
/// <param name="info">Serialization infos</param>
/// <param name="context">The serialization context</param>

View File

@ -10,8 +10,19 @@ namespace Kyoo.Abstractions.Models
/// </summary>
public enum ItemType
{
/// <summary>
/// The <see cref="LibraryItem"/> is a <see cref="Show"/>.
/// </summary>
Show,
/// <summary>
/// The <see cref="LibraryItem"/> is a Movie (a <see cref="Show"/> with <see cref="Show.IsMovie"/> equals to true).
/// </summary>
Movie,
/// <summary>
/// The <see cref="LibraryItem"/> is a <see cref="Collection"/>.
/// </summary>
Collection
}

View File

@ -9,6 +9,14 @@ namespace Kyoo.Abstractions.Models
/// </summary>
public class MetadataID
{
/// <summary>
/// The expression to retrieve the unique ID of a MetadataID. This is an aggregate of the two resources IDs.
/// </summary>
public static Expression<Func<MetadataID, object>> PrimaryKey
{
get { return x => new { First = x.ResourceID, Second = x.ProviderID }; }
}
/// <summary>
/// The ID of the resource which possess the metadata.
/// </summary>
@ -33,13 +41,5 @@ namespace Kyoo.Abstractions.Models
/// The URL of the resource on the external provider.
/// </summary>
public string Link { get; set; }
/// <summary>
/// The expression to retrieve the unique ID of a MetadataID. This is an aggregate of the two resources IDs.
/// </summary>
public static Expression<Func<MetadataID, object>> PrimaryKey
{
get { return x => new { First = x.ResourceID, Second = x.ProviderID }; }
}
}
}

View File

@ -9,7 +9,8 @@ namespace Kyoo.Abstractions.Models
/// A page of resource that contains information about the pagination of resources.
/// </summary>
/// <typeparam name="T">The type of resource contained in this page.</typeparam>
public class Page<T> where T : IResource
public class Page<T>
where T : IResource
{
/// <summary>
/// The link of the current page.