本文整理汇总了C#中BaseItem.CanDelete方法的典型用法代码示例。如果您正苦于以下问题:C# BaseItem.CanDelete方法的具体用法?C# BaseItem.CanDelete怎么用?C# BaseItem.CanDelete使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BaseItem
的用法示例。
在下文中一共展示了BaseItem.CanDelete方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetBaseItemDtoInternal
private BaseItemDto GetBaseItemDtoInternal(BaseItem item, DtoOptions options, Dictionary<string, SyncedItemProgress> syncProgress, User user = null, BaseItem owner = null)
{
var fields = options.Fields;
if (item == null)
{
throw new ArgumentNullException("item");
}
if (fields == null)
{
throw new ArgumentNullException("fields");
}
var dto = new BaseItemDto
{
ServerId = _appHost.SystemId
};
if (fields.Contains(ItemFields.People))
{
AttachPeople(dto, item);
}
if (fields.Contains(ItemFields.PrimaryImageAspectRatio))
{
try
{
AttachPrimaryImageAspectRatio(dto, item);
}
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, item.Name);
}
}
if (fields.Contains(ItemFields.DisplayPreferencesId))
{
dto.DisplayPreferencesId = item.DisplayPreferencesId.ToString("N");
}
if (user != null)
{
AttachUserSpecificInfo(dto, item, user, fields, syncProgress);
}
var hasMediaSources = item as IHasMediaSources;
if (hasMediaSources != null)
{
if (fields.Contains(ItemFields.MediaSources))
{
if (user == null)
{
dto.MediaSources = _mediaSourceManager().GetStaticMediaSources(hasMediaSources, true).ToList();
}
else
{
dto.MediaSources = _mediaSourceManager().GetStaticMediaSources(hasMediaSources, true, user).ToList();
}
}
}
if (fields.Contains(ItemFields.Studios))
{
AttachStudios(dto, item);
}
AttachBasicFields(dto, item, owner, options);
var tvChannel = item as LiveTvChannel;
if (tvChannel != null)
{
_livetvManager().AddChannelInfo(dto, tvChannel, options, user);
}
var collectionFolder = item as ICollectionFolder;
if (collectionFolder != null)
{
dto.CollectionType = user == null ?
collectionFolder.CollectionType :
collectionFolder.GetViewType(user);
}
var playlist = item as Playlist;
if (playlist != null)
{
AttachLinkedChildImages(dto, playlist, user, options);
}
if (fields.Contains(ItemFields.CanDelete))
{
dto.CanDelete = user == null
? item.CanDelete()
: item.CanDelete(user);
}
if (fields.Contains(ItemFields.CanDownload))
{
dto.CanDownload = user == null
//.........这里部分代码省略.........
示例2: GetBaseItemDtoInternal
private async Task<BaseItemDto> GetBaseItemDtoInternal(BaseItem item, DtoOptions options, User user = null, BaseItem owner = null)
{
var fields = options.Fields;
if (item == null)
{
throw new ArgumentNullException("item");
}
if (fields == null)
{
throw new ArgumentNullException("fields");
}
var dto = new BaseItemDto
{
ServerId = _appHost.SystemId
};
if (item.SourceType == SourceType.Channel)
{
dto.SourceType = item.SourceType.ToString();
}
if (fields.Contains(ItemFields.People))
{
AttachPeople(dto, item);
}
if (fields.Contains(ItemFields.PrimaryImageAspectRatio))
{
try
{
AttachPrimaryImageAspectRatio(dto, item);
}
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, item.Name);
}
}
if (fields.Contains(ItemFields.DisplayPreferencesId))
{
dto.DisplayPreferencesId = item.DisplayPreferencesId.ToString("N");
}
if (user != null)
{
await AttachUserSpecificInfo(dto, item, user, options).ConfigureAwait(false);
}
var hasMediaSources = item as IHasMediaSources;
if (hasMediaSources != null)
{
if (fields.Contains(ItemFields.MediaSources))
{
if (user == null)
{
dto.MediaSources = _mediaSourceManager().GetStaticMediaSources(hasMediaSources, true).ToList();
}
else
{
dto.MediaSources = _mediaSourceManager().GetStaticMediaSources(hasMediaSources, true, user).ToList();
}
}
}
if (fields.Contains(ItemFields.Studios))
{
AttachStudios(dto, item);
}
AttachBasicFields(dto, item, owner, options);
var collectionFolder = item as ICollectionFolder;
if (collectionFolder != null)
{
dto.OriginalCollectionType = collectionFolder.CollectionType;
dto.CollectionType = user == null ?
collectionFolder.CollectionType :
collectionFolder.GetViewType(user);
}
if (fields.Contains(ItemFields.CanDelete))
{
dto.CanDelete = user == null
? item.CanDelete()
: item.CanDelete(user);
}
if (fields.Contains(ItemFields.CanDownload))
{
dto.CanDownload = user == null
? item.CanDownload()
: item.CanDownload(user);
}
if (fields.Contains(ItemFields.Etag))
//.........这里部分代码省略.........