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


C# ImageType.ToString方法代码示例

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


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

示例1: GetRootWebDirectory

 public static string GetRootWebDirectory(ImageType type)
 {
     if (type == ImageType.CP) { return CFSettings.WebClimberProfilePicImgDir; }
     if (type == ImageType.CPinPF) { return CFSettings.WebClimberProfilePicImgDir; }
     if (type == ImageType.CPinPS) { return CFSettings.WebClimberProfilePicImgDir; }
     if (type == ImageType.CPinMB) { return CFSettings.WebClimberProfilePicImgDir; }
     else
     {
         throw new Exception(string.Format("Image type [{0}] not supported in GetWebDirecotry", type.ToString()));
     }
 }
开发者ID:jkresner,项目名称:Climbfind_v3_2009,代码行数:11,代码来源:CFImageInfo.cs

示例2: GetAll

 /// <summary>
 /// Retrieve all images available on your account.
 /// </summary>
 public Task<IReadOnlyList<Image>> GetAll(ImageType type = ImageType.All) {
     var endpoint = "images";
     switch (type)
     {
         case ImageType.All:
             break;
         case ImageType.Application:
             endpoint += "?type=" + type.ToString().ToLower();
             break;
         case ImageType.Distribution:
             endpoint += "?type=" + type.ToString().ToLower();
             break;
         case ImageType.Private:
             endpoint += "?private=true";
             break;
         default:
             throw new ArgumentOutOfRangeException("type");
     }
     return _connection.GetPaginated<Image>(endpoint, null, "images");
 }
开发者ID:sanyaade-fintechnology,项目名称:DigitalOcean.API,代码行数:23,代码来源:ImagesClient.cs

示例3: GetRootOSDirectory

 public static string GetRootOSDirectory(ImageType type)
 {
     if (type == ImageType.CP) { return CFSettings.OSClimberProfilePicImgDir; }
     if (type == ImageType.CPinPF) { return CFSettings.OSClimberProfilePicImgDir; }
     if (type == ImageType.CPinPS) { return CFSettings.OSClimberProfilePicImgDir; }
     if (type == ImageType.CPinMB) { return CFSettings.OSClimberProfilePicImgDir; }
     if (type == ImageType.GP) { return CFSettings.OSGroupProfilePicImgDir; }
     if (type == ImageType.GPinGD) { return CFSettings.OSGroupProfilePicImgDir; }
     if (type == ImageType.OPP) { return CFSettings.OSOutdoorPlaceProfilePicImgDir; }
     if (type == ImageType.IPL) { return CFSettings.OSIndoorPlaceLogoImgDir; }
     if (type == ImageType.CL) { return CFSettings.OSClubLogoLogoImgDir; }
     if (type == ImageType.OCP) { return CFSettings.OSOutdoorCragProfilePicImgDir; }
     else
     {
         throw new Exception(string.Format("Image type [{0}] not supported in GetOSDirecotry", type.ToString()));
     }
 }
开发者ID:jkresner,项目名称:Climbfind_v3_2009,代码行数:17,代码来源:CFImageInfo.cs

示例4: GetChannelImage

        public Task<DynamicImageResponse> GetChannelImage(ImageType type, CancellationToken cancellationToken)
        {
            switch (type)
            {
                case ImageType.Thumb:
                case ImageType.Backdrop:
                    {
                        var path = GetType().Namespace + ".Images." + type.ToString().ToLower() + ".png";

                        return Task.FromResult(new DynamicImageResponse
                        {
                            Format = ImageFormat.Png,
                            HasImage = true,
                            Stream = GetType().Assembly.GetManifestResourceStream(path)
                        });
                    }
                case ImageType.Primary:
                    {
                        var path = GetType().Namespace + ".Images." + type.ToString().ToLower() + ".jpg";

                        return Task.FromResult(new DynamicImageResponse
                        {
                            Format = ImageFormat.Jpg,
                            HasImage = true,
                            Stream = GetType().Assembly.GetManifestResourceStream(path)
                        });
                    }
                default:
                    throw new ArgumentException("Unsupported image type: " + type);
            }
        }
开发者ID:curtisghanson,项目名称:Emby.Channels,代码行数:31,代码来源:TwitchChannel.cs

