added user data save event

This commit is contained in:
Luke Pulverenti
2013-10-02 15:08:58 -04:00
parent 0abc9d3493
commit 33a3e215d0
12 changed files with 74 additions and 15 deletions

View File

@@ -1,4 +1,5 @@
using MediaBrowser.Controller.Entities;
using MediaBrowser.Common.Events;
using MediaBrowser.Controller.Entities;
using MediaBrowser.Controller.Library;
using MediaBrowser.Controller.Persistence;
using MediaBrowser.Model.Entities;
@@ -15,6 +16,8 @@ namespace MediaBrowser.Server.Implementations.Library
/// </summary>
public class UserDataManager : IUserDataManager
{
public event EventHandler<UserDataSaveEventArgs> UserDataSaved;
private readonly ConcurrentDictionary<string, UserItemData> _userData = new ConcurrentDictionary<string, UserItemData>();
private readonly ILogger _logger;
@@ -84,6 +87,15 @@ namespace MediaBrowser.Server.Implementations.Library
throw;
}
EventHelper.FireEventIfNotNull(UserDataSaved, this, new UserDataSaveEventArgs
{
Key = key,
UserData = userData,
SaveReason = reason,
UserId = userId
}, _logger);
}
/// <summary>

View File

@@ -78,8 +78,8 @@ namespace MediaBrowser.Server.Implementations.Session
_userRepository = userRepository;
}
private List<ISessionRemoteController> _remoteControllers;
public void AddParts(IEnumerable<ISessionRemoteController> remoteControllers)
private List<ISessionController> _remoteControllers;
public void AddParts(IEnumerable<ISessionController> remoteControllers)
{
_remoteControllers = remoteControllers.ToList();
}
@@ -104,7 +104,7 @@ namespace MediaBrowser.Server.Implementations.Session
/// <returns>Task.</returns>
/// <exception cref="System.UnauthorizedAccessException"></exception>
/// <exception cref="System.ArgumentNullException">user</exception>
public async Task<SessionInfo> LogConnectionActivity(string clientType, string appVersion, string deviceId, string deviceName, User user)
public async Task<SessionInfo> LogSessionActivity(string clientType, string appVersion, string deviceId, string deviceName, User user)
{
if (string.IsNullOrEmpty(clientType))
{
@@ -442,7 +442,7 @@ namespace MediaBrowser.Server.Implementations.Session
/// </summary>
/// <param name="session">The session.</param>
/// <returns>IEnumerable{ISessionRemoteController}.</returns>
private IEnumerable<ISessionRemoteController> GetControllers(SessionInfo session)
private IEnumerable<ISessionController> GetControllers(SessionInfo session)
{
return _remoteControllers.Where(i => i.Supports(session));
}

View File

@@ -9,7 +9,7 @@ using System.Threading.Tasks;
namespace MediaBrowser.Server.Implementations.Session
{
public class WebSocketController : ISessionRemoteController
public class WebSocketController : ISessionController
{
public bool Supports(SessionInfo session)
{