Merge branch 'master' into authenticationdb-efcore

# Conflicts:
#	Emby.Server.Implementations/Devices/DeviceManager.cs
#	Emby.Server.Implementations/HttpServer/Security/SessionContext.cs
#	Emby.Server.Implementations/Security/AuthenticationRepository.cs
#	Emby.Server.Implementations/Session/SessionManager.cs
#	Jellyfin.Server.Implementations/Security/AuthorizationContext.cs
#	MediaBrowser.Controller/Library/IUserManager.cs
#	MediaBrowser.Controller/Net/ISessionContext.cs
This commit is contained in:
Patrick Barron
2021-06-18 18:47:44 -04:00
357 changed files with 3277 additions and 2315 deletions

View File

@@ -6,6 +6,7 @@ using System;
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
using Emby.Naming.Common;
using Jellyfin.Data.Entities;
using Jellyfin.Data.Enums;
using MediaBrowser.Controller.Dto;
@@ -352,6 +353,7 @@ namespace MediaBrowser.Controller.Library
/// <param name="viewType">Type of the view.</param>
/// <param name="sortName">Name of the sort.</param>
/// <param name="uniqueId">The unique identifier.</param>
/// <returns>The named view.</returns>
UserView GetNamedView(
string name,
Guid parentId,
@@ -365,10 +367,11 @@ namespace MediaBrowser.Controller.Library
/// <param name="parent">The parent.</param>
/// <param name="viewType">Type of the view.</param>
/// <param name="sortName">Name of the sort.</param>
/// <returns>The shadow view.</returns>
UserView GetShadowView(
BaseItem parent,
string viewType,
string sortName);
string viewType,
string sortName);
/// <summary>
/// Determines whether [is video file] [the specified path].
@@ -593,5 +596,11 @@ namespace MediaBrowser.Controller.Library
BaseItem GetParentItem(string parentId, Guid? userId);
BaseItem GetParentItem(Guid? parentId, Guid? userId);
/// <summary>
/// Gets or creates a static instance of <see cref="NamingOptions"/>.
/// </summary>
/// <returns>An instance of the <see cref="NamingOptions"/> class.</returns>
NamingOptions GetNamingOptions();
}
}

View File

@@ -49,17 +49,16 @@ namespace MediaBrowser.Controller.Library
/// <summary>
/// Get all user data for the given user.
/// </summary>
/// <param name="userId"></param>
/// <returns></returns>
/// <param name="userId">The user id.</param>
/// <returns>The user item data.</returns>
List<UserItemData> GetAllUserData(Guid userId);
/// <summary>
/// Save the all provided user data for the given user.
/// </summary>
/// <param name="userId"></param>
/// <param name="userData"></param>
/// <param name="cancellationToken"></param>
/// <returns></returns>
/// <param name="userId">The user id.</param>
/// <param name="userData">The array of user data.</param>
/// <param name="cancellationToken">The cancellation token.</param>
void SaveAllUserData(Guid userId, UserItemData[] userData, CancellationToken cancellationToken);
/// <summary>

View File

@@ -61,8 +61,8 @@ namespace MediaBrowser.Controller.Library
/// <param name="user">The user.</param>
/// <param name="newName">The new name.</param>
/// <returns>Task.</returns>
/// <exception cref="ArgumentNullException">user</exception>
/// <exception cref="ArgumentException"></exception>
/// <exception cref="ArgumentNullException">If user is <c>null</c>.</exception>
/// <exception cref="ArgumentException">If the provided user doesn't exist.</exception>
Task RenameUser(User user, string newName);
/// <summary>
@@ -79,8 +79,8 @@ namespace MediaBrowser.Controller.Library
/// </summary>
/// <param name="name">The name of the new user.</param>
/// <returns>The created user.</returns>
/// <exception cref="ArgumentNullException">name</exception>
/// <exception cref="ArgumentException"></exception>
/// <exception cref="ArgumentNullException"><paramref name="name"/> is <c>null</c> or empty.</exception>
/// <exception cref="ArgumentException"><paramref name="name"/> already exists.</exception>
Task<User> CreateUserAsync(string name);
/// <summary>

View File

@@ -39,7 +39,7 @@ namespace MediaBrowser.Controller.Library
public IDirectoryService DirectoryService { get; }
/// <summary>
/// Gets the file system children.
/// Gets or sets the file system children.
/// </summary>
/// <value>The file system children.</value>
public FileSystemMetadata[] FileSystemChildren { get; set; }
@@ -242,14 +242,14 @@ namespace MediaBrowser.Controller.Library
/// <returns>A hash code for this instance, suitable for use in hashing algorithms and data structures like a hash table.</returns>
public override int GetHashCode()
{
return Path.GetHashCode();
return Path.GetHashCode(StringComparison.Ordinal);
}
/// <summary>
/// Equals the specified args.
/// </summary>
/// <param name="args">The args.</param>
/// <returns><c>true</c> if XXXX, <c>false</c> otherwise</returns>
/// <returns><c>true</c> if the arguments are the same, <c>false</c> otherwise.</returns>
protected bool Equals(ItemResolveArgs args)
{
if (args != null)

View File

@@ -1,85 +0,0 @@
#nullable disable
using System;
using System.Diagnostics;
using System.Globalization;
using Microsoft.Extensions.Logging;
namespace MediaBrowser.Controller.Library
{
/// <summary>
/// Class Profiler.
/// </summary>
public class Profiler : IDisposable
{
/// <summary>
/// The name.
/// </summary>
private readonly string _name;
/// <summary>
/// The stopwatch.
/// </summary>
private readonly Stopwatch _stopwatch;
/// <summary>
/// The _logger.
/// </summary>
private readonly ILogger<Profiler> _logger;
/// <summary>
/// Initializes a new instance of the <see cref="Profiler" /> class.
/// </summary>
/// <param name="name">The name.</param>
/// <param name="logger">The logger.</param>
public Profiler(string name, ILogger<Profiler> logger)
{
this._name = name;
_logger = logger;
_stopwatch = new Stopwatch();
_stopwatch.Start();
}
/// <summary>
/// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
/// </summary>
public void Dispose()
{
Dispose(true);
GC.SuppressFinalize(this);
}
/// <summary>
/// Releases unmanaged and - optionally - managed resources.
/// </summary>
/// <param name="dispose"><c>true</c> to release both managed and unmanaged resources; <c>false</c> to release only unmanaged resources.</param>
protected virtual void Dispose(bool dispose)
{
if (dispose)
{
_stopwatch.Stop();
string message;
if (_stopwatch.ElapsedMilliseconds > 300000)
{
message = string.Format(
CultureInfo.InvariantCulture,
"{0} took {1} minutes.",
_name,
((float)_stopwatch.ElapsedMilliseconds / 60000).ToString("F", CultureInfo.InvariantCulture));
}
else
{
message = string.Format(
CultureInfo.InvariantCulture,
"{0} took {1} seconds.",
_name,
((float)_stopwatch.ElapsedMilliseconds / 1000).ToString("#0.000", CultureInfo.InvariantCulture));
}
_logger.LogInformation(message);
}
}
}
}