mirror of
https://github.com/jellyfin/jellyfin.git
synced 2026-03-25 11:36:35 +00:00
ReSharper conform to 'var' settings
This commit is contained in:
@@ -527,7 +527,7 @@ namespace Emby.Server.Implementations.Activity
|
||||
const int DaysInMonth = 30;
|
||||
|
||||
// Get each non-zero value from TimeSpan component
|
||||
List<string> values = new List<string>();
|
||||
var values = new List<string>();
|
||||
|
||||
// Number of years
|
||||
int days = span.Days;
|
||||
@@ -558,7 +558,7 @@ namespace Emby.Server.Implementations.Activity
|
||||
values.Add(CreateValueString(span.Seconds, "second"));
|
||||
|
||||
// Combine values into string
|
||||
StringBuilder builder = new StringBuilder();
|
||||
var builder = new StringBuilder();
|
||||
for (int i = 0; i < values.Count; i++)
|
||||
{
|
||||
if (builder.Length > 0)
|
||||
|
||||
@@ -151,7 +151,7 @@ namespace Emby.Server.Implementations.AppBase
|
||||
/// Replaces the configuration.
|
||||
/// </summary>
|
||||
/// <param name="newConfiguration">The new configuration.</param>
|
||||
/// <exception cref="System.ArgumentNullException">newConfiguration</exception>
|
||||
/// <exception cref="ArgumentNullException">newConfiguration</exception>
|
||||
public virtual void ReplaceConfiguration(BaseApplicationConfiguration newConfiguration)
|
||||
{
|
||||
if (newConfiguration == null)
|
||||
@@ -188,7 +188,7 @@ namespace Emby.Server.Implementations.AppBase
|
||||
/// Replaces the cache path.
|
||||
/// </summary>
|
||||
/// <param name="newConfig">The new configuration.</param>
|
||||
/// <exception cref="System.IO.DirectoryNotFoundException"></exception>
|
||||
/// <exception cref="DirectoryNotFoundException"></exception>
|
||||
private void ValidateCachePath(BaseApplicationConfiguration newConfig)
|
||||
{
|
||||
var newPath = newConfig.CachePath;
|
||||
|
||||
@@ -822,7 +822,7 @@ namespace Emby.Server.Implementations
|
||||
RegisterSingleInstance(ServerConfigurationManager);
|
||||
|
||||
IAssemblyInfo assemblyInfo = new AssemblyInfo();
|
||||
RegisterSingleInstance<IAssemblyInfo>(assemblyInfo);
|
||||
RegisterSingleInstance(assemblyInfo);
|
||||
|
||||
LocalizationManager = new LocalizationManager(ServerConfigurationManager, FileSystemManager, JsonSerializer, LoggerFactory.CreateLogger("LocalizationManager"), assemblyInfo, new TextLocalizer());
|
||||
StringExtensions.LocalizationManager = LocalizationManager;
|
||||
@@ -920,7 +920,7 @@ namespace Emby.Server.Implementations
|
||||
RegisterSingleInstance(CollectionManager);
|
||||
|
||||
PlaylistManager = new PlaylistManager(LibraryManager, FileSystemManager, LibraryMonitor, LoggerFactory.CreateLogger("PlaylistManager"), UserManager, ProviderManager);
|
||||
RegisterSingleInstance<IPlaylistManager>(PlaylistManager);
|
||||
RegisterSingleInstance(PlaylistManager);
|
||||
|
||||
LiveTvManager = new LiveTvManager(this, HttpClient, ServerConfigurationManager, Logger, ItemRepository, ImageProcessor, UserDataManager, DtoService, UserManager, LibraryManager, TaskManager, LocalizationManager, JsonSerializer, ProviderManager, FileSystemManager, SecurityManager, () => ChannelManager);
|
||||
RegisterSingleInstance(LiveTvManager);
|
||||
@@ -938,7 +938,7 @@ namespace Emby.Server.Implementations
|
||||
|
||||
RegisterMediaEncoder(assemblyInfo);
|
||||
|
||||
EncodingManager = new Emby.Server.Implementations.MediaEncoder.EncodingManager(FileSystemManager, Logger, MediaEncoder, ChapterManager, LibraryManager);
|
||||
EncodingManager = new MediaEncoder.EncodingManager(FileSystemManager, Logger, MediaEncoder, ChapterManager, LibraryManager);
|
||||
RegisterSingleInstance(EncodingManager);
|
||||
|
||||
var activityLogRepo = GetActivityLogRepository();
|
||||
@@ -950,7 +950,7 @@ namespace Emby.Server.Implementations
|
||||
RegisterSingleInstance<ISessionContext>(new SessionContext(UserManager, authContext, SessionManager));
|
||||
|
||||
AuthService = new AuthService(UserManager, authContext, ServerConfigurationManager, SessionManager, NetworkManager);
|
||||
RegisterSingleInstance<IAuthService>(AuthService);
|
||||
RegisterSingleInstance(AuthService);
|
||||
|
||||
SubtitleEncoder = new MediaBrowser.MediaEncoding.Subtitles.SubtitleEncoder(LibraryManager, LoggerFactory.CreateLogger("SubtitleEncoder"), ApplicationPaths, FileSystemManager, MediaEncoder, JsonSerializer, HttpClient, MediaSourceManager, ProcessFactory, TextEncoding);
|
||||
RegisterSingleInstance(SubtitleEncoder);
|
||||
@@ -1023,7 +1023,7 @@ namespace Emby.Server.Implementations
|
||||
{
|
||||
var arr = str.ToCharArray();
|
||||
|
||||
arr = Array.FindAll<char>(arr, (c => (char.IsLetterOrDigit(c)
|
||||
arr = Array.FindAll(arr, (c => (char.IsLetterOrDigit(c)
|
||||
|| char.IsWhiteSpace(c))));
|
||||
|
||||
var result = new string(arr);
|
||||
@@ -1057,7 +1057,7 @@ namespace Emby.Server.Implementations
|
||||
// Don't use an empty string password
|
||||
var password = string.IsNullOrWhiteSpace(info.Password) ? null : info.Password;
|
||||
|
||||
X509Certificate2 localCert = new X509Certificate2(certificateLocation, password);
|
||||
var localCert = new X509Certificate2(certificateLocation, password);
|
||||
//localCert.PrivateKey = PrivateKey.CreateFromFile(pvk_file).RSA;
|
||||
if (!localCert.HasPrivateKey)
|
||||
{
|
||||
|
||||
@@ -119,7 +119,7 @@ namespace Emby.Server.Implementations.Configuration
|
||||
/// Replaces the configuration.
|
||||
/// </summary>
|
||||
/// <param name="newConfiguration">The new configuration.</param>
|
||||
/// <exception cref="System.IO.DirectoryNotFoundException"></exception>
|
||||
/// <exception cref="DirectoryNotFoundException"></exception>
|
||||
public override void ReplaceConfiguration(BaseApplicationConfiguration newConfiguration)
|
||||
{
|
||||
var newConfig = (ServerConfiguration)newConfiguration;
|
||||
@@ -137,7 +137,7 @@ namespace Emby.Server.Implementations.Configuration
|
||||
/// Validates the SSL certificate.
|
||||
/// </summary>
|
||||
/// <param name="newConfig">The new configuration.</param>
|
||||
/// <exception cref="System.IO.DirectoryNotFoundException"></exception>
|
||||
/// <exception cref="DirectoryNotFoundException"></exception>
|
||||
private void ValidateSslCertificate(BaseApplicationConfiguration newConfig)
|
||||
{
|
||||
var serverConfig = (ServerConfiguration)newConfig;
|
||||
@@ -159,7 +159,7 @@ namespace Emby.Server.Implementations.Configuration
|
||||
/// Validates the metadata path.
|
||||
/// </summary>
|
||||
/// <param name="newConfig">The new configuration.</param>
|
||||
/// <exception cref="System.IO.DirectoryNotFoundException"></exception>
|
||||
/// <exception cref="DirectoryNotFoundException"></exception>
|
||||
private void ValidateMetadataPath(ServerConfiguration newConfig)
|
||||
{
|
||||
var newPath = newConfig.MetadataPath;
|
||||
|
||||
@@ -47,7 +47,7 @@ namespace Emby.Server.Implementations.Data
|
||||
|
||||
public T RunInTransaction<T>(Func<IDatabaseConnection, T> action, TransactionMode mode)
|
||||
{
|
||||
return db.RunInTransaction<T>(action, mode);
|
||||
return db.RunInTransaction(action, mode);
|
||||
}
|
||||
|
||||
public IEnumerable<IReadOnlyList<IResultSetValue>> Query(string sql)
|
||||
|
||||
@@ -83,7 +83,7 @@ namespace Emby.Server.Implementations.Data
|
||||
/// <param name="client">The client.</param>
|
||||
/// <param name="cancellationToken">The cancellation token.</param>
|
||||
/// <returns>Task.</returns>
|
||||
/// <exception cref="System.ArgumentNullException">item</exception>
|
||||
/// <exception cref="ArgumentNullException">item</exception>
|
||||
public void SaveDisplayPreferences(DisplayPreferences displayPreferences, Guid userId, string client, CancellationToken cancellationToken)
|
||||
{
|
||||
if (displayPreferences == null)
|
||||
@@ -131,7 +131,7 @@ namespace Emby.Server.Implementations.Data
|
||||
/// <param name="userId">The user id.</param>
|
||||
/// <param name="cancellationToken">The cancellation token.</param>
|
||||
/// <returns>Task.</returns>
|
||||
/// <exception cref="System.ArgumentNullException">item</exception>
|
||||
/// <exception cref="ArgumentNullException">item</exception>
|
||||
public void SaveAllDisplayPreferences(IEnumerable<DisplayPreferences> displayPreferences, Guid userId, CancellationToken cancellationToken)
|
||||
{
|
||||
if (displayPreferences == null)
|
||||
@@ -163,7 +163,7 @@ namespace Emby.Server.Implementations.Data
|
||||
/// <param name="userId">The user id.</param>
|
||||
/// <param name="client">The client.</param>
|
||||
/// <returns>Task{DisplayPreferences}.</returns>
|
||||
/// <exception cref="System.ArgumentNullException">item</exception>
|
||||
/// <exception cref="ArgumentNullException">item</exception>
|
||||
public DisplayPreferences GetDisplayPreferences(string displayPreferencesId, Guid userId, string client)
|
||||
{
|
||||
if (string.IsNullOrEmpty(displayPreferencesId))
|
||||
@@ -202,7 +202,7 @@ namespace Emby.Server.Implementations.Data
|
||||
/// </summary>
|
||||
/// <param name="userId">The user id.</param>
|
||||
/// <returns>Task{DisplayPreferences}.</returns>
|
||||
/// <exception cref="System.ArgumentNullException">item</exception>
|
||||
/// <exception cref="ArgumentNullException">item</exception>
|
||||
public IEnumerable<DisplayPreferences> GetAllDisplayPreferences(Guid userId)
|
||||
{
|
||||
var list = new List<DisplayPreferences>();
|
||||
|
||||
@@ -128,7 +128,7 @@ namespace Emby.Server.Implementations.Data
|
||||
/// Serializes to bytes.
|
||||
/// </summary>
|
||||
/// <returns>System.Byte[][].</returns>
|
||||
/// <exception cref="System.ArgumentNullException">obj</exception>
|
||||
/// <exception cref="ArgumentNullException">obj</exception>
|
||||
public static byte[] SerializeToBytes(this IJsonSerializer json, object obj)
|
||||
{
|
||||
if (obj == null)
|
||||
|
||||
@@ -531,7 +531,7 @@ namespace Emby.Server.Implementations.Data
|
||||
/// </summary>
|
||||
/// <param name="item">The item.</param>
|
||||
/// <param name="cancellationToken">The cancellation token.</param>
|
||||
/// <exception cref="System.ArgumentNullException">item</exception>
|
||||
/// <exception cref="ArgumentNullException">item</exception>
|
||||
public void SaveItem(BaseItem item, CancellationToken cancellationToken)
|
||||
{
|
||||
if (item == null)
|
||||
@@ -574,7 +574,7 @@ namespace Emby.Server.Implementations.Data
|
||||
/// </summary>
|
||||
/// <param name="items">The items.</param>
|
||||
/// <param name="cancellationToken">The cancellation token.</param>
|
||||
/// <exception cref="System.ArgumentNullException">
|
||||
/// <exception cref="ArgumentNullException">
|
||||
/// items
|
||||
/// or
|
||||
/// cancellationToken
|
||||
@@ -1198,8 +1198,8 @@ namespace Emby.Server.Implementations.Data
|
||||
/// </summary>
|
||||
/// <param name="id">The id.</param>
|
||||
/// <returns>BaseItem.</returns>
|
||||
/// <exception cref="System.ArgumentNullException">id</exception>
|
||||
/// <exception cref="System.ArgumentException"></exception>
|
||||
/// <exception cref="ArgumentNullException">id</exception>
|
||||
/// <exception cref="ArgumentException"></exception>
|
||||
public BaseItem RetrieveItem(Guid id)
|
||||
{
|
||||
if (id.Equals(Guid.Empty))
|
||||
@@ -1945,7 +1945,7 @@ namespace Emby.Server.Implementations.Data
|
||||
/// </summary>
|
||||
/// <param name="item">The item.</param>
|
||||
/// <returns>IEnumerable{ChapterInfo}.</returns>
|
||||
/// <exception cref="System.ArgumentNullException">id</exception>
|
||||
/// <exception cref="ArgumentNullException">id</exception>
|
||||
public List<ChapterInfo> GetChapters(BaseItem item)
|
||||
{
|
||||
CheckDisposed();
|
||||
@@ -1977,7 +1977,7 @@ namespace Emby.Server.Implementations.Data
|
||||
/// <param name="item">The item.</param>
|
||||
/// <param name="index">The index.</param>
|
||||
/// <returns>ChapterInfo.</returns>
|
||||
/// <exception cref="System.ArgumentNullException">id</exception>
|
||||
/// <exception cref="ArgumentNullException">id</exception>
|
||||
public ChapterInfo GetChapter(BaseItem item, int index)
|
||||
{
|
||||
CheckDisposed();
|
||||
|
||||
@@ -110,7 +110,7 @@ namespace Emby.Server.Implementations.Data
|
||||
|
||||
private List<Guid> GetAllUserIdsWithUserData(IDatabaseConnection db)
|
||||
{
|
||||
List<Guid> list = new List<Guid>();
|
||||
var list = new List<Guid>();
|
||||
|
||||
using (var statement = PrepareStatement(db, "select DISTINCT UserId from UserData where UserId not null"))
|
||||
{
|
||||
@@ -271,7 +271,7 @@ namespace Emby.Server.Implementations.Data
|
||||
/// <param name="internalUserId">The user id.</param>
|
||||
/// <param name="key">The key.</param>
|
||||
/// <returns>Task{UserItemData}.</returns>
|
||||
/// <exception cref="System.ArgumentNullException">
|
||||
/// <exception cref="ArgumentNullException">
|
||||
/// userId
|
||||
/// or
|
||||
/// key
|
||||
|
||||
@@ -200,7 +200,7 @@ namespace Emby.Server.Implementations.Data
|
||||
/// </summary>
|
||||
/// <param name="user">The user.</param>
|
||||
/// <returns>Task.</returns>
|
||||
/// <exception cref="System.ArgumentNullException">user</exception>
|
||||
/// <exception cref="ArgumentNullException">user</exception>
|
||||
public void DeleteUser(User user)
|
||||
{
|
||||
if (user == null)
|
||||
|
||||
@@ -27,7 +27,7 @@ namespace Emby.Server.Implementations.Data
|
||||
/// </summary>
|
||||
/// <param name="typeName">Name of the type.</param>
|
||||
/// <returns>Type.</returns>
|
||||
/// <exception cref="System.ArgumentNullException"></exception>
|
||||
/// <exception cref="ArgumentNullException"></exception>
|
||||
public Type GetType(string typeName)
|
||||
{
|
||||
if (string.IsNullOrEmpty(typeName))
|
||||
|
||||
@@ -71,7 +71,7 @@ namespace Emby.Server.Implementations.Dto
|
||||
/// <param name="user">The user.</param>
|
||||
/// <param name="owner">The owner.</param>
|
||||
/// <returns>Task{DtoBaseItem}.</returns>
|
||||
/// <exception cref="System.ArgumentNullException">item</exception>
|
||||
/// <exception cref="ArgumentNullException">item</exception>
|
||||
public BaseItemDto GetBaseItemDto(BaseItem item, ItemFields[] fields, User user = null, BaseItem owner = null)
|
||||
{
|
||||
var options = new DtoOptions
|
||||
@@ -463,7 +463,7 @@ namespace Emby.Server.Implementations.Dto
|
||||
/// </summary>
|
||||
/// <param name="item">The item.</param>
|
||||
/// <returns>System.String.</returns>
|
||||
/// <exception cref="System.ArgumentNullException">item</exception>
|
||||
/// <exception cref="ArgumentNullException">item</exception>
|
||||
public string GetDtoId(BaseItem item)
|
||||
{
|
||||
return item.Id.ToString("N");
|
||||
|
||||
@@ -58,7 +58,7 @@ namespace Emby.Server.Implementations.EntryPoints
|
||||
|
||||
try
|
||||
{
|
||||
await _sessionManager.SendMessageToUserSessions<TimerEventInfo>(users, name, info, CancellationToken.None);
|
||||
await _sessionManager.SendMessageToUserSessions(users, name, info, CancellationToken.None);
|
||||
}
|
||||
catch (ObjectDisposedException)
|
||||
{
|
||||
|
||||
@@ -82,7 +82,7 @@ namespace Emby.Server.Implementations.HttpClientManager
|
||||
/// <param name="host">The host.</param>
|
||||
/// <param name="enableHttpCompression">if set to <c>true</c> [enable HTTP compression].</param>
|
||||
/// <returns>HttpClient.</returns>
|
||||
/// <exception cref="System.ArgumentNullException">host</exception>
|
||||
/// <exception cref="ArgumentNullException">host</exception>
|
||||
private HttpClientInfo GetHttpClient(string host, bool enableHttpCompression)
|
||||
{
|
||||
if (string.IsNullOrEmpty(host))
|
||||
@@ -125,7 +125,7 @@ namespace Emby.Server.Implementations.HttpClientManager
|
||||
{
|
||||
string url = options.Url;
|
||||
|
||||
Uri uriAddress = new Uri(url);
|
||||
var uriAddress = new Uri(url);
|
||||
string userInfo = uriAddress.UserInfo;
|
||||
if (!string.IsNullOrWhiteSpace(userInfo))
|
||||
{
|
||||
@@ -133,7 +133,7 @@ namespace Emby.Server.Implementations.HttpClientManager
|
||||
url = url.Replace(userInfo + "@", string.Empty);
|
||||
}
|
||||
|
||||
WebRequest request = CreateWebRequest(url);
|
||||
var request = CreateWebRequest(url);
|
||||
|
||||
if (request is HttpWebRequest httpWebRequest)
|
||||
{
|
||||
@@ -188,7 +188,7 @@ namespace Emby.Server.Implementations.HttpClientManager
|
||||
private static CredentialCache GetCredential(string url, string username, string password)
|
||||
{
|
||||
//ServicePointManager.SecurityProtocol = SecurityProtocolType.Ssl3;
|
||||
CredentialCache credentialCache = new CredentialCache();
|
||||
var credentialCache = new CredentialCache();
|
||||
credentialCache.Add(new Uri(url), "Basic", new NetworkCredential(username, password));
|
||||
return credentialCache;
|
||||
}
|
||||
@@ -807,7 +807,7 @@ namespace Emby.Server.Implementations.HttpClientManager
|
||||
{
|
||||
var taskCompletion = new TaskCompletionSource<WebResponse>();
|
||||
|
||||
Task<WebResponse> asyncTask = Task.Factory.FromAsync<WebResponse>(request.BeginGetResponse, request.EndGetResponse, null);
|
||||
var asyncTask = Task.Factory.FromAsync(request.BeginGetResponse, request.EndGetResponse, null);
|
||||
|
||||
ThreadPool.RegisterWaitForSingleObject((asyncTask as IAsyncResult).AsyncWaitHandle, TimeoutCallback, request, timeout, true);
|
||||
var callback = new TaskCallback { taskCompletion = taskCompletion };
|
||||
@@ -823,7 +823,7 @@ namespace Emby.Server.Implementations.HttpClientManager
|
||||
{
|
||||
if (timedOut && state != null)
|
||||
{
|
||||
WebRequest request = (WebRequest)state;
|
||||
var request = (WebRequest)state;
|
||||
request.Abort();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -77,7 +77,7 @@ namespace Emby.Server.Implementations.HttpServer
|
||||
/// <param name="remoteEndPoint">The remote end point.</param>
|
||||
/// <param name="jsonSerializer">The json serializer.</param>
|
||||
/// <param name="logger">The logger.</param>
|
||||
/// <exception cref="System.ArgumentNullException">socket</exception>
|
||||
/// <exception cref="ArgumentNullException">socket</exception>
|
||||
public WebSocketConnection(IWebSocket socket, string remoteEndPoint, IJsonSerializer jsonSerializer, ILogger logger, ITextEncoding textEncoding)
|
||||
{
|
||||
if (socket == null)
|
||||
@@ -215,7 +215,7 @@ namespace Emby.Server.Implementations.HttpServer
|
||||
/// <param name="message">The message.</param>
|
||||
/// <param name="cancellationToken">The cancellation token.</param>
|
||||
/// <returns>Task.</returns>
|
||||
/// <exception cref="System.ArgumentNullException">message</exception>
|
||||
/// <exception cref="ArgumentNullException">message</exception>
|
||||
public Task SendAsync<T>(WebSocketMessage<T> message, CancellationToken cancellationToken)
|
||||
{
|
||||
if (message == null)
|
||||
|
||||
@@ -23,8 +23,8 @@ namespace Emby.Server.Implementations.IO
|
||||
/// <param name="isoPath">The iso path.</param>
|
||||
/// <param name="cancellationToken">The cancellation token.</param>
|
||||
/// <returns>IsoMount.</returns>
|
||||
/// <exception cref="System.ArgumentNullException">isoPath</exception>
|
||||
/// <exception cref="System.ArgumentException"></exception>
|
||||
/// <exception cref="ArgumentNullException">isoPath</exception>
|
||||
/// <exception cref="ArgumentException"></exception>
|
||||
public Task<IIsoMount> Mount(string isoPath, CancellationToken cancellationToken)
|
||||
{
|
||||
if (string.IsNullOrEmpty(isoPath))
|
||||
|
||||
@@ -263,7 +263,7 @@ namespace Emby.Server.Implementations.IO
|
||||
/// <param name="lst">The LST.</param>
|
||||
/// <param name="path">The path.</param>
|
||||
/// <returns><c>true</c> if [contains parent folder] [the specified LST]; otherwise, <c>false</c>.</returns>
|
||||
/// <exception cref="System.ArgumentNullException">path</exception>
|
||||
/// <exception cref="ArgumentNullException">path</exception>
|
||||
private static bool ContainsParentFolder(IEnumerable<string> lst, string path)
|
||||
{
|
||||
if (string.IsNullOrEmpty(path))
|
||||
|
||||
@@ -101,7 +101,7 @@ namespace Emby.Server.Implementations.IO
|
||||
/// </summary>
|
||||
/// <param name="filename">The filename.</param>
|
||||
/// <returns><c>true</c> if the specified filename is shortcut; otherwise, <c>false</c>.</returns>
|
||||
/// <exception cref="System.ArgumentNullException">filename</exception>
|
||||
/// <exception cref="ArgumentNullException">filename</exception>
|
||||
public virtual bool IsShortcut(string filename)
|
||||
{
|
||||
if (string.IsNullOrEmpty(filename))
|
||||
@@ -118,7 +118,7 @@ namespace Emby.Server.Implementations.IO
|
||||
/// </summary>
|
||||
/// <param name="filename">The filename.</param>
|
||||
/// <returns>System.String.</returns>
|
||||
/// <exception cref="System.ArgumentNullException">filename</exception>
|
||||
/// <exception cref="ArgumentNullException">filename</exception>
|
||||
public virtual string ResolveShortcut(string filename)
|
||||
{
|
||||
if (string.IsNullOrEmpty(filename))
|
||||
@@ -185,7 +185,7 @@ namespace Emby.Server.Implementations.IO
|
||||
/// </summary>
|
||||
/// <param name="shortcutPath">The shortcut path.</param>
|
||||
/// <param name="target">The target.</param>
|
||||
/// <exception cref="System.ArgumentNullException">
|
||||
/// <exception cref="ArgumentNullException">
|
||||
/// shortcutPath
|
||||
/// or
|
||||
/// target
|
||||
@@ -344,7 +344,7 @@ namespace Emby.Server.Implementations.IO
|
||||
/// </summary>
|
||||
/// <param name="filename">The filename.</param>
|
||||
/// <returns>System.String.</returns>
|
||||
/// <exception cref="System.ArgumentNullException">filename</exception>
|
||||
/// <exception cref="ArgumentNullException">filename</exception>
|
||||
public string GetValidFilename(string filename)
|
||||
{
|
||||
var builder = new StringBuilder(filename);
|
||||
@@ -526,7 +526,7 @@ namespace Emby.Server.Implementations.IO
|
||||
}
|
||||
else
|
||||
{
|
||||
FileAttributes attributes = File.GetAttributes(path);
|
||||
var attributes = File.GetAttributes(path);
|
||||
attributes = RemoveAttribute(attributes, FileAttributes.Hidden);
|
||||
File.SetAttributes(path, attributes);
|
||||
}
|
||||
@@ -550,7 +550,7 @@ namespace Emby.Server.Implementations.IO
|
||||
}
|
||||
else
|
||||
{
|
||||
FileAttributes attributes = File.GetAttributes(path);
|
||||
var attributes = File.GetAttributes(path);
|
||||
attributes = RemoveAttribute(attributes, FileAttributes.ReadOnly);
|
||||
File.SetAttributes(path, attributes);
|
||||
}
|
||||
|
||||
@@ -711,7 +711,7 @@ namespace Emby.Server.Implementations.Library
|
||||
/// Creates the root media folder
|
||||
/// </summary>
|
||||
/// <returns>AggregateFolder.</returns>
|
||||
/// <exception cref="System.InvalidOperationException">Cannot create the root folder until plugins have loaded</exception>
|
||||
/// <exception cref="InvalidOperationException">Cannot create the root folder until plugins have loaded</exception>
|
||||
public AggregateFolder CreateRootFolder()
|
||||
{
|
||||
var rootFolderPath = ConfigurationManager.ApplicationPaths.RootFolderPath;
|
||||
@@ -905,7 +905,7 @@ namespace Emby.Server.Implementations.Library
|
||||
/// </summary>
|
||||
/// <param name="value">The value.</param>
|
||||
/// <returns>Task{Year}.</returns>
|
||||
/// <exception cref="System.ArgumentOutOfRangeException"></exception>
|
||||
/// <exception cref="ArgumentOutOfRangeException"></exception>
|
||||
public Year GetYear(int value)
|
||||
{
|
||||
if (value <= 0)
|
||||
@@ -1233,7 +1233,7 @@ namespace Emby.Server.Implementations.Library
|
||||
/// </summary>
|
||||
/// <param name="id">The id.</param>
|
||||
/// <returns>BaseItem.</returns>
|
||||
/// <exception cref="System.ArgumentNullException">id</exception>
|
||||
/// <exception cref="ArgumentNullException">id</exception>
|
||||
public BaseItem GetItemById(Guid id)
|
||||
{
|
||||
if (id.Equals(Guid.Empty))
|
||||
@@ -2075,7 +2075,7 @@ namespace Emby.Server.Implementations.Library
|
||||
|
||||
public string GetConfiguredContentType(BaseItem item, bool inheritConfiguredPath)
|
||||
{
|
||||
ICollectionFolder collectionFolder = item as ICollectionFolder;
|
||||
var collectionFolder = item as ICollectionFolder;
|
||||
if (collectionFolder != null)
|
||||
{
|
||||
return collectionFolder.CollectionType;
|
||||
@@ -2417,11 +2417,11 @@ namespace Emby.Server.Implementations.Library
|
||||
|
||||
var episodeInfo = episode.IsFileProtocol ?
|
||||
resolver.Resolve(episode.Path, isFolder, null, null, isAbsoluteNaming) :
|
||||
new Emby.Naming.TV.EpisodeInfo();
|
||||
new Naming.TV.EpisodeInfo();
|
||||
|
||||
if (episodeInfo == null)
|
||||
{
|
||||
episodeInfo = new Emby.Naming.TV.EpisodeInfo();
|
||||
episodeInfo = new Naming.TV.EpisodeInfo();
|
||||
}
|
||||
|
||||
var changed = false;
|
||||
|
||||
@@ -127,7 +127,7 @@ namespace Emby.Server.Implementations.Library
|
||||
|
||||
if (allowMediaProbe && mediaSources[0].Type != MediaSourceType.Placeholder && !mediaSources[0].MediaStreams.Any(i => i.Type == MediaStreamType.Audio || i.Type == MediaStreamType.Video))
|
||||
{
|
||||
await item.RefreshMetadata(new MediaBrowser.Controller.Providers.MetadataRefreshOptions(new DirectoryService(_logger, _fileSystem))
|
||||
await item.RefreshMetadata(new MetadataRefreshOptions(new DirectoryService(_logger, _fileSystem))
|
||||
{
|
||||
EnableRemoteContentProbe = true,
|
||||
MetadataRefreshMode = MediaBrowser.Controller.Providers.MetadataRefreshMode.FullRefresh
|
||||
|
||||
@@ -11,7 +11,7 @@ namespace Emby.Server.Implementations.Library
|
||||
/// <param name="str">The STR.</param>
|
||||
/// <param name="attrib">The attrib.</param>
|
||||
/// <returns>System.String.</returns>
|
||||
/// <exception cref="System.ArgumentNullException">attrib</exception>
|
||||
/// <exception cref="ArgumentNullException">attrib</exception>
|
||||
public static string GetAttributeValue(this string str, string attrib)
|
||||
{
|
||||
if (string.IsNullOrEmpty(str))
|
||||
|
||||
@@ -21,7 +21,7 @@ namespace Emby.Server.Implementations.Library
|
||||
/// <param name="fileSystem">The file system.</param>
|
||||
/// <param name="libraryManager">The library manager.</param>
|
||||
/// <param name="directoryService">The directory service.</param>
|
||||
/// <exception cref="System.ArgumentException">Item must have a path</exception>
|
||||
/// <exception cref="ArgumentException">Item must have a path</exception>
|
||||
public static void SetInitialItemValues(BaseItem item, Folder parent, IFileSystem fileSystem, ILibraryManager libraryManager, IDirectoryService directoryService)
|
||||
{
|
||||
// This version of the below method has no ItemResolveArgs, so we have to require the path already being set
|
||||
|
||||
@@ -49,7 +49,7 @@ namespace Emby.Server.Implementations.Library.Resolvers
|
||||
var namingOptions = ((LibraryManager)LibraryManager).GetNamingOptions();
|
||||
|
||||
// If the path is a file check for a matching extensions
|
||||
var parser = new Emby.Naming.Video.VideoResolver(namingOptions);
|
||||
var parser = new VideoResolver(namingOptions);
|
||||
|
||||
if (args.IsDirectory)
|
||||
{
|
||||
|
||||
@@ -63,7 +63,7 @@ namespace Emby.Server.Implementations.Library.Resolvers.TV
|
||||
|
||||
if (!season.IndexNumber.HasValue || !seasonParserResult.IsSeasonFolder)
|
||||
{
|
||||
var resolver = new Emby.Naming.TV.EpisodeResolver(namingOptions);
|
||||
var resolver = new Naming.TV.EpisodeResolver(namingOptions);
|
||||
|
||||
var folderName = System.IO.Path.GetFileName(path);
|
||||
var testPath = "\\\\test\\" + folderName;
|
||||
|
||||
@@ -151,7 +151,7 @@ namespace Emby.Server.Implementations.Library.Resolvers.TV
|
||||
|
||||
var namingOptions = ((LibraryManager)libraryManager).GetNamingOptions();
|
||||
|
||||
var episodeResolver = new Emby.Naming.TV.EpisodeResolver(namingOptions);
|
||||
var episodeResolver = new Naming.TV.EpisodeResolver(namingOptions);
|
||||
bool? isNamed = null;
|
||||
bool? isOptimistic = null;
|
||||
|
||||
@@ -179,7 +179,7 @@ namespace Emby.Server.Implementations.Library.Resolvers.TV
|
||||
/// </summary>
|
||||
/// <param name="path">The path.</param>
|
||||
/// <returns><c>true</c> if [is place holder] [the specified path]; otherwise, <c>false</c>.</returns>
|
||||
/// <exception cref="System.ArgumentNullException">path</exception>
|
||||
/// <exception cref="ArgumentNullException">path</exception>
|
||||
private static bool IsVideoPlaceHolder(string path)
|
||||
{
|
||||
if (string.IsNullOrEmpty(path))
|
||||
|
||||
@@ -76,7 +76,7 @@ namespace Emby.Server.Implementations.Library
|
||||
/// <param name="query">The query.</param>
|
||||
/// <param name="user">The user.</param>
|
||||
/// <returns>IEnumerable{SearchHintResult}.</returns>
|
||||
/// <exception cref="System.ArgumentNullException">searchTerm</exception>
|
||||
/// <exception cref="ArgumentNullException">searchTerm</exception>
|
||||
private List<SearchHintInfo> GetSearchHints(SearchQuery query, User user)
|
||||
{
|
||||
var searchTerm = query.SearchTerm;
|
||||
|
||||
@@ -193,7 +193,7 @@ namespace Emby.Server.Implementations.Library
|
||||
/// </summary>
|
||||
/// <param name="data">The data.</param>
|
||||
/// <returns>DtoUserItemData.</returns>
|
||||
/// <exception cref="System.ArgumentNullException"></exception>
|
||||
/// <exception cref="ArgumentNullException"></exception>
|
||||
private UserItemDataDto GetUserItemDataDto(UserItemData data)
|
||||
{
|
||||
if (data == null)
|
||||
|
||||
@@ -158,7 +158,7 @@ namespace Emby.Server.Implementations.Library
|
||||
/// </summary>
|
||||
/// <param name="id">The id.</param>
|
||||
/// <returns>User.</returns>
|
||||
/// <exception cref="System.ArgumentNullException"></exception>
|
||||
/// <exception cref="ArgumentNullException"></exception>
|
||||
public User GetUserById(Guid id)
|
||||
{
|
||||
if (id.Equals(Guid.Empty))
|
||||
@@ -619,8 +619,8 @@ namespace Emby.Server.Implementations.Library
|
||||
/// <param name="user">The user.</param>
|
||||
/// <param name="newName">The new name.</param>
|
||||
/// <returns>Task.</returns>
|
||||
/// <exception cref="System.ArgumentNullException">user</exception>
|
||||
/// <exception cref="System.ArgumentException"></exception>
|
||||
/// <exception cref="ArgumentNullException">user</exception>
|
||||
/// <exception cref="ArgumentException"></exception>
|
||||
public async Task RenameUser(User user, string newName)
|
||||
{
|
||||
if (user == null)
|
||||
@@ -652,8 +652,8 @@ namespace Emby.Server.Implementations.Library
|
||||
/// Updates the user.
|
||||
/// </summary>
|
||||
/// <param name="user">The user.</param>
|
||||
/// <exception cref="System.ArgumentNullException">user</exception>
|
||||
/// <exception cref="System.ArgumentException"></exception>
|
||||
/// <exception cref="ArgumentNullException">user</exception>
|
||||
/// <exception cref="ArgumentException"></exception>
|
||||
public void UpdateUser(User user)
|
||||
{
|
||||
if (user == null)
|
||||
@@ -683,8 +683,8 @@ namespace Emby.Server.Implementations.Library
|
||||
/// </summary>
|
||||
/// <param name="name">The name.</param>
|
||||
/// <returns>User.</returns>
|
||||
/// <exception cref="System.ArgumentNullException">name</exception>
|
||||
/// <exception cref="System.ArgumentException"></exception>
|
||||
/// <exception cref="ArgumentNullException">name</exception>
|
||||
/// <exception cref="ArgumentException"></exception>
|
||||
public async Task<User> CreateUser(string name)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(name))
|
||||
@@ -731,8 +731,8 @@ namespace Emby.Server.Implementations.Library
|
||||
/// </summary>
|
||||
/// <param name="user">The user.</param>
|
||||
/// <returns>Task.</returns>
|
||||
/// <exception cref="System.ArgumentNullException">user</exception>
|
||||
/// <exception cref="System.ArgumentException"></exception>
|
||||
/// <exception cref="ArgumentNullException">user</exception>
|
||||
/// <exception cref="ArgumentException"></exception>
|
||||
public async Task DeleteUser(User user)
|
||||
{
|
||||
if (user == null)
|
||||
|
||||
@@ -478,7 +478,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
|
||||
|
||||
private static string GetMappedChannel(string channelId, NameValuePair[] mappings)
|
||||
{
|
||||
foreach (NameValuePair mapping in mappings)
|
||||
foreach (var mapping in mappings)
|
||||
{
|
||||
if (StringHelper.EqualsIgnoreCase(mapping.Name, channelId))
|
||||
{
|
||||
@@ -2002,7 +2002,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
|
||||
CloseOutput = false
|
||||
};
|
||||
|
||||
using (XmlWriter writer = XmlWriter.Create(stream, settings))
|
||||
using (var writer = XmlWriter.Create(stream, settings))
|
||||
{
|
||||
writer.WriteStartDocument(true);
|
||||
writer.WriteStartElement("tvshow");
|
||||
@@ -2069,7 +2069,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
|
||||
|
||||
var isSeriesEpisode = timer.IsProgramSeries;
|
||||
|
||||
using (XmlWriter writer = XmlWriter.Create(stream, settings))
|
||||
using (var writer = XmlWriter.Create(stream, settings))
|
||||
{
|
||||
writer.WriteStartDocument(true);
|
||||
|
||||
|
||||
@@ -42,7 +42,7 @@ namespace Emby.Server.Implementations.LiveTv.Listings
|
||||
|
||||
private static List<string> GetScheduleRequestDates(DateTime startDateUtc, DateTime endDateUtc)
|
||||
{
|
||||
List<string> dates = new List<string>();
|
||||
var dates = new List<string>();
|
||||
|
||||
var start = new List<DateTime> { startDateUtc, startDateUtc.ToLocalTime() }.Min().Date;
|
||||
var end = new List<DateTime> { endDateUtc, endDateUtc.ToLocalTime() }.Max().Date;
|
||||
@@ -104,7 +104,7 @@ namespace Emby.Server.Implementations.LiveTv.Listings
|
||||
httpOptions.RequestHeaders["token"] = token;
|
||||
|
||||
using (var response = await Post(httpOptions, true, info).ConfigureAwait(false))
|
||||
using (StreamReader reader = new StreamReader(response.Content))
|
||||
using (var reader = new StreamReader(response.Content))
|
||||
{
|
||||
var dailySchedules = await _jsonSerializer.DeserializeFromStreamAsync<List<ScheduleDirect.Day>>(response.Content).ConfigureAwait(false);
|
||||
_logger.LogDebug("Found {ScheduleCount} programs on {ChannelID} ScheduleDirect", dailySchedules.Count, channelId);
|
||||
@@ -125,7 +125,7 @@ namespace Emby.Server.Implementations.LiveTv.Listings
|
||||
httpOptions.RequestContent = "[\"" + string.Join("\", \"", programsID) + "\"]";
|
||||
|
||||
using (var innerResponse = await Post(httpOptions, true, info).ConfigureAwait(false))
|
||||
using (StreamReader innerReader = new StreamReader(innerResponse.Content))
|
||||
using (var innerReader = new StreamReader(innerResponse.Content))
|
||||
{
|
||||
var programDetails = await _jsonSerializer.DeserializeFromStreamAsync<List<ScheduleDirect.ProgramDetails>>(innerResponse.Content).ConfigureAwait(false);
|
||||
var programDict = programDetails.ToDictionary(p => p.programID, y => y);
|
||||
@@ -136,8 +136,8 @@ namespace Emby.Server.Implementations.LiveTv.Listings
|
||||
|
||||
var images = await GetImageForPrograms(info, programIdsWithImages, cancellationToken).ConfigureAwait(false);
|
||||
|
||||
List<ProgramInfo> programsInfo = new List<ProgramInfo>();
|
||||
foreach (ScheduleDirect.Program schedule in dailySchedules.SelectMany(d => d.programs))
|
||||
var programsInfo = new List<ProgramInfo>();
|
||||
foreach (var schedule in dailySchedules.SelectMany(d => d.programs))
|
||||
{
|
||||
//_logger.LogDebug("Proccesing Schedule for statio ID " + stationID +
|
||||
// " which corresponds to channel " + channelNumber + " and program id " +
|
||||
@@ -222,9 +222,9 @@ namespace Emby.Server.Implementations.LiveTv.Listings
|
||||
|
||||
private ProgramInfo GetProgram(string channelId, ScheduleDirect.Program programInfo, ScheduleDirect.ProgramDetails details)
|
||||
{
|
||||
DateTime startAt = GetDate(programInfo.airDateTime);
|
||||
DateTime endAt = startAt.AddSeconds(programInfo.duration);
|
||||
ProgramAudio audioType = ProgramAudio.Stereo;
|
||||
var startAt = GetDate(programInfo.airDateTime);
|
||||
var endAt = startAt.AddSeconds(programInfo.duration);
|
||||
var audioType = ProgramAudio.Stereo;
|
||||
|
||||
var programId = programInfo.programID ?? string.Empty;
|
||||
|
||||
@@ -526,15 +526,15 @@ namespace Emby.Server.Implementations.LiveTv.Listings
|
||||
try
|
||||
{
|
||||
using (var httpResponse = await Get(options, false, info).ConfigureAwait(false))
|
||||
using (Stream responce = httpResponse.Content)
|
||||
using (var responce = httpResponse.Content)
|
||||
{
|
||||
var root = await _jsonSerializer.DeserializeFromStreamAsync<List<ScheduleDirect.Headends>>(responce).ConfigureAwait(false);
|
||||
|
||||
if (root != null)
|
||||
{
|
||||
foreach (ScheduleDirect.Headends headend in root)
|
||||
foreach (var headend in root)
|
||||
{
|
||||
foreach (ScheduleDirect.Lineup lineup in headend.lineups)
|
||||
foreach (var lineup in headend.lineups)
|
||||
{
|
||||
lineups.Add(new NameIdPair
|
||||
{
|
||||
@@ -887,7 +887,7 @@ namespace Emby.Server.Implementations.LiveTv.Listings
|
||||
|
||||
var allStations = root.stations ?? Enumerable.Empty<ScheduleDirect.Station>();
|
||||
|
||||
foreach (ScheduleDirect.Map map in root.map)
|
||||
foreach (var map in root.map)
|
||||
{
|
||||
var channelNumber = GetChannelNumber(map);
|
||||
|
||||
|
||||
@@ -269,7 +269,7 @@ namespace Jellyfin.Server.Implementations.LiveTv.Listings
|
||||
string path = await GetXml(info.Path, CancellationToken.None).ConfigureAwait(false);
|
||||
_logger.LogDebug("Opening XmlTvReader for {path}", path);
|
||||
var reader = new XmlTvReader(path, GetLanguage(info));
|
||||
IEnumerable<XmlTvChannel> results = reader.GetChannels();
|
||||
var results = reader.GetChannels();
|
||||
|
||||
// Should this method be async?
|
||||
return results.Select(c => new NameIdPair() { Id = c.Id, Name = c.DisplayName }).ToList();
|
||||
@@ -281,7 +281,7 @@ namespace Jellyfin.Server.Implementations.LiveTv.Listings
|
||||
string path = await GetXml(info.Path, cancellationToken).ConfigureAwait(false);
|
||||
_logger.LogDebug("Opening XmlTvReader for {path}", path);
|
||||
var reader = new XmlTvReader(path, GetLanguage(info));
|
||||
IEnumerable<XmlTvChannel> results = reader.GetChannels();
|
||||
var results = reader.GetChannels();
|
||||
|
||||
// Should this method be async?
|
||||
return results.Select(c => new ChannelInfo
|
||||
|
||||
@@ -242,7 +242,7 @@ namespace Emby.Server.Implementations.LiveTv
|
||||
var channel = (LiveTvChannel)_libraryManager.GetItemById(id);
|
||||
|
||||
bool isVideo = channel.ChannelType == ChannelType.TV;
|
||||
ILiveTvService service = GetService(channel);
|
||||
var service = GetService(channel);
|
||||
_logger.LogInformation("Opening channel stream from {0}, external channel Id: {1}", service.Name, channel.ExternalId);
|
||||
|
||||
MediaSourceInfo info;
|
||||
@@ -892,7 +892,7 @@ namespace Emby.Server.Implementations.LiveTv
|
||||
var programList = _libraryManager.QueryItems(internalQuery).Items;
|
||||
var totalCount = programList.Length;
|
||||
|
||||
IOrderedEnumerable<LiveTvProgram> orderedPrograms = programList.Cast<LiveTvProgram>().OrderBy(i => i.StartDate.Date);
|
||||
var orderedPrograms = programList.Cast<LiveTvProgram>().OrderBy(i => i.StartDate.Date);
|
||||
|
||||
if (query.IsAiring ?? false)
|
||||
{
|
||||
@@ -2302,7 +2302,7 @@ namespace Emby.Server.Implementations.LiveTv
|
||||
// ServerConfiguration.SaveConfiguration crashes during xml serialization for AddListingProvider
|
||||
info = _jsonSerializer.DeserializeFromString<ListingsProviderInfo>(_jsonSerializer.SerializeToString(info));
|
||||
|
||||
IListingsProvider provider = _listingProviders.FirstOrDefault(i => string.Equals(info.Type, i.Type, StringComparison.OrdinalIgnoreCase));
|
||||
var provider = _listingProviders.FirstOrDefault(i => string.Equals(info.Type, i.Type, StringComparison.OrdinalIgnoreCase));
|
||||
|
||||
if (provider == null)
|
||||
{
|
||||
@@ -2313,9 +2313,9 @@ namespace Emby.Server.Implementations.LiveTv
|
||||
|
||||
await provider.Validate(info, validateLogin, validateListings).ConfigureAwait(false);
|
||||
|
||||
LiveTvOptions config = GetConfiguration();
|
||||
var config = GetConfiguration();
|
||||
|
||||
List<ListingsProviderInfo> list = config.ListingProviders.ToList();
|
||||
var list = config.ListingProviders.ToList();
|
||||
int index = list.FindIndex(i => string.Equals(i.Id, info.Id, StringComparison.OrdinalIgnoreCase));
|
||||
|
||||
if (index == -1 || string.IsNullOrWhiteSpace(info.Id))
|
||||
|
||||
@@ -262,7 +262,7 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts.HdHomerun
|
||||
var name = string.Format("Tuner {0}", i + 1);
|
||||
var currentChannel = "none"; /// @todo Get current channel and map back to Station Id
|
||||
var isAvailable = await manager.CheckTunerAvailability(ipInfo, i, cancellationToken).ConfigureAwait(false);
|
||||
LiveTvTunerStatus status = isAvailable ? LiveTvTunerStatus.Available : LiveTvTunerStatus.LiveTv;
|
||||
var status = isAvailable ? LiveTvTunerStatus.Available : LiveTvTunerStatus.LiveTv;
|
||||
tuners.Add(new LiveTvTunerInfo
|
||||
{
|
||||
Name = name,
|
||||
|
||||
@@ -173,7 +173,7 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts.HdHomerun
|
||||
continue;
|
||||
|
||||
var commandList = commands.GetCommands();
|
||||
foreach (Tuple<string, string> command in commandList)
|
||||
foreach (var command in commandList)
|
||||
{
|
||||
var channelMsg = CreateSetMessage(i, command.Item1, command.Item2, lockKeyValue);
|
||||
await tcpClient.SendToAsync(channelMsg, 0, channelMsg.Length, ipEndPoint, cancellationToken).ConfigureAwait(false);
|
||||
@@ -216,7 +216,7 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts.HdHomerun
|
||||
var commandList = commands.GetCommands();
|
||||
var receiveBuffer = new byte[8192];
|
||||
|
||||
foreach (Tuple<string, string> command in commandList)
|
||||
foreach (var command in commandList)
|
||||
{
|
||||
var channelMsg = CreateSetMessage(_activeTuner, command.Item1, command.Item2, _lockkey);
|
||||
await tcpClient.SendToAsync(channelMsg, 0, channelMsg.Length, new IpEndPointInfo(_remoteIp, HdHomeRunPort), cancellationToken).ConfigureAwait(false);
|
||||
|
||||
@@ -19,10 +19,10 @@ namespace Emby.Server.Implementations.Net
|
||||
|
||||
//TODO Remove and reimplement using the IsDisposed property directly.
|
||||
/// <summary>
|
||||
/// Throws an <see cref="System.ObjectDisposedException"/> if the <see cref="IsDisposed"/> property is true.
|
||||
/// Throws an <see cref="ObjectDisposedException"/> if the <see cref="IsDisposed"/> property is true.
|
||||
/// </summary>
|
||||
/// <seealso cref="IsDisposed"/>
|
||||
/// <exception cref="System.ObjectDisposedException">Thrown if the <see cref="IsDisposed"/> property is true.</exception>
|
||||
/// <exception cref="ObjectDisposedException">Thrown if the <see cref="IsDisposed"/> property is true.</exception>
|
||||
/// <seealso cref="Dispose()"/>
|
||||
protected virtual void ThrowIfDisposed()
|
||||
{
|
||||
|
||||
@@ -133,8 +133,8 @@ namespace Emby.Server.Implementations.Net
|
||||
{
|
||||
ThrowIfDisposed();
|
||||
|
||||
IPEndPoint sender = new IPEndPoint(IPAddress.Any, 0);
|
||||
EndPoint remoteEndPoint = (EndPoint)sender;
|
||||
var sender = new IPEndPoint(IPAddress.Any, 0);
|
||||
var remoteEndPoint = (EndPoint)sender;
|
||||
|
||||
var receivedBytes = _Socket.EndReceiveFrom(result, ref remoteEndPoint);
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ namespace System.Net
|
||||
using System.Text;
|
||||
|
||||
/// <summary>
|
||||
/// Extension methods to convert <see cref="System.Numerics.BigInteger"/>
|
||||
/// Extension methods to convert <see cref="BigInteger"/>
|
||||
/// instances to hexadecimal, octal, and binary strings.
|
||||
/// </summary>
|
||||
public static class BigIntegerExtensions
|
||||
@@ -17,7 +17,7 @@ namespace System.Net
|
||||
/// </summary>
|
||||
/// <param name="bigint">A <see cref="BigInteger"/>.</param>
|
||||
/// <returns>
|
||||
/// A <see cref="System.String"/> containing a binary
|
||||
/// A <see cref="string"/> containing a binary
|
||||
/// representation of the supplied <see cref="BigInteger"/>.
|
||||
/// </returns>
|
||||
public static string ToBinaryString(this BigInteger bigint)
|
||||
@@ -54,7 +54,7 @@ namespace System.Net
|
||||
/// </summary>
|
||||
/// <param name="bigint">A <see cref="BigInteger"/>.</param>
|
||||
/// <returns>
|
||||
/// A <see cref="System.String"/> containing a hexadecimal
|
||||
/// A <see cref="string"/> containing a hexadecimal
|
||||
/// representation of the supplied <see cref="BigInteger"/>.
|
||||
/// </returns>
|
||||
public static string ToHexadecimalString(this BigInteger bigint)
|
||||
@@ -67,7 +67,7 @@ namespace System.Net
|
||||
/// </summary>
|
||||
/// <param name="bigint">A <see cref="BigInteger"/>.</param>
|
||||
/// <returns>
|
||||
/// A <see cref="System.String"/> containing an octal
|
||||
/// A <see cref="string"/> containing an octal
|
||||
/// representation of the supplied <see cref="BigInteger"/>.
|
||||
/// </returns>
|
||||
public static string ToOctalString(this BigInteger bigint)
|
||||
|
||||
@@ -30,7 +30,7 @@ namespace System.Net
|
||||
throw new ArgumentOutOfRangeException(nameof(i));
|
||||
}
|
||||
byte width = this._ipnetwork.AddressFamily == Sockets.AddressFamily.InterNetwork ? (byte)32 : (byte)128;
|
||||
IPNetworkCollection ipn = this._ipnetwork.Subnet(width);
|
||||
var ipn = this._ipnetwork.Subnet(width);
|
||||
return ipn[i].Network;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -33,7 +33,7 @@ namespace System.Net
|
||||
{
|
||||
get
|
||||
{
|
||||
BigInteger uintNetwork = this._ipaddress & this._netmask;
|
||||
var uintNetwork = this._ipaddress & this._netmask;
|
||||
return uintNetwork;
|
||||
}
|
||||
}
|
||||
@@ -61,7 +61,7 @@ namespace System.Net
|
||||
{
|
||||
|
||||
int width = this._family == Sockets.AddressFamily.InterNetwork ? 4 : 16;
|
||||
BigInteger uintBroadcast = this._network + this._netmask.PositiveReverse(width);
|
||||
var uintBroadcast = this._network + this._netmask.PositiveReverse(width);
|
||||
return uintBroadcast;
|
||||
}
|
||||
}
|
||||
@@ -88,7 +88,7 @@ namespace System.Net
|
||||
{
|
||||
get
|
||||
{
|
||||
BigInteger fisrt = this._family == Sockets.AddressFamily.InterNetworkV6
|
||||
var fisrt = this._family == Sockets.AddressFamily.InterNetworkV6
|
||||
? this._network
|
||||
: (this.Usable <= 0) ? this._network : this._network + 1;
|
||||
return IPNetwork.ToIPAddress(fisrt, this._family);
|
||||
@@ -102,7 +102,7 @@ namespace System.Net
|
||||
{
|
||||
get
|
||||
{
|
||||
BigInteger last = this._family == Sockets.AddressFamily.InterNetworkV6
|
||||
var last = this._family == Sockets.AddressFamily.InterNetworkV6
|
||||
? this._broadcast
|
||||
: (this.Usable <= 0) ? this._network : this._broadcast - 1;
|
||||
return IPNetwork.ToIPAddress(last, this._family);
|
||||
@@ -122,8 +122,8 @@ namespace System.Net
|
||||
return this.Total;
|
||||
}
|
||||
byte[] mask = new byte[] { 0xff, 0xff, 0xff, 0xff, 0x00 };
|
||||
BigInteger bmask = new BigInteger(mask);
|
||||
BigInteger usableIps = (_cidr > 30) ? 0 : ((bmask >> _cidr) - 1);
|
||||
var bmask = new BigInteger(mask);
|
||||
var usableIps = (_cidr > 30) ? 0 : ((bmask >> _cidr) - 1);
|
||||
return usableIps;
|
||||
}
|
||||
}
|
||||
@@ -137,7 +137,7 @@ namespace System.Net
|
||||
{
|
||||
|
||||
int max = this._family == Sockets.AddressFamily.InterNetwork ? 32 : 128;
|
||||
BigInteger count = BigInteger.Pow(2, (max - _cidr));
|
||||
var count = BigInteger.Pow(2, (max - _cidr));
|
||||
return count;
|
||||
}
|
||||
}
|
||||
@@ -523,7 +523,7 @@ namespace System.Net
|
||||
return;
|
||||
}
|
||||
|
||||
BigInteger uintIpAddress = IPNetwork.ToBigInteger(ipaddress);
|
||||
var uintIpAddress = IPNetwork.ToBigInteger(ipaddress);
|
||||
byte? cidr2 = null;
|
||||
bool parsed = IPNetwork.TryToCidr(netmask, out cidr2);
|
||||
if (parsed == false)
|
||||
@@ -537,7 +537,7 @@ namespace System.Net
|
||||
}
|
||||
byte cidr = (byte)cidr2;
|
||||
|
||||
IPNetwork ipnet = new IPNetwork(uintIpAddress, ipaddress.AddressFamily, cidr);
|
||||
var ipnet = new IPNetwork(uintIpAddress, ipaddress.AddressFamily, cidr);
|
||||
ipnetwork = ipnet;
|
||||
|
||||
return;
|
||||
@@ -754,7 +754,7 @@ namespace System.Net
|
||||
return;
|
||||
}
|
||||
|
||||
BigInteger mask = new BigInteger(new byte[] {
|
||||
var mask = new BigInteger(new byte[] {
|
||||
0xff, 0xff, 0xff, 0xff,
|
||||
0xff, 0xff, 0xff, 0xff,
|
||||
0xff, 0xff, 0xff, 0xff,
|
||||
@@ -762,7 +762,7 @@ namespace System.Net
|
||||
0x00
|
||||
});
|
||||
|
||||
BigInteger masked = cidr == 0 ? 0 : mask << (128 - cidr);
|
||||
var masked = cidr == 0 ? 0 : mask << (128 - cidr);
|
||||
byte[] m = masked.ToByteArray();
|
||||
byte[] bmask = new byte[17];
|
||||
int copy = m.Length > 16 ? 16 : m.Length;
|
||||
@@ -858,7 +858,7 @@ namespace System.Net
|
||||
/// cidr = null;
|
||||
/// return;
|
||||
/// }
|
||||
BigInteger uintNetmask = (BigInteger)uintNetmask2;
|
||||
var uintNetmask = (BigInteger)uintNetmask2;
|
||||
|
||||
byte? cidr2 = null;
|
||||
IPNetwork.InternalToCidr(tryParse, uintNetmask, netmask.AddressFamily, out cidr2);
|
||||
@@ -951,8 +951,8 @@ namespace System.Net
|
||||
return;
|
||||
}
|
||||
|
||||
BigInteger mask = IPNetwork.ToUint(cidr, family);
|
||||
IPAddress netmask2 = IPNetwork.ToIPAddress(mask, family);
|
||||
var mask = IPNetwork.ToUint(cidr, family);
|
||||
var netmask2 = IPNetwork.ToIPAddress(mask, family);
|
||||
netmask = netmask2;
|
||||
|
||||
return;
|
||||
@@ -990,7 +990,7 @@ namespace System.Net
|
||||
/// <returns></returns>
|
||||
public static uint BitsSet(IPAddress netmask)
|
||||
{
|
||||
BigInteger uintNetmask = IPNetwork.ToBigInteger(netmask);
|
||||
var uintNetmask = IPNetwork.ToBigInteger(netmask);
|
||||
uint bits = IPNetwork.BitsSet(uintNetmask, netmask.AddressFamily);
|
||||
return bits;
|
||||
}
|
||||
@@ -1013,7 +1013,7 @@ namespace System.Net
|
||||
{
|
||||
throw new ArgumentNullException(nameof(netmask));
|
||||
}
|
||||
BigInteger uintNetmask = IPNetwork.ToBigInteger(netmask);
|
||||
var uintNetmask = IPNetwork.ToBigInteger(netmask);
|
||||
bool valid = IPNetwork.InternalValidNetmask(uintNetmask, netmask.AddressFamily);
|
||||
return valid;
|
||||
}
|
||||
@@ -1042,7 +1042,7 @@ namespace System.Net
|
||||
0x00
|
||||
});
|
||||
|
||||
BigInteger neg = ((~netmask) & (mask));
|
||||
var neg = ((~netmask) & (mask));
|
||||
bool isNetmask = ((neg + 1) & neg) == 0;
|
||||
return isNetmask;
|
||||
|
||||
@@ -1068,7 +1068,7 @@ namespace System.Net
|
||||
Array.Reverse(bytes2);
|
||||
|
||||
byte[] sized = Resize(bytes2, family);
|
||||
IPAddress ip = new IPAddress(sized);
|
||||
var ip = new IPAddress(sized);
|
||||
return ip;
|
||||
}
|
||||
|
||||
@@ -1122,9 +1122,9 @@ namespace System.Net
|
||||
return false;
|
||||
}
|
||||
|
||||
BigInteger uintNetwork = _network;
|
||||
BigInteger uintBroadcast = _broadcast;
|
||||
BigInteger uintAddress = IPNetwork.ToBigInteger(ipaddress);
|
||||
var uintNetwork = _network;
|
||||
var uintBroadcast = _broadcast;
|
||||
var uintAddress = IPNetwork.ToBigInteger(ipaddress);
|
||||
|
||||
bool contains = (uintAddress >= uintNetwork
|
||||
&& uintAddress <= uintBroadcast);
|
||||
@@ -1146,11 +1146,11 @@ namespace System.Net
|
||||
throw new ArgumentNullException(nameof(network2));
|
||||
}
|
||||
|
||||
BigInteger uintNetwork = _network;
|
||||
BigInteger uintBroadcast = _broadcast;
|
||||
var uintNetwork = _network;
|
||||
var uintBroadcast = _broadcast;
|
||||
|
||||
BigInteger uintFirst = network2._network;
|
||||
BigInteger uintLast = network2._broadcast;
|
||||
var uintFirst = network2._network;
|
||||
var uintLast = network2._broadcast;
|
||||
|
||||
bool contains = (uintFirst >= uintNetwork
|
||||
&& uintLast <= uintBroadcast);
|
||||
@@ -1175,11 +1175,11 @@ namespace System.Net
|
||||
throw new ArgumentNullException(nameof(network2));
|
||||
}
|
||||
|
||||
BigInteger uintNetwork = _network;
|
||||
BigInteger uintBroadcast = _broadcast;
|
||||
var uintNetwork = _network;
|
||||
var uintBroadcast = _broadcast;
|
||||
|
||||
BigInteger uintFirst = network2._network;
|
||||
BigInteger uintLast = network2._broadcast;
|
||||
var uintFirst = network2._network;
|
||||
var uintLast = network2._broadcast;
|
||||
|
||||
bool overlap =
|
||||
(uintFirst >= uintNetwork && uintFirst <= uintBroadcast)
|
||||
@@ -1428,8 +1428,8 @@ namespace System.Net
|
||||
return;
|
||||
}
|
||||
|
||||
IPNetwork first = (network1._network < network2._network) ? network1 : network2;
|
||||
IPNetwork last = (network1._network > network2._network) ? network1 : network2;
|
||||
var first = (network1._network < network2._network) ? network1 : network2;
|
||||
var last = (network1._network > network2._network) ? network1 : network2;
|
||||
|
||||
/// Starting from here :
|
||||
/// network1 and network2 have the same cidr,
|
||||
@@ -1449,10 +1449,10 @@ namespace System.Net
|
||||
return;
|
||||
}
|
||||
|
||||
BigInteger uintSupernet = first._network;
|
||||
var uintSupernet = first._network;
|
||||
byte cidrSupernet = (byte)(first._cidr - 1);
|
||||
|
||||
IPNetwork networkSupernet = new IPNetwork(uintSupernet, first._family, cidrSupernet);
|
||||
var networkSupernet = new IPNetwork(uintSupernet, first._family, cidrSupernet);
|
||||
if (networkSupernet._network != first._network)
|
||||
{
|
||||
if (trySupernet == false)
|
||||
@@ -1535,9 +1535,9 @@ namespace System.Net
|
||||
return true;
|
||||
}
|
||||
|
||||
List<IPNetwork> supernetted = new List<IPNetwork>();
|
||||
List<IPNetwork> ipns = IPNetwork.Array2List(ipnetworks);
|
||||
Stack<IPNetwork> current = IPNetwork.List2Stack(ipns);
|
||||
var supernetted = new List<IPNetwork>();
|
||||
var ipns = IPNetwork.Array2List(ipnetworks);
|
||||
var current = IPNetwork.List2Stack(ipns);
|
||||
int previousCount = 0;
|
||||
int currentCount = current.Count;
|
||||
|
||||
@@ -1547,8 +1547,8 @@ namespace System.Net
|
||||
supernetted.Clear();
|
||||
while (current.Count > 1)
|
||||
{
|
||||
IPNetwork ipn1 = current.Pop();
|
||||
IPNetwork ipn2 = current.Peek();
|
||||
var ipn1 = current.Pop();
|
||||
var ipn2 = current.Peek();
|
||||
|
||||
IPNetwork outNetwork = null;
|
||||
bool success = ipn1.TrySupernet(ipn2, out outNetwork);
|
||||
@@ -1578,7 +1578,7 @@ namespace System.Net
|
||||
|
||||
private static Stack<IPNetwork> List2Stack(List<IPNetwork> list)
|
||||
{
|
||||
Stack<IPNetwork> stack = new Stack<IPNetwork>();
|
||||
var stack = new Stack<IPNetwork>();
|
||||
list.ForEach(new Action<IPNetwork>(
|
||||
delegate (IPNetwork ipn)
|
||||
{
|
||||
@@ -1590,7 +1590,7 @@ namespace System.Net
|
||||
|
||||
private static List<IPNetwork> Array2List(IPNetwork[] array)
|
||||
{
|
||||
List<IPNetwork> ipns = new List<IPNetwork>();
|
||||
var ipns = new List<IPNetwork>();
|
||||
ipns.AddRange(array);
|
||||
IPNetwork.RemoveNull(ipns);
|
||||
ipns.Sort(new Comparison<IPNetwork>(
|
||||
@@ -1659,10 +1659,10 @@ namespace System.Net
|
||||
throw new NotSupportedException("MixedAddressFamily");
|
||||
}
|
||||
|
||||
IPNetwork ipnetwork = new IPNetwork(0, startIP.AddressFamily, 0);
|
||||
var ipnetwork = new IPNetwork(0, startIP.AddressFamily, 0);
|
||||
for (byte cidr = 32; cidr >= 0; cidr--)
|
||||
{
|
||||
IPNetwork wideSubnet = IPNetwork.Parse(start, cidr);
|
||||
var wideSubnet = IPNetwork.Parse(start, cidr);
|
||||
if (wideSubnet.Contains(endIP))
|
||||
{
|
||||
ipnetwork = wideSubnet;
|
||||
@@ -1707,7 +1707,7 @@ namespace System.Net
|
||||
}
|
||||
|
||||
|
||||
IPNetwork[] nnin = Array.FindAll<IPNetwork>(ipnetworks, new Predicate<IPNetwork>(
|
||||
IPNetwork[] nnin = Array.FindAll(ipnetworks, new Predicate<IPNetwork>(
|
||||
delegate (IPNetwork ipnet)
|
||||
{
|
||||
return ipnet != null;
|
||||
@@ -1726,19 +1726,19 @@ namespace System.Net
|
||||
|
||||
if (nnin.Length == 1)
|
||||
{
|
||||
IPNetwork ipn0 = nnin[0];
|
||||
var ipn0 = nnin[0];
|
||||
ipnetwork = ipn0;
|
||||
return;
|
||||
}
|
||||
|
||||
Array.Sort<IPNetwork>(nnin);
|
||||
IPNetwork nnin0 = nnin[0];
|
||||
BigInteger uintNnin0 = nnin0._ipaddress;
|
||||
Array.Sort(nnin);
|
||||
var nnin0 = nnin[0];
|
||||
var uintNnin0 = nnin0._ipaddress;
|
||||
|
||||
IPNetwork nninX = nnin[nnin.Length - 1];
|
||||
IPAddress ipaddressX = nninX.Broadcast;
|
||||
var nninX = nnin[nnin.Length - 1];
|
||||
var ipaddressX = nninX.Broadcast;
|
||||
|
||||
AddressFamily family = ipnetworks[0]._family;
|
||||
var family = ipnetworks[0]._family;
|
||||
foreach (var ipnx in ipnetworks)
|
||||
{
|
||||
if (ipnx._family != family)
|
||||
@@ -1747,10 +1747,10 @@ namespace System.Net
|
||||
}
|
||||
}
|
||||
|
||||
IPNetwork ipn = new IPNetwork(0, family, 0);
|
||||
var ipn = new IPNetwork(0, family, 0);
|
||||
for (byte cidr = nnin0._cidr; cidr >= 0; cidr--)
|
||||
{
|
||||
IPNetwork wideSubnet = new IPNetwork(uintNnin0, family, cidr);
|
||||
var wideSubnet = new IPNetwork(uintNnin0, family, cidr);
|
||||
if (wideSubnet.Contains(ipaddressX))
|
||||
{
|
||||
ipn = wideSubnet;
|
||||
@@ -1773,7 +1773,7 @@ namespace System.Net
|
||||
public string Print()
|
||||
{
|
||||
|
||||
StringWriter sw = new StringWriter();
|
||||
var sw = new StringWriter();
|
||||
|
||||
sw.WriteLine("IPNetwork : {0}", ToString());
|
||||
sw.WriteLine("Network : {0}", Network);
|
||||
@@ -1819,7 +1819,7 @@ namespace System.Net
|
||||
cidr = 64;
|
||||
return true;
|
||||
}
|
||||
BigInteger uintIPAddress = IPNetwork.ToBigInteger(ipaddress);
|
||||
var uintIPAddress = IPNetwork.ToBigInteger(ipaddress);
|
||||
uintIPAddress = uintIPAddress >> 29;
|
||||
if (uintIPAddress <= 3)
|
||||
{
|
||||
|
||||
@@ -47,7 +47,7 @@ namespace System.Net
|
||||
{
|
||||
get
|
||||
{
|
||||
BigInteger count = BigInteger.Pow(2, this._cidrSubnet - this._cidr);
|
||||
var count = BigInteger.Pow(2, this._cidrSubnet - this._cidr);
|
||||
return count;
|
||||
}
|
||||
}
|
||||
@@ -61,11 +61,11 @@ namespace System.Net
|
||||
throw new ArgumentOutOfRangeException(nameof(i));
|
||||
}
|
||||
|
||||
BigInteger last = this._ipnetwork.AddressFamily == Sockets.AddressFamily.InterNetworkV6
|
||||
var last = this._ipnetwork.AddressFamily == Sockets.AddressFamily.InterNetworkV6
|
||||
? this._lastUsable : this._broadcast;
|
||||
BigInteger increment = (last - this._network) / this.Count;
|
||||
BigInteger uintNetwork = this._network + ((increment + 1) * i);
|
||||
IPNetwork ipn = new IPNetwork(uintNetwork, this._ipnetwork.AddressFamily, this._cidrSubnet);
|
||||
var increment = (last - this._network) / this.Count;
|
||||
var uintNetwork = this._network + ((increment + 1) * i);
|
||||
var ipn = new IPNetwork(uintNetwork, this._ipnetwork.AddressFamily, this._cidrSubnet);
|
||||
return ipn;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -214,9 +214,9 @@ namespace Emby.Server.Implementations.Networking
|
||||
|
||||
subnets = new List<string>();
|
||||
|
||||
foreach (NetworkInterface adapter in NetworkInterface.GetAllNetworkInterfaces())
|
||||
foreach (var adapter in NetworkInterface.GetAllNetworkInterfaces())
|
||||
{
|
||||
foreach (UnicastIPAddressInformation unicastIPAddressInformation in adapter.GetIPProperties().UnicastAddresses)
|
||||
foreach (var unicastIPAddressInformation in adapter.GetIPProperties().UnicastAddresses)
|
||||
{
|
||||
if (unicastIPAddressInformation.Address.AddressFamily == AddressFamily.InterNetwork && endpointFirstPart == unicastIPAddressInformation.Address.ToString().Split('.')[0])
|
||||
{
|
||||
@@ -461,7 +461,7 @@ namespace Emby.Server.Implementations.Networking
|
||||
|
||||
public int GetRandomUnusedUdpPort()
|
||||
{
|
||||
IPEndPoint localEndPoint = new IPEndPoint(IPAddress.Any, 0);
|
||||
var localEndPoint = new IPEndPoint(IPAddress.Any, 0);
|
||||
using (var udpClient = new UdpClient(localEndPoint))
|
||||
{
|
||||
var port = ((IPEndPoint)(udpClient.Client.LocalEndPoint)).Port;
|
||||
@@ -522,8 +522,8 @@ namespace Emby.Server.Implementations.Networking
|
||||
/// <param name="endpointstring">The endpointstring.</param>
|
||||
/// <param name="defaultport">The defaultport.</param>
|
||||
/// <returns>IPEndPoint.</returns>
|
||||
/// <exception cref="System.ArgumentException">Endpoint descriptor may not be empty.</exception>
|
||||
/// <exception cref="System.FormatException"></exception>
|
||||
/// <exception cref="ArgumentException">Endpoint descriptor may not be empty.</exception>
|
||||
/// <exception cref="FormatException"></exception>
|
||||
private static async Task<IPEndPoint> Parse(string endpointstring, int defaultport)
|
||||
{
|
||||
if (string.IsNullOrEmpty(endpointstring)
|
||||
@@ -585,7 +585,7 @@ namespace Emby.Server.Implementations.Networking
|
||||
/// </summary>
|
||||
/// <param name="p">The p.</param>
|
||||
/// <returns>System.Int32.</returns>
|
||||
/// <exception cref="System.FormatException"></exception>
|
||||
/// <exception cref="FormatException"></exception>
|
||||
private static int GetPort(string p)
|
||||
{
|
||||
int port;
|
||||
@@ -605,7 +605,7 @@ namespace Emby.Server.Implementations.Networking
|
||||
/// </summary>
|
||||
/// <param name="p">The p.</param>
|
||||
/// <returns>IPAddress.</returns>
|
||||
/// <exception cref="System.ArgumentException"></exception>
|
||||
/// <exception cref="ArgumentException"></exception>
|
||||
private static async Task<IPAddress> GetIPfromHost(string p)
|
||||
{
|
||||
var hosts = await Dns.GetHostAddressesAsync(p).ConfigureAwait(false);
|
||||
|
||||
@@ -469,12 +469,12 @@ namespace Emby.Server.Implementations.Playlists
|
||||
folderPath = folderPath + Path.DirectorySeparatorChar;
|
||||
}
|
||||
|
||||
Uri folderUri = new Uri(folderPath);
|
||||
Uri fileAbsoluteUri = new Uri(fileAbsolutePath);
|
||||
var folderUri = new Uri(folderPath);
|
||||
var fileAbsoluteUri = new Uri(fileAbsolutePath);
|
||||
|
||||
if (folderUri.Scheme != fileAbsoluteUri.Scheme) { return fileAbsolutePath; } // path can't be made relative.
|
||||
|
||||
Uri relativeUri = folderUri.MakeRelativeUri(fileAbsoluteUri);
|
||||
var relativeUri = folderUri.MakeRelativeUri(fileAbsoluteUri);
|
||||
string relativePath = Uri.UnescapeDataString(relativeUri.ToString());
|
||||
|
||||
if (fileAbsoluteUri.Scheme.Equals("file", StringComparison.CurrentCultureIgnoreCase))
|
||||
|
||||
@@ -63,7 +63,7 @@ namespace Emby.Server.Implementations.ScheduledTasks
|
||||
/// <param name="taskManager">The task manager.</param>
|
||||
/// <param name="jsonSerializer">The json serializer.</param>
|
||||
/// <param name="logger">The logger.</param>
|
||||
/// <exception cref="System.ArgumentNullException">
|
||||
/// <exception cref="ArgumentNullException">
|
||||
/// scheduledTask
|
||||
/// or
|
||||
/// applicationPaths
|
||||
@@ -256,7 +256,7 @@ namespace Emby.Server.Implementations.ScheduledTasks
|
||||
/// Gets the triggers that define when the task will run
|
||||
/// </summary>
|
||||
/// <value>The triggers.</value>
|
||||
/// <exception cref="System.ArgumentNullException">value</exception>
|
||||
/// <exception cref="ArgumentNullException">value</exception>
|
||||
public TaskTriggerInfo[] Triggers
|
||||
{
|
||||
get
|
||||
@@ -365,7 +365,7 @@ namespace Emby.Server.Implementations.ScheduledTasks
|
||||
/// </summary>
|
||||
/// <param name="options">Task options.</param>
|
||||
/// <returns>Task.</returns>
|
||||
/// <exception cref="System.InvalidOperationException">Cannot execute a Task that is already running</exception>
|
||||
/// <exception cref="InvalidOperationException">Cannot execute a Task that is already running</exception>
|
||||
public async Task Execute(TaskOptions options)
|
||||
{
|
||||
var task = Task.Run(async () => await ExecuteInternal(options).ConfigureAwait(false));
|
||||
@@ -461,7 +461,7 @@ namespace Emby.Server.Implementations.ScheduledTasks
|
||||
/// <summary>
|
||||
/// Stops the task if it is currently executing
|
||||
/// </summary>
|
||||
/// <exception cref="System.InvalidOperationException">Cannot cancel a Task unless it is in the Running state.</exception>
|
||||
/// <exception cref="InvalidOperationException">Cannot cancel a Task unless it is in the Running state.</exception>
|
||||
public void Cancel()
|
||||
{
|
||||
if (State != TaskState.Running)
|
||||
@@ -705,8 +705,8 @@ namespace Emby.Server.Implementations.ScheduledTasks
|
||||
/// </summary>
|
||||
/// <param name="info">The info.</param>
|
||||
/// <returns>BaseTaskTrigger.</returns>
|
||||
/// <exception cref="System.ArgumentNullException"></exception>
|
||||
/// <exception cref="System.ArgumentException">Invalid trigger type: + info.Type</exception>
|
||||
/// <exception cref="ArgumentNullException"></exception>
|
||||
/// <exception cref="ArgumentException">Invalid trigger type: + info.Type</exception>
|
||||
private ITaskTrigger GetTrigger(TaskTriggerInfo info)
|
||||
{
|
||||
var options = new TaskOptions
|
||||
|
||||
@@ -61,7 +61,7 @@ namespace Emby.Server.Implementations.ScheduledTasks
|
||||
/// <param name="applicationPaths">The application paths.</param>
|
||||
/// <param name="jsonSerializer">The json serializer.</param>
|
||||
/// <param name="logger">The logger.</param>
|
||||
/// <exception cref="System.ArgumentException">kernel</exception>
|
||||
/// <exception cref="ArgumentException">kernel</exception>
|
||||
public TaskManager(IApplicationPaths applicationPaths, IJsonSerializer jsonSerializer, ILogger logger, IFileSystem fileSystem, ISystemEvents systemEvents)
|
||||
{
|
||||
ApplicationPaths = applicationPaths;
|
||||
|
||||
@@ -11,7 +11,7 @@ namespace Emby.Server.Implementations.Security
|
||||
/// </summary>
|
||||
/// <param name="value">The value.</param>
|
||||
/// <returns>System.String.</returns>
|
||||
/// <exception cref="System.ArgumentNullException">value</exception>
|
||||
/// <exception cref="ArgumentNullException">value</exception>
|
||||
public string EncryptString(string value)
|
||||
{
|
||||
if (value == null)
|
||||
@@ -27,7 +27,7 @@ namespace Emby.Server.Implementations.Security
|
||||
/// </summary>
|
||||
/// <param name="value">The value.</param>
|
||||
/// <returns>System.String.</returns>
|
||||
/// <exception cref="System.ArgumentNullException">value</exception>
|
||||
/// <exception cref="ArgumentNullException">value</exception>
|
||||
public string DecryptString(string value)
|
||||
{
|
||||
if (value == null)
|
||||
|
||||
@@ -27,7 +27,7 @@ namespace Emby.Common.Implementations.Serialization
|
||||
/// </summary>
|
||||
/// <param name="obj">The obj.</param>
|
||||
/// <param name="stream">The stream.</param>
|
||||
/// <exception cref="System.ArgumentNullException">obj</exception>
|
||||
/// <exception cref="ArgumentNullException">obj</exception>
|
||||
public void SerializeToStream(object obj, Stream stream)
|
||||
{
|
||||
if (obj == null)
|
||||
@@ -48,7 +48,7 @@ namespace Emby.Common.Implementations.Serialization
|
||||
/// </summary>
|
||||
/// <param name="obj">The obj.</param>
|
||||
/// <param name="file">The file.</param>
|
||||
/// <exception cref="System.ArgumentNullException">obj</exception>
|
||||
/// <exception cref="ArgumentNullException">obj</exception>
|
||||
public void SerializeToFile(object obj, string file)
|
||||
{
|
||||
if (obj == null)
|
||||
@@ -61,7 +61,7 @@ namespace Emby.Common.Implementations.Serialization
|
||||
throw new ArgumentNullException(nameof(file));
|
||||
}
|
||||
|
||||
using (Stream stream = _fileSystem.GetFileStream(file, FileOpenMode.Create, FileAccessMode.Write, FileShareMode.Read))
|
||||
using (var stream = _fileSystem.GetFileStream(file, FileOpenMode.Create, FileAccessMode.Write, FileShareMode.Read))
|
||||
{
|
||||
SerializeToStream(obj, stream);
|
||||
}
|
||||
@@ -79,7 +79,7 @@ namespace Emby.Common.Implementations.Serialization
|
||||
/// <param name="type">The type.</param>
|
||||
/// <param name="file">The file.</param>
|
||||
/// <returns>System.Object.</returns>
|
||||
/// <exception cref="System.ArgumentNullException">type</exception>
|
||||
/// <exception cref="ArgumentNullException">type</exception>
|
||||
public object DeserializeFromFile(Type type, string file)
|
||||
{
|
||||
if (type == null)
|
||||
@@ -92,7 +92,7 @@ namespace Emby.Common.Implementations.Serialization
|
||||
throw new ArgumentNullException(nameof(file));
|
||||
}
|
||||
|
||||
using (Stream stream = OpenFile(file))
|
||||
using (var stream = OpenFile(file))
|
||||
{
|
||||
return DeserializeFromStream(stream, type);
|
||||
}
|
||||
@@ -104,7 +104,7 @@ namespace Emby.Common.Implementations.Serialization
|
||||
/// <typeparam name="T"></typeparam>
|
||||
/// <param name="file">The file.</param>
|
||||
/// <returns>``0.</returns>
|
||||
/// <exception cref="System.ArgumentNullException">file</exception>
|
||||
/// <exception cref="ArgumentNullException">file</exception>
|
||||
public T DeserializeFromFile<T>(string file)
|
||||
where T : class
|
||||
{
|
||||
@@ -113,7 +113,7 @@ namespace Emby.Common.Implementations.Serialization
|
||||
throw new ArgumentNullException(nameof(file));
|
||||
}
|
||||
|
||||
using (Stream stream = OpenFile(file))
|
||||
using (var stream = OpenFile(file))
|
||||
{
|
||||
return DeserializeFromStream<T>(stream);
|
||||
}
|
||||
@@ -125,7 +125,7 @@ namespace Emby.Common.Implementations.Serialization
|
||||
/// <typeparam name="T"></typeparam>
|
||||
/// <param name="stream">The stream.</param>
|
||||
/// <returns>``0.</returns>
|
||||
/// <exception cref="System.ArgumentNullException">stream</exception>
|
||||
/// <exception cref="ArgumentNullException">stream</exception>
|
||||
public T DeserializeFromStream<T>(Stream stream)
|
||||
{
|
||||
if (stream == null)
|
||||
@@ -153,7 +153,7 @@ namespace Emby.Common.Implementations.Serialization
|
||||
/// <typeparam name="T"></typeparam>
|
||||
/// <param name="text">The text.</param>
|
||||
/// <returns>``0.</returns>
|
||||
/// <exception cref="System.ArgumentNullException">text</exception>
|
||||
/// <exception cref="ArgumentNullException">text</exception>
|
||||
public T DeserializeFromString<T>(string text)
|
||||
{
|
||||
if (string.IsNullOrEmpty(text))
|
||||
@@ -170,7 +170,7 @@ namespace Emby.Common.Implementations.Serialization
|
||||
/// <param name="stream">The stream.</param>
|
||||
/// <param name="type">The type.</param>
|
||||
/// <returns>System.Object.</returns>
|
||||
/// <exception cref="System.ArgumentNullException">stream</exception>
|
||||
/// <exception cref="ArgumentNullException">stream</exception>
|
||||
public object DeserializeFromStream(Stream stream, Type type)
|
||||
{
|
||||
if (stream == null)
|
||||
@@ -236,7 +236,7 @@ namespace Emby.Common.Implementations.Serialization
|
||||
/// <param name="json">The json.</param>
|
||||
/// <param name="type">The type.</param>
|
||||
/// <returns>System.Object.</returns>
|
||||
/// <exception cref="System.ArgumentNullException">json</exception>
|
||||
/// <exception cref="ArgumentNullException">json</exception>
|
||||
public object DeserializeFromString(string json, Type type)
|
||||
{
|
||||
if (string.IsNullOrEmpty(json))
|
||||
@@ -257,7 +257,7 @@ namespace Emby.Common.Implementations.Serialization
|
||||
/// </summary>
|
||||
/// <param name="obj">The obj.</param>
|
||||
/// <returns>System.String.</returns>
|
||||
/// <exception cref="System.ArgumentNullException">obj</exception>
|
||||
/// <exception cref="ArgumentNullException">obj</exception>
|
||||
public string SerializeToString(object obj)
|
||||
{
|
||||
if (obj == null)
|
||||
|
||||
@@ -72,7 +72,7 @@ namespace Emby.Server.Implementations.Services
|
||||
public void RegisterRestPaths(HttpListenerHost appHost, Type requestType, Type serviceType)
|
||||
{
|
||||
var attrs = appHost.GetRouteAttributes(requestType);
|
||||
foreach (RouteAttribute attr in attrs)
|
||||
foreach (var attr in attrs)
|
||||
{
|
||||
var restPath = new RestPath(appHost.CreateInstance, appHost.GetParseFn, requestType, serviceType, attr.Path, attr.Verbs, attr.IsHidden, attr.Summary, attr.Description);
|
||||
|
||||
|
||||
@@ -201,8 +201,8 @@ namespace Emby.Server.Implementations.Session
|
||||
/// <param name="remoteEndPoint">The remote end point.</param>
|
||||
/// <param name="user">The user.</param>
|
||||
/// <returns>Task.</returns>
|
||||
/// <exception cref="System.ArgumentNullException">user</exception>
|
||||
/// <exception cref="System.UnauthorizedAccessException"></exception>
|
||||
/// <exception cref="ArgumentNullException">user</exception>
|
||||
/// <exception cref="UnauthorizedAccessException"></exception>
|
||||
public SessionInfo LogSessionActivity(string appName,
|
||||
string appVersion,
|
||||
string deviceId,
|
||||
@@ -365,7 +365,7 @@ namespace Emby.Server.Implementations.Session
|
||||
/// Removes the now playing item id.
|
||||
/// </summary>
|
||||
/// <param name="session">The session.</param>
|
||||
/// <exception cref="System.ArgumentNullException">item</exception>
|
||||
/// <exception cref="ArgumentNullException">item</exception>
|
||||
private void RemoveNowPlayingItem(SessionInfo session)
|
||||
{
|
||||
session.NowPlayingItem = null;
|
||||
@@ -404,7 +404,7 @@ namespace Emby.Server.Implementations.Session
|
||||
|
||||
CheckDisposed();
|
||||
|
||||
SessionInfo sessionInfo = _activeConnections.GetOrAdd(key, k =>
|
||||
var sessionInfo = _activeConnections.GetOrAdd(key, k =>
|
||||
{
|
||||
return CreateSession(k, appName, appVersion, deviceId, deviceName, remoteEndPoint, user);
|
||||
});
|
||||
@@ -571,7 +571,7 @@ namespace Emby.Server.Implementations.Session
|
||||
/// </summary>
|
||||
/// <param name="info">The info.</param>
|
||||
/// <returns>Task.</returns>
|
||||
/// <exception cref="System.ArgumentNullException">info</exception>
|
||||
/// <exception cref="ArgumentNullException">info</exception>
|
||||
public async Task OnPlaybackStart(PlaybackStartInfo info)
|
||||
{
|
||||
CheckDisposed();
|
||||
@@ -784,8 +784,8 @@ namespace Emby.Server.Implementations.Session
|
||||
/// </summary>
|
||||
/// <param name="info">The info.</param>
|
||||
/// <returns>Task.</returns>
|
||||
/// <exception cref="System.ArgumentNullException">info</exception>
|
||||
/// <exception cref="System.ArgumentOutOfRangeException">positionTicks</exception>
|
||||
/// <exception cref="ArgumentNullException">info</exception>
|
||||
/// <exception cref="ArgumentOutOfRangeException">positionTicks</exception>
|
||||
public async Task OnPlaybackStopped(PlaybackStopInfo info)
|
||||
{
|
||||
CheckDisposed();
|
||||
@@ -1284,8 +1284,8 @@ namespace Emby.Server.Implementations.Session
|
||||
/// </summary>
|
||||
/// <param name="sessionId">The session identifier.</param>
|
||||
/// <param name="userId">The user identifier.</param>
|
||||
/// <exception cref="System.UnauthorizedAccessException">Cannot modify additional users without authenticating first.</exception>
|
||||
/// <exception cref="System.ArgumentException">The requested user is already the primary user of the session.</exception>
|
||||
/// <exception cref="UnauthorizedAccessException">Cannot modify additional users without authenticating first.</exception>
|
||||
/// <exception cref="ArgumentException">The requested user is already the primary user of the session.</exception>
|
||||
public void AddAdditionalUser(string sessionId, Guid userId)
|
||||
{
|
||||
CheckDisposed();
|
||||
@@ -1318,8 +1318,8 @@ namespace Emby.Server.Implementations.Session
|
||||
/// </summary>
|
||||
/// <param name="sessionId">The session identifier.</param>
|
||||
/// <param name="userId">The user identifier.</param>
|
||||
/// <exception cref="System.UnauthorizedAccessException">Cannot modify additional users without authenticating first.</exception>
|
||||
/// <exception cref="System.ArgumentException">The requested user is already the primary user of the session.</exception>
|
||||
/// <exception cref="UnauthorizedAccessException">Cannot modify additional users without authenticating first.</exception>
|
||||
/// <exception cref="ArgumentException">The requested user is already the primary user of the session.</exception>
|
||||
public void RemoveAdditionalUser(string sessionId, Guid userId)
|
||||
{
|
||||
CheckDisposed();
|
||||
|
||||
@@ -29,8 +29,8 @@ namespace Emby.Server.Implementations.Sorting
|
||||
char thisCh = s1[thisMarker];
|
||||
char thatCh = s2[thatMarker];
|
||||
|
||||
StringBuilder thisChunk = new StringBuilder();
|
||||
StringBuilder thatChunk = new StringBuilder();
|
||||
var thisChunk = new StringBuilder();
|
||||
var thatChunk = new StringBuilder();
|
||||
|
||||
while ((thisMarker < s1.Length) && (thisChunk.Length == 0 || SortHelper.InChunk(thisCh, thisChunk[0])))
|
||||
{
|
||||
|
||||
@@ -118,7 +118,7 @@ namespace Emby.Server.Implementations.TV
|
||||
OrderBy = new[] { new ValueTuple<string, SortOrder>(ItemSortBy.DatePlayed, SortOrder.Descending) },
|
||||
SeriesPresentationUniqueKey = presentationUniqueKey,
|
||||
Limit = limit,
|
||||
DtoOptions = new MediaBrowser.Controller.Dto.DtoOptions
|
||||
DtoOptions = new DtoOptions
|
||||
{
|
||||
Fields = new ItemFields[]
|
||||
{
|
||||
@@ -196,7 +196,7 @@ namespace Emby.Server.Implementations.TV
|
||||
IsPlayed = true,
|
||||
Limit = 1,
|
||||
ParentIndexNumberNotEquals = 0,
|
||||
DtoOptions = new MediaBrowser.Controller.Dto.DtoOptions
|
||||
DtoOptions = new DtoOptions
|
||||
{
|
||||
Fields = new ItemFields[]
|
||||
{
|
||||
|
||||
@@ -164,7 +164,7 @@ namespace NLangDetect.Core
|
||||
|
||||
public string Detect()
|
||||
{
|
||||
List<Language> probabilities = GetProbabilities();
|
||||
var probabilities = GetProbabilities();
|
||||
|
||||
return
|
||||
probabilities.Count > 0
|
||||
@@ -179,7 +179,7 @@ namespace NLangDetect.Core
|
||||
DetectBlock();
|
||||
}
|
||||
|
||||
List<Language> list = SortProbability(_langprob);
|
||||
var list = SortProbability(_langprob);
|
||||
|
||||
return list;
|
||||
}
|
||||
@@ -241,7 +241,7 @@ namespace NLangDetect.Core
|
||||
{
|
||||
CleanText();
|
||||
|
||||
List<string> ngrams = ExtractNGrams();
|
||||
var ngrams = ExtractNGrams();
|
||||
|
||||
if (ngrams.Count == 0)
|
||||
{
|
||||
@@ -250,7 +250,7 @@ namespace NLangDetect.Core
|
||||
|
||||
_langprob = new double[_langlist.Count];
|
||||
|
||||
Random rand = (_seed.HasValue ? new Random(_seed.Value) : new Random());
|
||||
var rand = (_seed.HasValue ? new Random(_seed.Value) : new Random());
|
||||
|
||||
for (int t = 0; t < _trialsCount; t++)
|
||||
{
|
||||
@@ -305,7 +305,7 @@ namespace NLangDetect.Core
|
||||
private List<string> ExtractNGrams()
|
||||
{
|
||||
var list = new List<string>();
|
||||
NGram ngram = new NGram();
|
||||
var ngram = new NGram();
|
||||
|
||||
for (int i = 0; i < _text.Length; i++)
|
||||
{
|
||||
@@ -332,7 +332,7 @@ namespace NLangDetect.Core
|
||||
return;
|
||||
}
|
||||
|
||||
ProbVector langProbMap = _wordLangProbMap[word];
|
||||
var langProbMap = _wordLangProbMap[word];
|
||||
double weight = alpha / _BaseFreq;
|
||||
|
||||
for (int i = 0; i < prob.Length; i++)
|
||||
|
||||
@@ -54,7 +54,7 @@ namespace NLangDetect.Core
|
||||
|
||||
public static Detector Create(double alpha)
|
||||
{
|
||||
Detector detector = CreateDetector();
|
||||
var detector = CreateDetector();
|
||||
|
||||
detector.SetAlpha(alpha);
|
||||
|
||||
|
||||
@@ -13,8 +13,8 @@ namespace NLangDetect.Core
|
||||
|
||||
public static LangProfile load(string lang, string file)
|
||||
{
|
||||
LangProfile profile = new LangProfile(lang);
|
||||
TagExtractor tagextractor = new TagExtractor("abstract", 100);
|
||||
var profile = new LangProfile(lang);
|
||||
var tagextractor = new TagExtractor("abstract", 100);
|
||||
Stream inputStream = null;
|
||||
|
||||
try
|
||||
@@ -28,7 +28,7 @@ namespace NLangDetect.Core
|
||||
inputStream = new GZipStream(inputStream, CompressionMode.Decompress);
|
||||
}
|
||||
|
||||
using (XmlReader xmlReader = XmlReader.Create(inputStream))
|
||||
using (var xmlReader = XmlReader.Create(inputStream))
|
||||
{
|
||||
while (xmlReader.Read())
|
||||
{
|
||||
|
||||
@@ -25,7 +25,7 @@ namespace NLangDetect.Core
|
||||
{
|
||||
if (string.IsNullOrEmpty(plainText)) { throw new ArgumentException("Argument can't be null nor empty.", nameof(plainText)); }
|
||||
|
||||
Detector detector = DetectorFactory.Create(_DefaultAlpha);
|
||||
var detector = DetectorFactory.Create(_DefaultAlpha);
|
||||
|
||||
detector.Append(plainText);
|
||||
|
||||
|
||||
@@ -59,8 +59,8 @@ namespace NLangDetect.Core.Utils
|
||||
ICollection<string> keys = freq.Keys;
|
||||
int roman = 0;
|
||||
// TODO IMM HI: move up?
|
||||
Regex regex1 = new Regex("^[A-Za-z]$", RegexOptions.Compiled);
|
||||
List<string> keysToRemove = new List<string>();
|
||||
var regex1 = new Regex("^[A-Za-z]$", RegexOptions.Compiled);
|
||||
var keysToRemove = new List<string>();
|
||||
|
||||
foreach (string key in keys)
|
||||
{
|
||||
@@ -93,7 +93,7 @@ namespace NLangDetect.Core.Utils
|
||||
ICollection<string> keys2 = freq.Keys;
|
||||
|
||||
// TODO IMM HI: move up?
|
||||
Regex regex2 = new Regex(".*[A-Za-z].*", RegexOptions.Compiled);
|
||||
var regex2 = new Regex(".*[A-Za-z].*", RegexOptions.Compiled);
|
||||
|
||||
foreach (string key in keys2)
|
||||
{
|
||||
|
||||
@@ -30,7 +30,7 @@ namespace NLangDetect.Core.Utils
|
||||
{
|
||||
var manifestName = typeof(Messages).Assembly.GetManifestResourceNames().FirstOrDefault(i => i.IndexOf("messages.properties", StringComparison.Ordinal) != -1);
|
||||
|
||||
Stream messagesStream =
|
||||
var messagesStream =
|
||||
typeof(Messages).Assembly
|
||||
.GetManifestResourceStream(manifestName);
|
||||
|
||||
|
||||
@@ -150,7 +150,7 @@ namespace Emby.Server.Implementations.TextEncoding
|
||||
public CharacterEncoding DetectEncoding(byte[] buffer, int size)
|
||||
{
|
||||
// First check if we have a BOM and return that if so
|
||||
CharacterEncoding encoding = CheckBom(buffer, size);
|
||||
var encoding = CheckBom(buffer, size);
|
||||
if (encoding != CharacterEncoding.None)
|
||||
{
|
||||
return encoding;
|
||||
|
||||
@@ -83,7 +83,7 @@ namespace UniversalDetector.Core
|
||||
/// convert this encoding string to a number, here called order.
|
||||
/// This allow multiple encoding of a language to share one frequency table
|
||||
/// </summary>
|
||||
/// <param name="buf">A <see cref="System.Byte"/></param>
|
||||
/// <param name="buf">A <see cref="byte"/></param>
|
||||
/// <param name="offset"></param>
|
||||
/// <returns></returns>
|
||||
public abstract int GetOrder(byte[] buf, int offset);
|
||||
@@ -91,7 +91,7 @@ namespace UniversalDetector.Core
|
||||
/// <summary>
|
||||
/// Feed a character with known length
|
||||
/// </summary>
|
||||
/// <param name="buf">A <see cref="System.Byte"/></param>
|
||||
/// <param name="buf">A <see cref="byte"/></param>
|
||||
/// <param name="offset">buf offset</param>
|
||||
public void HandleOneChar(byte[] buf, int offset, int charLen)
|
||||
{
|
||||
|
||||
@@ -108,7 +108,7 @@ namespace UniversalDetector.Core
|
||||
{
|
||||
byte[] result = null;
|
||||
|
||||
using (MemoryStream ms = new MemoryStream(buf.Length))
|
||||
using (var ms = new MemoryStream(buf.Length))
|
||||
{
|
||||
|
||||
bool meetMSB = false;
|
||||
@@ -156,7 +156,7 @@ namespace UniversalDetector.Core
|
||||
{
|
||||
byte[] result = null;
|
||||
|
||||
using (MemoryStream ms = new MemoryStream(buf.Length))
|
||||
using (var ms = new MemoryStream(buf.Length))
|
||||
{
|
||||
|
||||
bool inTag = false;
|
||||
|
||||
@@ -84,7 +84,7 @@ namespace UniversalDetector.Core
|
||||
}
|
||||
else if (j != activeSM)
|
||||
{
|
||||
CodingStateMachine t = codingSM[activeSM];
|
||||
var t = codingSM[activeSM];
|
||||
codingSM[activeSM] = codingSM[j];
|
||||
codingSM[j] = t;
|
||||
}
|
||||
|
||||
@@ -122,7 +122,7 @@ namespace UniversalDetector.Core
|
||||
}
|
||||
}
|
||||
|
||||
ProbingState st = ProbingState.NotMe;
|
||||
var st = ProbingState.NotMe;
|
||||
|
||||
for (int i = 0; i < probers.Length; i++)
|
||||
{
|
||||
|
||||
@@ -59,7 +59,7 @@ namespace UniversalDetector.Core
|
||||
probers[7] = new SingleByteCharSetProber(new Win1253Model());
|
||||
probers[8] = new SingleByteCharSetProber(new Latin5BulgarianModel());
|
||||
probers[9] = new SingleByteCharSetProber(new Win1251BulgarianModel());
|
||||
HebrewProber hebprober = new HebrewProber();
|
||||
var hebprober = new HebrewProber();
|
||||
probers[10] = hebprober;
|
||||
// Logical
|
||||
probers[11] = new SingleByteCharSetProber(new Win1255Model(), false, hebprober);
|
||||
@@ -75,7 +75,7 @@ namespace UniversalDetector.Core
|
||||
|
||||
public override ProbingState HandleData(byte[] buf, int offset, int len)
|
||||
{
|
||||
ProbingState st = ProbingState.NotMe;
|
||||
var st = ProbingState.NotMe;
|
||||
|
||||
//apply filter to original buffer, and we got new buffer back
|
||||
//depend on what script it is, we will feed them the new buffer
|
||||
|
||||
@@ -168,7 +168,7 @@ namespace UniversalDetector.Core
|
||||
}
|
||||
}
|
||||
|
||||
ProbingState st = ProbingState.NotMe;
|
||||
var st = ProbingState.NotMe;
|
||||
|
||||
switch (inputState)
|
||||
{
|
||||
|
||||
@@ -415,7 +415,7 @@ namespace Emby.Server.Implementations.Updates
|
||||
/// <param name="progress">The progress.</param>
|
||||
/// <param name="cancellationToken">The cancellation token.</param>
|
||||
/// <returns>Task.</returns>
|
||||
/// <exception cref="System.ArgumentNullException">package</exception>
|
||||
/// <exception cref="ArgumentNullException">package</exception>
|
||||
public async Task InstallPackage(PackageVersionInfo package, bool isPlugin, IProgress<double> progress, CancellationToken cancellationToken)
|
||||
{
|
||||
if (package == null)
|
||||
@@ -626,7 +626,7 @@ namespace Emby.Server.Implementations.Updates
|
||||
/// Uninstalls a plugin
|
||||
/// </summary>
|
||||
/// <param name="plugin">The plugin.</param>
|
||||
/// <exception cref="System.ArgumentException"></exception>
|
||||
/// <exception cref="ArgumentException"></exception>
|
||||
public void UninstallPlugin(IPlugin plugin)
|
||||
{
|
||||
plugin.OnUninstalling();
|
||||
|
||||
Reference in New Issue
Block a user