示例5: 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(BaseItem item, ImageType type, int? imageIndex, string mimeType, bool saveLocally)
        {
            string filename;

            switch (type)
            {
                case ImageType.Art:
                    filename = "clearart";
                    break;
                case ImageType.Primary:
                    filename = item is Episode ? Path.GetFileNameWithoutExtension(item.Path) : "folder";
                    break;
                case ImageType.Backdrop:
                    if (!imageIndex.HasValue)
                    {
                        throw new ArgumentNullException("imageIndex");
                    }
                    filename = GetBackdropSaveFilename(item.BackdropImagePaths, "backdrop", "backdrop", imageIndex.Value);
                    break;
                case ImageType.Screenshot:
                    if (!imageIndex.HasValue)
                    {
                        throw new ArgumentNullException("imageIndex");
                    }
                    filename = GetBackdropSaveFilename(item.ScreenshotImagePaths, "screenshot", "screenshot", imageIndex.Value);
                    break;
                default:
                    filename = type.ToString().ToLower();
                    break;
            }

            var extension = mimeType.Split('/').Last();

            if (string.Equals(extension, "jpeg", StringComparison.OrdinalIgnoreCase))
            {
                extension = "jpg";
            }

            extension = "." + extension.ToLower();

            string path = null;

            if (saveLocally)
            {
                if (item.IsInMixedFolder && !(item is Episode))
                {
                    path = GetSavePathForItemInMixedFolder(item, type, filename, extension);
                }

                if (string.IsNullOrEmpty(path))
                {
                    path = Path.Combine(item.MetaLocation, filename + extension);
                }
            }

            // None of the save local conditions passed, so store it in our internal folders
            if (string.IsNullOrEmpty(path))
            {
                path = _remoteImageCache.GetResourcePath(item.GetType().FullName + item.Id, filename + extension);
            }

            return path;
        }
开发者ID:Jon-theHTPC,项目名称:MediaBrowser,代码行数:77,代码来源:ImageSaver.cs

