当前位置: 首页>>代码示例>>C#>>正文


C# BaseItem.FindParent方法代码示例

本文整理汇总了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;
        }
开发者ID:RomanDengin,项目名称:MediaBrowser,代码行数:16,代码来源:AirTimeComparer.cs

示例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)
开发者ID:jordy1955,项目名称:MediaBrowser,代码行数:67,代码来源:DtoBuilder.cs

示例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;
            }
开发者ID:jscorrea,项目名称:MediaBrowser,代码行数:66,代码来源:DtoService.cs


注:本文中的BaseItem.FindParent方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。