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


C# IHasImages.DetectIsInMixedFolder方法代码示例

本文整理汇总了C#中IHasImages.DetectIsInMixedFolder方法的典型用法代码示例。如果您正苦于以下问题:C# IHasImages.DetectIsInMixedFolder方法的具体用法?C# IHasImages.DetectIsInMixedFolder怎么用?C# IHasImages.DetectIsInMixedFolder使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IHasImages的用法示例。


在下文中一共展示了IHasImages.DetectIsInMixedFolder方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: GetStandardSavePath

        /// <summary>
        /// Gets the save path.
        /// </summary>
        /// <param name="item">The item.</param>
        /// <param name="type">The type.</param>
        /// <param name="imageIndex">Index of the image.</param>
        /// <param name="mimeType">Type of the MIME.</param>
        /// <param name="saveLocally">if set to <c>true</c> [save locally].</param>
        /// <returns>System.String.</returns>
        /// <exception cref="System.ArgumentNullException">
        /// imageIndex
        /// or
        /// imageIndex
        /// </exception>
        private string GetStandardSavePath(IHasImages item, ImageType type, int? imageIndex, string mimeType, bool saveLocally)
        {
            var season = item as Season;
            var extension = MimeTypes.ToExtension(mimeType);

            if (string.IsNullOrWhiteSpace(extension))
            {
                throw new ArgumentException(string.Format("Unable to determine image file extension from mime type {0}", mimeType));
            }

            if (type == ImageType.Thumb && saveLocally)
            {
                if (season != null && season.IndexNumber.HasValue)
                {
                    var seriesFolder = season.SeriesPath;

                    var seasonMarker = season.IndexNumber.Value == 0
                                           ? "-specials"
                                           : season.IndexNumber.Value.ToString("00", UsCulture);

                    var imageFilename = "season" + seasonMarker + "-landscape" + extension;

                    return Path.Combine(seriesFolder, imageFilename);
                }

                if (item.DetectIsInMixedFolder())
                {
                    return GetSavePathForItemInMixedFolder(item, type, "landscape", extension);
                }

                return Path.Combine(item.ContainingFolderPath, "landscape" + extension);
            }

            if (type == ImageType.Banner && saveLocally)
            {
                if (season != null && season.IndexNumber.HasValue)
                {
                    var seriesFolder = season.SeriesPath;

                    var seasonMarker = season.IndexNumber.Value == 0
                                           ? "-specials"
                                           : season.IndexNumber.Value.ToString("00", UsCulture);

                    var imageFilename = "season" + seasonMarker + "-banner" + extension;

                    return Path.Combine(seriesFolder, imageFilename);
                }
            }

            string filename;
            var folderName = item is MusicAlbum ||
                item is MusicArtist ||
                item is PhotoAlbum ||
                (saveLocally && _config.Configuration.ImageSavingConvention == ImageSavingConvention.Legacy) ?
                "folder" :
                "poster";

            switch (type)
            {
                case ImageType.Art:
                    filename = "clearart";
                    break;
                case ImageType.BoxRear:
                    filename = "back";
                    break;
                case ImageType.Thumb:
                    filename = "landscape";
                    break;
                case ImageType.Disc:
                    filename = item is MusicAlbum ? "cdart" : "disc";
                    break;
                case ImageType.Primary:
                    filename = item is Episode ? _fileSystem.GetFileNameWithoutExtension(item.Path) : folderName;
                    break;
                case ImageType.Backdrop:
                    filename = GetBackdropSaveFilename(item.GetImages(type), "backdrop", "backdrop", imageIndex);
                    break;
                case ImageType.Screenshot:
                    filename = GetBackdropSaveFilename(item.GetImages(type), "screenshot", "screenshot", imageIndex);
                    break;
                default:
                    filename = type.ToString().ToLower();
                    break;
            }

            if (string.Equals(extension, ".jpeg", StringComparison.OrdinalIgnoreCase))
//.........这里部分代码省略.........
开发者ID:t-andre,项目名称:Emby,代码行数:101,代码来源:ImageSaver.cs

示例2: GetCompatibleSavePaths

        /// <summary>
        /// Gets the compatible save paths.
        /// </summary>
        /// <param name="item">The item.</param>
        /// <param name="type">The type.</param>
        /// <param name="imageIndex">Index of the image.</param>
        /// <param name="mimeType">Type of the MIME.</param>
        /// <returns>IEnumerable{System.String}.</returns>
        /// <exception cref="System.ArgumentNullException">imageIndex</exception>
        private string[] GetCompatibleSavePaths(IHasImages item, ImageType type, int? imageIndex, string mimeType)
        {
            var season = item as Season;

            var extension = MimeTypes.ToExtension(mimeType);

            // Backdrop paths
            if (type == ImageType.Backdrop)
            {
                if (!imageIndex.HasValue)
                {
                    throw new ArgumentNullException("imageIndex");
                }

                if (imageIndex.Value == 0)
                {
                    if (item.DetectIsInMixedFolder())
                    {
                        return new[] { GetSavePathForItemInMixedFolder(item, type, "fanart", extension) };
                    }

                    if (season != null && season.IndexNumber.HasValue)
                    {
                        var seriesFolder = season.SeriesPath;

                        var seasonMarker = season.IndexNumber.Value == 0
                                               ? "-specials"
                                               : season.IndexNumber.Value.ToString("00", UsCulture);

                        var imageFilename = "season" + seasonMarker + "-fanart" + extension;

                        return new[] { Path.Combine(seriesFolder, imageFilename) };
                    }

                    return new[]
                        {
                            Path.Combine(item.ContainingFolderPath, "fanart" + extension)
                        };
                }

                var outputIndex = imageIndex.Value;

                if (item.DetectIsInMixedFolder())
                {
                    return new[] { GetSavePathForItemInMixedFolder(item, type, "fanart" + outputIndex.ToString(UsCulture), extension) };
                }

                var extraFanartFilename = GetBackdropSaveFilename(item.GetImages(ImageType.Backdrop), "fanart", "fanart", outputIndex);

                var list = new List<string>
                {
                    Path.Combine(item.ContainingFolderPath, "extrafanart", extraFanartFilename + extension)
                };

                if (EnableExtraThumbsDuplication)
                {
                    list.Add(Path.Combine(item.ContainingFolderPath, "extrathumbs", "thumb" + outputIndex.ToString(UsCulture) + extension));
                }
                return list.ToArray();
            }

            if (type == ImageType.Primary)
            {
                if (season != null && season.IndexNumber.HasValue)
                {
                    var seriesFolder = season.SeriesPath;

                    var seasonMarker = season.IndexNumber.Value == 0
                                           ? "-specials"
                                           : season.IndexNumber.Value.ToString("00", UsCulture);

                    var imageFilename = "season" + seasonMarker + "-poster" + extension;

                    return new[] { Path.Combine(seriesFolder, imageFilename) };
                }

                if (item is Episode)
                {
                    var seasonFolder = Path.GetDirectoryName(item.Path);

                    var imageFilename = _fileSystem.GetFileNameWithoutExtension(item.Path) + "-thumb" + extension;

                    return new[] { Path.Combine(seasonFolder, imageFilename) };
                }

                if (item.DetectIsInMixedFolder() || item is MusicVideo)
                {
                    return new[] { GetSavePathForItemInMixedFolder(item, type, string.Empty, extension) };
                }

                if (item is MusicAlbum || item is MusicArtist)
//.........这里部分代码省略.........
开发者ID:t-andre,项目名称:Emby,代码行数:101,代码来源:ImageSaver.cs

示例3: PopulateImages

        private void PopulateImages(IHasImages item, List<LocalImageInfo> images, List<FileSystemMetadata> files, bool supportParentSeriesFiles, IDirectoryService directoryService)
        {
            if (supportParentSeriesFiles)
            {
                var season = item as Season;

                if (season != null)
                {
                    PopulateSeasonImagesFromSeriesFolder(season, images, directoryService);
                }
            }
            
            var imagePrefix = item.FileNameWithoutExtension + "-";
            var isInMixedFolder = item.DetectIsInMixedFolder();

            PopulatePrimaryImages(item, images, files, imagePrefix, isInMixedFolder);

            AddImage(files, images, "logo", imagePrefix, isInMixedFolder, ImageType.Logo);
            AddImage(files, images, "clearart", imagePrefix, isInMixedFolder, ImageType.Art);

            // For music albums, prefer cdart before disc
            if (item is MusicAlbum)
            {
                AddImage(files, images, "cdart", imagePrefix, isInMixedFolder, ImageType.Disc);
                AddImage(files, images, "disc", imagePrefix, isInMixedFolder, ImageType.Disc);
            }
            else
            {
                AddImage(files, images, "disc", imagePrefix, isInMixedFolder, ImageType.Disc);
                AddImage(files, images, "cdart", imagePrefix, isInMixedFolder, ImageType.Disc);
            }

            AddImage(files, images, "box", imagePrefix, isInMixedFolder, ImageType.Box);
            AddImage(files, images, "back", imagePrefix, isInMixedFolder, ImageType.BoxRear);
            AddImage(files, images, "boxrear", imagePrefix, isInMixedFolder, ImageType.BoxRear);
            AddImage(files, images, "menu", imagePrefix, isInMixedFolder, ImageType.Menu);

            // Banner
            AddImage(files, images, "banner", imagePrefix, isInMixedFolder, ImageType.Banner);

            // Thumb
            AddImage(files, images, "landscape", imagePrefix, isInMixedFolder, ImageType.Thumb);
            AddImage(files, images, "thumb", imagePrefix, isInMixedFolder, ImageType.Thumb);

            PopulateBackdrops(item, images, files, imagePrefix, isInMixedFolder, directoryService);
            PopulateScreenshots(images, files, imagePrefix, isInMixedFolder);
        }
开发者ID:t-andre,项目名称:Emby,代码行数:47,代码来源:LocalImageProvider.cs


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