本文整理汇总了C#中MediaBrowser.Controller.Entities.User.GetImageInfo方法的典型用法代码示例。如果您正苦于以下问题:C# User.GetImageInfo方法的具体用法?C# User.GetImageInfo怎么用?C# User.GetImageInfo使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MediaBrowser.Controller.Entities.User
的用法示例。
在下文中一共展示了User.GetImageInfo方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetUserDto
public UserDto GetUserDto(User user, string remoteEndPoint = null)
{
if (user == null)
{
throw new ArgumentNullException("user");
}
var passwordHash = GetPasswordHash(user);
var hasConfiguredPassword = !IsPasswordEmpty(passwordHash);
var hasConfiguredEasyPassword = !IsPasswordEmpty(GetLocalPasswordHash(user));
var hasPassword = user.Configuration.EnableLocalPassword && !string.IsNullOrEmpty(remoteEndPoint) && _networkManager.IsInLocalNetwork(remoteEndPoint) ?
hasConfiguredEasyPassword :
hasConfiguredPassword;
var dto = new UserDto
{
Id = user.Id.ToString("N"),
Name = user.Name,
HasPassword = hasPassword,
HasConfiguredPassword = hasConfiguredPassword,
HasConfiguredEasyPassword = hasConfiguredEasyPassword,
LastActivityDate = user.LastActivityDate,
LastLoginDate = user.LastLoginDate,
Configuration = user.Configuration,
ConnectLinkType = user.ConnectLinkType,
ConnectUserId = user.ConnectUserId,
ConnectUserName = user.ConnectUserName,
ServerId = _appHost.SystemId,
Policy = user.Policy
};
var image = user.GetImageInfo(ImageType.Primary, 0);
if (image != null)
{
dto.PrimaryImageTag = GetImageCacheTag(user, image);
try
{
_dtoServiceFactory().AttachPrimaryImageAspectRatio(dto, user, new List<ItemFields>
{
ItemFields.PrimaryImageAspectRatio
});
}
catch (Exception ex)
{
// Have to use a catch-all unfortunately because some .net image methods throw plain Exceptions
_logger.ErrorException("Error generating PrimaryImageAspectRatio for {0}", ex, user.Name);
}
}
return dto;
}
示例2: GetUserDto
public UserDto GetUserDto(User user)
{
if (user == null)
{
throw new ArgumentNullException("user");
}
var dto = new UserDto
{
Id = user.Id.ToString("N"),
Name = user.Name,
HasPassword = !String.IsNullOrEmpty(user.Password),
LastActivityDate = user.LastActivityDate,
LastLoginDate = user.LastLoginDate,
Configuration = user.Configuration
};
var image = user.GetImageInfo(ImageType.Primary, 0);
if (image != null)
{
dto.PrimaryImageTag = GetImageCacheTag(user, image);
try
{
AttachPrimaryImageAspectRatio(dto, user);
}
catch (Exception ex)
{
// Have to use a catch-all unfortunately because some .net image methods throw plain Exceptions
_logger.ErrorException("Error generating PrimaryImageAspectRatio for {0}", ex, user.Name);
}
}
return dto;
}