aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBond_009 <bond.009@outlook.com>2019-01-23 19:09:34 +0100
committerBond_009 <bond.009@outlook.com>2019-01-23 19:09:34 +0100
commit905a253ff5ce2eeee9806b7a4581506468b2fb55 (patch)
tree815d941e04977df9055c556b247b71a00575d29f
parent3cd31cadf891fb4aad7ca8d8594bf27423724eb8 (diff)
Suffix async methods with Async
-rw-r--r--Emby.Server.Implementations/Activity/ActivityLogEntryPoint.cs93
-rw-r--r--Emby.Server.Implementations/Activity/ActivityManager.cs2
-rw-r--r--Emby.Server.Implementations/ApplicationHost.cs10
-rw-r--r--Jellyfin.Server/Program.cs2
-rw-r--r--MediaBrowser.Api/Library/LibraryService.cs2
-rw-r--r--MediaBrowser.Common/IApplicationHost.cs2
-rw-r--r--MediaBrowser.Model/Activity/IActivityManager.cs2
7 files changed, 57 insertions, 56 deletions
diff --git a/Emby.Server.Implementations/Activity/ActivityLogEntryPoint.cs b/Emby.Server.Implementations/Activity/ActivityLogEntryPoint.cs
index a8e8f815a..aef72c697 100644
--- a/Emby.Server.Implementations/Activity/ActivityLogEntryPoint.cs
+++ b/Emby.Server.Implementations/Activity/ActivityLogEntryPoint.cs
@@ -2,6 +2,7 @@ using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
+using System.Threading.Tasks;
using MediaBrowser.Common.Configuration;
using MediaBrowser.Common.Plugins;
using MediaBrowser.Common.Updates;
@@ -92,18 +93,18 @@ namespace Emby.Server.Implementations.Activity
_appHost.ApplicationUpdated += _appHost_ApplicationUpdated;
}
- void _deviceManager_CameraImageUploaded(object sender, GenericEventArgs<CameraImageUploadInfo> e)
+ async void _deviceManager_CameraImageUploaded(object sender, GenericEventArgs<CameraImageUploadInfo> e)
{
- CreateLogEntry(new ActivityLogEntry
+ await CreateLogEntry(new ActivityLogEntry
{
Name = string.Format(_localization.GetLocalizedString("CameraImageUploadedFrom"), e.Argument.Device.Name),
Type = NotificationType.CameraImageUploaded.ToString()
});
}
- void _userManager_UserLockedOut(object sender, GenericEventArgs<User> e)
+ async void _userManager_UserLockedOut(object sender, GenericEventArgs<User> e)
{
- CreateLogEntry(new ActivityLogEntry
+ await CreateLogEntry(new ActivityLogEntry
{
Name = string.Format(_localization.GetLocalizedString("UserLockedOutWithName"), e.Argument.Name),
Type = NotificationType.UserLockedOut.ToString(),
@@ -111,9 +112,9 @@ namespace Emby.Server.Implementations.Activity
});
}
- void _subManager_SubtitleDownloadFailure(object sender, SubtitleDownloadFailureEventArgs e)
+ async void _subManager_SubtitleDownloadFailure(object sender, SubtitleDownloadFailureEventArgs e)
{
- CreateLogEntry(new ActivityLogEntry
+ await CreateLogEntry(new ActivityLogEntry
{
Name = string.Format(_localization.GetLocalizedString("SubtitleDownloadFailureFromForItem"), e.Provider, Notifications.Notifications.GetItemName(e.Item)),
Type = "SubtitleDownloadFailure",
@@ -122,7 +123,7 @@ namespace Emby.Server.Implementations.Activity
});
}
- void _sessionManager_PlaybackStopped(object sender, PlaybackStopEventArgs e)
+ async void _sessionManager_PlaybackStopped(object sender, PlaybackStopEventArgs e)
{
var item = e.MediaInfo;
@@ -145,7 +146,7 @@ namespace Emby.Server.Implementations.Activity
var user = e.Users.First();
- CreateLogEntry(new ActivityLogEntry
+ await CreateLogEntry(new ActivityLogEntry
{
Name = string.Format(_localization.GetLocalizedString("UserStoppedPlayingItemWithValues"), user.Name, GetItemName(item), e.DeviceName),
Type = GetPlaybackStoppedNotificationType(item.MediaType),
@@ -153,7 +154,7 @@ namespace Emby.Server.Implementations.Activity
});
}
- void _sessionManager_PlaybackStart(object sender, PlaybackProgressEventArgs e)
+ async void _sessionManager_PlaybackStart(object sender, PlaybackProgressEventArgs e)
{
var item = e.MediaInfo;
@@ -176,7 +177,7 @@ namespace Emby.Server.Implementations.Activity
var user = e.Users.First();
- CreateLogEntry(new ActivityLogEntry
+ await CreateLogEntry(new ActivityLogEntry
{
Name = string.Format(_localization.GetLocalizedString("UserStartedPlayingItemWithValues"), user.Name, GetItemName(item), e.DeviceName),
Type = GetPlaybackNotificationType(item.MediaType),
@@ -237,7 +238,7 @@ namespace Emby.Server.Implementations.Activity
return null;
}
- void _sessionManager_SessionEnded(object sender, SessionEventArgs e)
+ async void _sessionManager_SessionEnded(object sender, SessionEventArgs e)
{
string name;
var session = e.SessionInfo;
@@ -254,7 +255,7 @@ namespace Emby.Server.Implementations.Activity
name = string.Format(_localization.GetLocalizedString("UserOfflineFromDevice"), session.UserName, session.DeviceName);
}
- CreateLogEntry(new ActivityLogEntry
+ await CreateLogEntry(new ActivityLogEntry
{
Name = name,
Type = "SessionEnded",
@@ -263,11 +264,11 @@ namespace Emby.Server.Implementations.Activity
});
}
- void _sessionManager_AuthenticationSucceeded(object sender, GenericEventArgs<AuthenticationResult> e)
+ async void _sessionManager_AuthenticationSucceeded(object sender, GenericEventArgs<AuthenticationResult> e)
{
var user = e.Argument.User;
- CreateLogEntry(new ActivityLogEntry
+ await CreateLogEntry(new ActivityLogEntry
{
Name = string.Format(_localization.GetLocalizedString("AuthenticationSucceededWithUserName"), user.Name),
Type = "AuthenticationSucceeded",
@@ -276,9 +277,9 @@ namespace Emby.Server.Implementations.Activity
});
}
- void _sessionManager_AuthenticationFailed(object sender, GenericEventArgs<AuthenticationRequest> e)
+ async void _sessionManager_AuthenticationFailed(object sender, GenericEventArgs<AuthenticationRequest> e)
{
- CreateLogEntry(new ActivityLogEntry
+ await CreateLogEntry(new ActivityLogEntry
{
Name = string.Format(_localization.GetLocalizedString("FailedLoginAttemptWithUserName"), e.Argument.Username),
Type = "AuthenticationFailed",
@@ -287,9 +288,9 @@ namespace Emby.Server.Implementations.Activity
});
}
- void _appHost_ApplicationUpdated(object sender, GenericEventArgs<PackageVersionInfo> e)
+ async void _appHost_ApplicationUpdated(object sender, GenericEventArgs<PackageVersionInfo> e)
{
- CreateLogEntry(new ActivityLogEntry
+ await CreateLogEntry(new ActivityLogEntry
{
Name = string.Format(_localization.GetLocalizedString("MessageApplicationUpdatedTo"), e.Argument.versionStr),
Type = NotificationType.ApplicationUpdateInstalled.ToString(),
@@ -297,27 +298,27 @@ namespace Emby.Server.Implementations.Activity
});
}
- void _config_NamedConfigurationUpdated(object sender, ConfigurationUpdateEventArgs e)
+ async void _config_NamedConfigurationUpdated(object sender, ConfigurationUpdateEventArgs e)
{
- CreateLogEntry(new ActivityLogEntry
+ await CreateLogEntry(new ActivityLogEntry
{
Name = string.Format(_localization.GetLocalizedString("MessageNamedServerConfigurationUpdatedWithValue"), e.Key),
Type = "NamedConfigurationUpdated"
});
}
- void _config_ConfigurationUpdated(object sender, EventArgs e)
+ async void _config_ConfigurationUpdated(object sender, EventArgs e)
{
- CreateLogEntry(new ActivityLogEntry
+ await CreateLogEntry(new ActivityLogEntry
{
Name = _localization.GetLocalizedString("MessageServerConfigurationUpdated"),
Type = "ServerConfigurationUpdated"
});
}
- void _userManager_UserPolicyUpdated(object sender, GenericEventArgs<User> e)
+ async void _userManager_UserPolicyUpdated(object sender, GenericEventArgs<User> e)
{
- CreateLogEntry(new ActivityLogEntry
+ await CreateLogEntry(new ActivityLogEntry
{
Name = string.Format(_localization.GetLocalizedString("UserPolicyUpdatedWithName"), e.Argument.Name),
Type = "UserPolicyUpdated",
@@ -325,18 +326,18 @@ namespace Emby.Server.Implementations.Activity
});
}
- void _userManager_UserDeleted(object sender, GenericEventArgs<User> e)
+ async void _userManager_UserDeleted(object sender, GenericEventArgs<User> e)
{
- CreateLogEntry(new ActivityLogEntry
+ await CreateLogEntry(new ActivityLogEntry
{
Name = string.Format(_localization.GetLocalizedString("UserDeletedWithName"), e.Argument.Name),
Type = "UserDeleted"
});
}
- void _userManager_UserPasswordChanged(object sender, GenericEventArgs<User> e)
+ async void _userManager_UserPasswordChanged(object sender, GenericEventArgs<User> e)
{
- CreateLogEntry(new ActivityLogEntry
+ await CreateLogEntry(new ActivityLogEntry
{
Name = string.Format(_localization.GetLocalizedString("UserPasswordChangedWithName"), e.Argument.Name),
Type = "UserPasswordChanged",
@@ -344,9 +345,9 @@ namespace Emby.Server.Implementations.Activity
});
}
- void _userManager_UserCreated(object sender, GenericEventArgs<User> e)
+ async void _userManager_UserCreated(object sender, GenericEventArgs<User> e)
{
- CreateLogEntry(new ActivityLogEntry
+ await CreateLogEntry(new ActivityLogEntry
{
Name = string.Format(_localization.GetLocalizedString("UserCreatedWithName"), e.Argument.Name),
Type = "UserCreated",
@@ -354,9 +355,9 @@ namespace Emby.Server.Implementations.Activity
});
}
- void _subManager_SubtitlesDownloaded(object sender, SubtitleDownloadEventArgs e)
+ async void _subManager_SubtitlesDownloaded(object sender, SubtitleDownloadEventArgs e)
{
- CreateLogEntry(new ActivityLogEntry
+ await CreateLogEntry(new ActivityLogEntry
{
Name = string.Format(_localization.GetLocalizedString("SubtitlesDownloadedForItem"), Notifications.Notifications.GetItemName(e.Item)),
Type = "SubtitlesDownloaded",
@@ -365,7 +366,7 @@ namespace Emby.Server.Implementations.Activity
});
}
- void _sessionManager_SessionStarted(object sender, SessionEventArgs e)
+ async void _sessionManager_SessionStarted(object sender, SessionEventArgs e)
{
string name;
var session = e.SessionInfo;
@@ -382,7 +383,7 @@ namespace Emby.Server.Implementations.Activity
name = string.Format(_localization.GetLocalizedString("UserOnlineFromDevice"), session.UserName, session.DeviceName);
}
- CreateLogEntry(new ActivityLogEntry
+ await CreateLogEntry(new ActivityLogEntry
{
Name = name,
Type = "SessionStarted",
@@ -391,9 +392,9 @@ namespace Emby.Server.Implementations.Activity
});
}
- void _installationManager_PluginUpdated(object sender, GenericEventArgs<Tuple<IPlugin, PackageVersionInfo>> e)
+ async void _installationManager_PluginUpdated(object sender, GenericEventArgs<Tuple<IPlugin, PackageVersionInfo>> e)
{
- CreateLogEntry(new ActivityLogEntry
+ await CreateLogEntry(new ActivityLogEntry
{
Name = string.Format(_localization.GetLocalizedString("PluginUpdatedWithName"), e.Argument.Item1.Name),
Type = NotificationType.PluginUpdateInstalled.ToString(),
@@ -402,18 +403,18 @@ namespace Emby.Server.Implementations.Activity
});
}
- void _installationManager_PluginUninstalled(object sender, GenericEventArgs<IPlugin> e)
+ async void _installationManager_PluginUninstalled(object sender, GenericEventArgs<IPlugin> e)
{
- CreateLogEntry(new ActivityLogEntry
+ await CreateLogEntry(new ActivityLogEntry
{
Name = string.Format(_localization.GetLocalizedString("PluginUninstalledWithName"), e.Argument.Name),
Type = NotificationType.PluginUninstalled.ToString()
});
}
- void _installationManager_PluginInstalled(object sender, GenericEventArgs<PackageVersionInfo> e)
+ async void _installationManager_PluginInstalled(object sender, GenericEventArgs<PackageVersionInfo> e)
{
- CreateLogEntry(new ActivityLogEntry
+ await CreateLogEntry(new ActivityLogEntry
{
Name = string.Format(_localization.GetLocalizedString("PluginInstalledWithName"), e.Argument.name),
Type = NotificationType.PluginInstalled.ToString(),
@@ -421,11 +422,11 @@ namespace Emby.Server.Implementations.Activity
});
}
- void _installationManager_PackageInstallationFailed(object sender, InstallationFailedEventArgs e)
+ async void _installationManager_PackageInstallationFailed(object sender, InstallationFailedEventArgs e)
{
var installationInfo = e.InstallationInfo;
- CreateLogEntry(new ActivityLogEntry
+ await CreateLogEntry(new ActivityLogEntry
{
Name = string.Format(_localization.GetLocalizedString("NameInstallFailed"), installationInfo.Name),
Type = NotificationType.InstallationFailed.ToString(),
@@ -434,7 +435,7 @@ namespace Emby.Server.Implementations.Activity
});
}
- void _taskManager_TaskCompleted(object sender, TaskCompletionEventArgs e)
+ async void _taskManager_TaskCompleted(object sender, TaskCompletionEventArgs e)
{
var result = e.Result;
var task = e.Task;
@@ -461,7 +462,7 @@ namespace Emby.Server.Implementations.Activity
vals.Add(e.Result.LongErrorMessage);
}
- CreateLogEntry(new ActivityLogEntry
+ await CreateLogEntry(new ActivityLogEntry
{
Name = string.Format(_localization.GetLocalizedString("ScheduledTaskFailedWithName"), task.Name),
Type = NotificationType.TaskFailed.ToString(),
@@ -472,11 +473,11 @@ namespace Emby.Server.Implementations.Activity
}
}
- private void CreateLogEntry(ActivityLogEntry entry)
+ private async Task CreateLogEntry(ActivityLogEntry entry)
{
try
{
- _activityManager.Create(entry);
+ await _activityManager.CreateAsync(entry);
}
catch
{
diff --git a/Emby.Server.Implementations/Activity/ActivityManager.cs b/Emby.Server.Implementations/Activity/ActivityManager.cs
index e504bc4d7..8fcacb002 100644
--- a/Emby.Server.Implementations/Activity/ActivityManager.cs
+++ b/Emby.Server.Implementations/Activity/ActivityManager.cs
@@ -27,7 +27,7 @@ namespace Emby.Server.Implementations.Activity
_userManager = userManager;
}
- public async Task Create(ActivityLogEntry entry)
+ public async Task CreateAsync(ActivityLogEntry entry)
{
entry.Date = DateTime.UtcNow;
diff --git a/Emby.Server.Implementations/ApplicationHost.cs b/Emby.Server.Implementations/ApplicationHost.cs
index 3562074fe..f5a4f1581 100644
--- a/Emby.Server.Implementations/ApplicationHost.cs
+++ b/Emby.Server.Implementations/ApplicationHost.cs
@@ -709,7 +709,7 @@ namespace Emby.Server.Implementations
}
}
- public async Task Init()
+ public async Task InitAsync()
{
HttpPort = ServerConfigurationManager.Configuration.HttpServerPortNumber;
HttpsPort = ServerConfigurationManager.Configuration.HttpsPortNumber;
@@ -739,7 +739,7 @@ namespace Emby.Server.Implementations
SetHttpLimit();
- await RegisterResources();
+ await RegisterResourcesAsync();
FindParts();
}
@@ -754,7 +754,7 @@ namespace Emby.Server.Implementations
/// <summary>
/// Registers resources that classes will depend on
/// </summary>
- protected async Task RegisterResources()
+ protected async Task RegisterResourcesAsync()
{
RegisterSingleInstance(ConfigurationManager);
RegisterSingleInstance<IApplicationHost>(this);
@@ -931,7 +931,7 @@ namespace Emby.Server.Implementations
EncodingManager = new MediaEncoder.EncodingManager(FileSystemManager, LoggerFactory, MediaEncoder, ChapterManager, LibraryManager);
RegisterSingleInstance(EncodingManager);
- var activityLogRepo = await GetActivityLogRepository();
+ var activityLogRepo = await GetActivityLogRepositoryAsync();
RegisterSingleInstance(activityLogRepo);
RegisterSingleInstance<IActivityManager>(new ActivityManager(LoggerFactory, activityLogRepo, UserManager));
@@ -1146,7 +1146,7 @@ namespace Emby.Server.Implementations
return repo;
}
- private async Task<IActivityRepository> GetActivityLogRepository()
+ private async Task<IActivityRepository> GetActivityLogRepositoryAsync()
{
var repo = new ActivityRepository(ServerConfigurationManager.ApplicationPaths.DataPath);
diff --git a/Jellyfin.Server/Program.cs b/Jellyfin.Server/Program.cs
index bdf8c4e94..2f14d1c52 100644
--- a/Jellyfin.Server/Program.cs
+++ b/Jellyfin.Server/Program.cs
@@ -99,7 +99,7 @@ namespace Jellyfin.Server
new SystemEvents(),
new NetworkManager(_loggerFactory, environmentInfo)))
{
- await appHost.Init();
+ await appHost.InitAsync();
appHost.ImageProcessor.ImageEncoder = GetImageEncoder(fileSystem, appPaths, appHost.LocalizationManager);
diff --git a/MediaBrowser.Api/Library/LibraryService.cs b/MediaBrowser.Api/Library/LibraryService.cs
index 12d807a7e..d3009295f 100644
--- a/MediaBrowser.Api/Library/LibraryService.cs
+++ b/MediaBrowser.Api/Library/LibraryService.cs
@@ -839,7 +839,7 @@ namespace MediaBrowser.Api.Library
{
try
{
- _activityManager.Create(new ActivityLogEntry
+ _activityManager.CreateAsync(new ActivityLogEntry
{
Name = string.Format(_localization.GetLocalizedString("UserDownloadingItemWithValues"), user.Name, item.Name),
Type = "UserDownloadingContent",
diff --git a/MediaBrowser.Common/IApplicationHost.cs b/MediaBrowser.Common/IApplicationHost.cs
index f32eec6ce..9dc625e35 100644
--- a/MediaBrowser.Common/IApplicationHost.cs
+++ b/MediaBrowser.Common/IApplicationHost.cs
@@ -131,7 +131,7 @@ namespace MediaBrowser.Common
/// <summary>
/// Inits this instance.
/// </summary>
- Task Init();
+ Task InitAsync();
/// <summary>
/// Creates the instance.
diff --git a/MediaBrowser.Model/Activity/IActivityManager.cs b/MediaBrowser.Model/Activity/IActivityManager.cs
index 3cfd94695..bbd7b6f2d 100644
--- a/MediaBrowser.Model/Activity/IActivityManager.cs
+++ b/MediaBrowser.Model/Activity/IActivityManager.cs
@@ -9,7 +9,7 @@ namespace MediaBrowser.Model.Activity
{
event EventHandler<GenericEventArgs<ActivityLogEntry>> EntryCreated;
- Task Create(ActivityLogEntry entry);
+ Task CreateAsync(ActivityLogEntry entry);
IEnumerable<ActivityLogEntry> GetActivityLogEntries(DateTime? minDate, bool? hasUserId, int? x, int? y);
}