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


C# ResizeSettings.ToString方法代码示例

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


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

示例1: TestCropValues

 public void TestCropValues()
 {
     ResizeSettings s = new ResizeSettings();
     s.CropBottomRight = new System.Drawing.PointF(50, 50);
     s.CropTopLeft = new System.Drawing.PointF(0, 0);
     Assert.AreEqual<string>( "?crop=0,0,50,50", s.ToString());
     s.CropMode = CropMode.Auto;
     Assert.AreEqual<string>("?crop=auto", s.ToString());
 }
开发者ID:eakova,项目名称:resizer,代码行数:9,代码来源:ResizeSettingsTest.cs

示例2: GetImageCachePath

 public string GetImageCachePath(string url, ResizeSettings settings)
 {
     string imageDir = Path.GetDirectoryName(url);
     if (imageDir == null)
     {
         imageDir = string.Empty;
     }
     string hasedProperties = CreateMd5Hash(settings.ToString());
     string cachedFileName = string.Format("{0}/{1}-{2}.{3}",
                                           GetFolderHash(imageDir),
                                           Path.GetFileNameWithoutExtension(url),
                                           hasedProperties,
                                           GetCleanFileExtension(url));
     string cachedImagePath = string.Concat(Consts.CacheFolderPath, "/", cachedFileName.TrimStart('/', '\\'));
     return cachedImagePath;
 }
开发者ID:CEBD,项目名称:MerrickHomeConstruction,代码行数:16,代码来源:ImageResizerService.cs

示例3: GetMemCachedBitmap

        /// <summary>
        /// Loads or caches a bitmap, using asp.net's cache (when available)
        /// </summary>
        /// <param name="query"></param>
        /// <param name="virtualPath"></param>
        /// <param name="onlyLoadIfCacheExists">Whether to load the image when
        /// no cache is available.  Pass <c>true</c> for pre-fetching, and
        /// <c>false</c> if the image is needed immediately.</param>
        /// <returns>Returns the Bitmap.  If no cache is available, and
        /// <c>onlyLoadIfCacheExists</c> is <c>true</c>, returns <c>null</c>
        /// rather than loading the Bitmap.</returns>
        public Bitmap GetMemCachedBitmap(string virtualPath, ResizeSettings query, bool onlyLoadIfCacheExists = false)
        {
            //If not ASP.NET, don't cache.
            if (HttpContext.Current == null) return onlyLoadIfCacheExists ? null : c.CurrentImageBuilder.LoadImage(virtualPath, query);

            string key = virtualPath.ToLowerInvariant() + query.ToString();
            Bitmap b = HttpContext.Current.Cache[key] as Bitmap;
            if (b != null) return b;
            try
            {
                b = c.CurrentImageBuilder.LoadImage(virtualPath, query);
            }
            catch (FileNotFoundException fe)
            {
                throw new ImageProcessingException(500, "Failed to located watermark " + virtualPath, "Failed to located a watermarking file", fe);
            }
            //Query VPPs for cache dependency. TODO: Add support for IVirtualImageProviders to customize cache dependencies.
            CacheDependency cd = null;
            if (HostingEnvironment.VirtualPathProvider != null) cd = HostingEnvironment.VirtualPathProvider.GetCacheDependency(virtualPath, new string[] { }, DateTime.UtcNow);

            HttpContext.Current.Cache.Insert(key, b, cd);
            return b;
        }
开发者ID:stukalin,项目名称:ImageResizer,代码行数:34,代码来源:ImageLayer.cs

示例4: CreateSettingsHash

        private string CreateSettingsHash(ResizeSettings settings)
        {
            if (settings.Count == 2 && settings.MaxWidth > 0 && settings.MaxWidth == settings.MaxHeight)
            {
                return settings.MaxWidth.ToString();
            }
			return settings.ToString().Hash(Encoding.ASCII);
        }
开发者ID:boatengfrankenstein,项目名称:SmartStoreNET,代码行数:8,代码来源:ImageCache.cs

示例5: GetMemCachedBitmap

        /// <summary>
        /// Loads a bitmap, cached using asp.net's cache
        /// </summary>
        /// <param name="query"></param>
        /// <param name="virtualPath"></param>
        /// <returns></returns>
        public Bitmap GetMemCachedBitmap(string virtualPath, ResizeSettings query)
        {
            //If not ASP.NET, don't cache.
            if (HttpContext.Current == null) return c.CurrentImageBuilder.LoadImage(virtualPath, query);

            string key = virtualPath.ToLowerInvariant() + query.ToString();
            Bitmap b = HttpContext.Current.Cache[key] as Bitmap;
            if (b != null) return b;

            b = c.CurrentImageBuilder.LoadImage(virtualPath, query);
            //Query VPPs for cache dependency. TODO: Add support for IVirtualImageProviders to customize cache dependencies.
            CacheDependency cd = null;
            if (HostingEnvironment.VirtualPathProvider != null) cd = HostingEnvironment.VirtualPathProvider.GetCacheDependency(virtualPath, new string[] { }, DateTime.UtcNow);

            HttpContext.Current.Cache.Insert(key, b, cd);
            return b;
        }
开发者ID:kevjett,项目名称:Resizer,代码行数:23,代码来源:ImageLayer.cs


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