本文整理汇总了C#中BaseItem.FindParent方法的典型用法代码示例。如果您正苦于以下问题:C# BaseItem.FindParent方法的具体用法?C# BaseItem.FindParent怎么用?C# BaseItem.FindParent使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BaseItem
的用法示例。
在下文中一共展示了BaseItem.FindParent方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetValue
/// <summary>
/// Gets the value.
/// </summary>
/// <param name="x">The x.</param>
/// <returns>System.String.</returns>
private DateTime GetValue(BaseItem x)
{
var series = (x as Series) ?? x.FindParent<Series>();
DateTime result;
if (series != null && DateTime.TryParse(series.AirTime, out result))
{
return result;
}
return DateTime.MinValue;
}
示例2: AttachBasicFields
//.........这里部分代码省略.........
}
if (fields.Contains(ItemFields.Taglines))
{
dto.Taglines = item.Taglines;
}
if (fields.Contains(ItemFields.RemoteTrailers))
{
dto.RemoteTrailers = item.RemoteTrailers;
}
dto.Type = item.GetType().Name;
dto.CommunityRating = item.CommunityRating;
if (item.IsFolder)
{
var folder = (Folder)item;
if (fields.Contains(ItemFields.IndexOptions))
{
dto.IndexOptions = folder.IndexByOptionStrings.ToArray();
}
}
// Add audio info
var audio = item as Audio;
if (audio != null)
{
dto.Album = audio.Album;
dto.AlbumArtist = audio.AlbumArtist;
dto.Artists = new[] { audio.Artist };
var albumParent = audio.FindParent<MusicAlbum>();
if (albumParent != null)
{
dto.AlbumId = GetClientItemId(albumParent);
var imagePath = albumParent.PrimaryImagePath;
if (!string.IsNullOrEmpty(imagePath))
{
dto.AlbumPrimaryImageTag = GetImageCacheTag(albumParent, ImageType.Primary, imagePath);
}
}
}
var album = item as MusicAlbum;
if (album != null)
{
var songs = album.RecursiveChildren.OfType<Audio>().ToList();
dto.AlbumArtist = songs.Select(i => i.AlbumArtist).FirstOrDefault(i => !string.IsNullOrEmpty(i));
dto.Artists =
songs.Select(i => i.Artist ?? string.Empty)
.Where(i => !string.IsNullOrEmpty(i))
.Distinct(StringComparer.OrdinalIgnoreCase)
.ToArray();
}
// Add video info
var video = item as Video;
if (video != null)
示例3: AttachBasicFields
//.........这里部分代码省略.........
var hasTagline = item as IHasTaglines;
if (hasTagline != null)
{
dto.Taglines = hasTagline.Taglines;
}
if (dto.Taglines == null)
{
dto.Taglines = new List<string>();
}
}
dto.Type = item.GetClientTypeName();
dto.CommunityRating = item.CommunityRating;
dto.VoteCount = item.VoteCount;
if (item.IsFolder)
{
var folder = (Folder)item;
if (fields.Contains(ItemFields.IndexOptions))
{
dto.IndexOptions = folder.IndexByOptionStrings.ToArray();
}
}
// Add audio info
var audio = item as Audio;
if (audio != null)
{
dto.Album = audio.Album;
dto.Artists = audio.Artists;
var albumParent = audio.FindParent<MusicAlbum>();
if (albumParent != null)
{
dto.AlbumId = GetDtoId(albumParent);
var imagePath = albumParent.PrimaryImagePath;
if (!string.IsNullOrEmpty(imagePath))
{
dto.AlbumPrimaryImageTag = GetImageCacheTag(albumParent, ImageType.Primary, imagePath);
}
}
}
var album = item as MusicAlbum;
if (album != null)
{
dto.Artists = album.Artists;
dto.SoundtrackIds = album.SoundtrackIds
.Select(i => i.ToString("N"))
.ToArray();
}
var hasAlbumArtist = item as IHasAlbumArtist;
if (hasAlbumArtist != null)
{
dto.AlbumArtist = hasAlbumArtist.AlbumArtist;
}