mirror of
https://github.com/zoriya/Kyoo.git
synced 2025-06-01 20:54:13 -04:00
CodingStyle: Splitting multi-class files into multiple files
This commit is contained in:
parent
fd122592f4
commit
af285a7c6c
@ -6,7 +6,9 @@ namespace Kyoo.Abstractions.Controllers
|
|||||||
public interface ITranscoder
|
public interface ITranscoder
|
||||||
{
|
{
|
||||||
Task<Track[]> ExtractInfos(Episode episode, bool reextract);
|
Task<Track[]> ExtractInfos(Episode episode, bool reextract);
|
||||||
|
|
||||||
Task<string> Transmux(Episode episode);
|
Task<string> Transmux(Episode episode);
|
||||||
|
|
||||||
Task<string> Transcode(Episode episode);
|
Task<string> Transcode(Episode episode);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
using System;
|
using System;
|
||||||
|
using System.Diagnostics.CodeAnalysis;
|
||||||
using Microsoft.Extensions.DependencyInjection;
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
|
|
||||||
namespace Kyoo.Abstractions.Controllers
|
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"/>.
|
/// 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"/>.
|
/// It also contains helper methods for creating new <see cref="StartupAction"/>.
|
||||||
/// </summary>
|
/// </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
|
public static class SA
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// The highest predefined priority existing for <see cref="StartupAction"/>.
|
||||||
|
/// </summary>
|
||||||
public const int Before = 5000;
|
public const int Before = 5000;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Items defining routing (see IApplicationBuilder.UseRouting use this priority.
|
||||||
|
/// </summary>
|
||||||
public const int Routing = 4000;
|
public const int Routing = 4000;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Actions defining new static files router use this priority.
|
||||||
|
/// </summary>
|
||||||
public const int StaticFiles = 3000;
|
public const int StaticFiles = 3000;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Actions calling IApplicationBuilder.UseAuthentication use this priority.
|
||||||
|
/// </summary>
|
||||||
public const int Authentication = 2000;
|
public const int Authentication = 2000;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Actions calling IApplicationBuilder.UseAuthorization use this priority.
|
||||||
|
/// </summary>
|
||||||
public const int Authorization = 1000;
|
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;
|
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;
|
public const int After = -1000;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -58,28 +89,6 @@ namespace Kyoo.Abstractions.Controllers
|
|||||||
/// <returns>A new <see cref="StartupAction"/></returns>
|
/// <returns>A new <see cref="StartupAction"/></returns>
|
||||||
public static StartupAction<T, T2, T3> New<T, T2, T3>(Action<T, T2, T3> action, int priority)
|
public static StartupAction<T, T2, T3> New<T, T2, T3>(Action<T, T2, T3> action, int priority)
|
||||||
=> new(action, 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>
|
/// <summary>
|
||||||
/// A <see cref="IStartupAction"/> with no dependencies.
|
/// A <see cref="IStartupAction"/> with no dependencies.
|
||||||
@ -217,4 +226,26 @@ 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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -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 { }
|
||||||
|
}
|
@ -1,13 +1,8 @@
|
|||||||
using System;
|
using System;
|
||||||
using Kyoo.Abstractions.Controllers;
|
using Kyoo.Abstractions.Controllers;
|
||||||
|
|
||||||
namespace Kyoo.Abstractions.Models.Attributes
|
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>
|
/// <summary>
|
||||||
/// The targeted relation can be loaded via a call to <see cref="ILibraryManager.Load"/>.
|
/// The targeted relation can be loaded via a call to <see cref="ILibraryManager.Load"/>.
|
@ -25,7 +25,7 @@ namespace Kyoo.Abstractions.Models.Exceptions
|
|||||||
{ }
|
{ }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The serialization constructor
|
/// The serialization constructor.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="info">Serialization infos</param>
|
/// <param name="info">Serialization infos</param>
|
||||||
/// <param name="context">The serialization context</param>
|
/// <param name="context">The serialization context</param>
|
||||||
|
@ -10,8 +10,19 @@ namespace Kyoo.Abstractions.Models
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public enum ItemType
|
public enum ItemType
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// The <see cref="LibraryItem"/> is a <see cref="Show"/>.
|
||||||
|
/// </summary>
|
||||||
Show,
|
Show,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The <see cref="LibraryItem"/> is a Movie (a <see cref="Show"/> with <see cref="Show.IsMovie"/> equals to true).
|
||||||
|
/// </summary>
|
||||||
Movie,
|
Movie,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The <see cref="LibraryItem"/> is a <see cref="Collection"/>.
|
||||||
|
/// </summary>
|
||||||
Collection
|
Collection
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -9,6 +9,14 @@ namespace Kyoo.Abstractions.Models
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public class MetadataID
|
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>
|
/// <summary>
|
||||||
/// The ID of the resource which possess the metadata.
|
/// The ID of the resource which possess the metadata.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -33,13 +41,5 @@ namespace Kyoo.Abstractions.Models
|
|||||||
/// The URL of the resource on the external provider.
|
/// The URL of the resource on the external provider.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string Link { get; set; }
|
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 }; }
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -9,7 +9,8 @@ namespace Kyoo.Abstractions.Models
|
|||||||
/// A page of resource that contains information about the pagination of resources.
|
/// A page of resource that contains information about the pagination of resources.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <typeparam name="T">The type of resource contained in this page.</typeparam>
|
/// <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>
|
/// <summary>
|
||||||
/// The link of the current page.
|
/// The link of the current page.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user