示例6: 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 (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.IsInMixedFolder)
                {
                    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 ? "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))
            {
                extension = ".jpg";
            }

            extension = extension.ToLower();

            string path = null;

            if (saveLocally)
            {
//.........这里部分代码省略.........
开发者ID:loose-wardrobe,项目名称:Emby,代码行数:101,代码来源:ImageSaver.cs

示例7: AddCacheKeyImage

        private void AddCacheKeyImage(IEnumerable<FileSystemMetadata> files, List<LocalImageInfo> images, ImageType type)
        {
            var candidates = files
                .Where(i => _fileSystem.GetFileNameWithoutExtension(i).StartsWith(type.ToString() + "_key_", StringComparison.OrdinalIgnoreCase))
                .ToList();

            var image = BaseItem.SupportedImageExtensions
                .Select(i => candidates.FirstOrDefault(c => string.Equals(c.Extension, i, StringComparison.OrdinalIgnoreCase)))
                .FirstOrDefault(i => i != null);

            if (image != null)
            {
                images.Add(new LocalImageInfo
                {
                    FileInfo = image,
                    Type = type
                });
            }
        }
开发者ID:NickBolles,项目名称:Emby,代码行数:19,代码来源:LocalImageProvider.cs

示例8: 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)
        {
            string filename;

            switch (type)
            {
                case ImageType.Art:
                    filename = "clearart";
                    break;
                case ImageType.BoxRear:
                    filename = "back";
                    break;
                case ImageType.Disc:
                    filename = item is MusicAlbum ? "cdart" : "disc";
                    break;
                case ImageType.Primary:
                    filename = item is Episode ? _fileSystem.GetFileNameWithoutExtension(item.Path) : "folder";
                    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;
            }

            var extension = mimeType.Split('/').Last();

            if (string.Equals(extension, "jpeg", StringComparison.OrdinalIgnoreCase))
            {
                extension = "jpg";
            }

            extension = "." + extension.ToLower();

            string path = null;

            if (saveLocally)
            {
                if (item is Episode)
                {
                    path = Path.Combine(Path.GetDirectoryName(item.Path), "metadata", filename + extension);
                }

                else if (item.IsInMixedFolder)
                {
                    path = GetSavePathForItemInMixedFolder(item, type, filename, extension);
                }

                if (string.IsNullOrEmpty(path))
                {
                    path = Path.Combine(item.ContainingFolderPath, filename + extension);
                }
            }

            // None of the save local conditions passed, so store it in our internal folders
            if (string.IsNullOrEmpty(path))
            {
                if (string.IsNullOrEmpty(filename))
                {
                    filename = "folder";
                }
                path = Path.Combine(item.GetInternalMetadataPath(), filename + extension);
            }

            return path;
        }
开发者ID:rezafouladian,项目名称:Emby,代码行数:84,代码来源:ImageSaver.cs

示例9: GetCacheKeyPath

 private string GetCacheKeyPath(IHasImages item, ImageType type, string mimeType, string key)
 {
     var extension = MimeTypes.ToExtension(mimeType);
     return Path.Combine(item.GetInternalMetadataPath(), type.ToString().ToLower() + "_key_" + key + extension);
 }
开发者ID:jabbera,项目名称:MediaBrowser,代码行数:5,代码来源:ImageSaver.cs

示例10: GetStandardSavePaths

        private IEnumerable<string> GetStandardSavePaths(IHasImages item, ImageType type, int imageIndex, string extension)
        {
            string filename;

            switch (type)
            {
                case ImageType.Art:
                    filename = "clearart";
                    break;
                case ImageType.BoxRear:
                    filename = "back";
                    break;
                case ImageType.Disc:
                    filename = item is MusicAlbum ? "cdart" : "disc";
                    break;
                case ImageType.Screenshot:
                    filename = GetBackdropSaveFilename(item.GetImages(type), "screenshot", "screenshot", imageIndex);
                    break;
                default:
                    filename = type.ToString().ToLower();
                    break;
            }

            string path = null;

            if (item.IsInMixedFolder)
            {
                path = GetSavePathForItemInMixedFolder(item, type, filename, extension);
            }

            if (string.IsNullOrEmpty(path))
            {
                path = Path.Combine(item.ContainingFolderPath, filename + extension);
            }

            if (string.IsNullOrEmpty(path))
            {
                return new string[] { };
            }

            return new[] { path };
        }
开发者ID:rezafouladian,项目名称:Emby,代码行数:42,代码来源:XbmcImageSaver.cs

示例11: GetSavePath

        /// <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 GetSavePath(BaseItem item, ImageType type, int? imageIndex, string mimeType, bool saveLocally)
        {
            string filename;

            switch (type)
            {
                case ImageType.Art:
                    filename = "clearart";
                    break;
                case ImageType.Primary:
                    filename = item is Episode ? Path.GetFileNameWithoutExtension(item.Path) : "folder";
                    break;
                case ImageType.Backdrop:
                    if (!imageIndex.HasValue)
                    {
                        throw new ArgumentNullException("imageIndex");
                    }
                    filename = imageIndex.Value == 0 ? "backdrop" : "backdrop" + imageIndex.Value.ToString(UsCulture);
                    break;
                case ImageType.Screenshot:
                    if (!imageIndex.HasValue)
                    {
                        throw new ArgumentNullException("imageIndex");
                    }
                    filename = imageIndex.Value == 0 ? "screenshot" : "screenshot" + imageIndex.Value.ToString(UsCulture);
                    break;
                default:
                    filename = type.ToString().ToLower();
                    break;
            }

            var extension = mimeType.Split('/').Last();

            if (string.Equals(extension, "jpeg", StringComparison.OrdinalIgnoreCase))
            {
                extension = "jpg";
            }

            filename += "." + extension.ToLower();

            var path = (saveLocally && !string.IsNullOrEmpty(item.MetaLocation)) ?
                Path.Combine(item.MetaLocation, filename) :
                _remoteImageCache.GetResourcePath(item.GetType().FullName + item.Id, filename);

            var parentPath = Path.GetDirectoryName(path);

            if (!Directory.Exists(parentPath))
            {
                Directory.CreateDirectory(parentPath);
            }

            return path;
        }
开发者ID:JasoonJ,项目名称:MediaBrowser,代码行数:67,代码来源:ImageSaver.cs

示例12: GetImage

 private BitmapImage GetImage(ImageType image)
 {
     return Application.Current.TryFindResource(image.ToString() + "Image") as BitmapImage;
 }
开发者ID:nagyistoce,项目名称:ArchitectureCampSample,代码行数:4,代码来源:AppButton.cs

示例13: Src

		public ImageTag Src(ImageType type, byte[] source)
		{
			Attr(HtmlAttributeConstants.Src,
			     string.Format("data:image/{0},{1}", type.ToString().ToLower(), Convert.ToBase64String(source)));
			return this;
		}
开发者ID:ryanohs,项目名称:Fubu-HtmlTags-For-ASP.NET-MVC,代码行数:6,代码来源:ImageTag.cs


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