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


C# Rating.ToString方法代码示例

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


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

示例1: GetURL

		public static string GetURL (string email, int size, Rating rating = Rating.PG)
		{
			var hash = MD5Hash (email.ToLower ());

			if (size < 1 | size > 600) {
				throw new ArgumentOutOfRangeException("size", "The image size should be between 20 and 80");
			}

			return _url + hash + "&s=" + size.ToString () + "&r=" + rating.ToString ().ToLower ();
		}
开发者ID:AsiyaLearn,项目名称:xamarin-store-app,代码行数:10,代码来源:Gravatar.cs

示例2: GetURL

		public static string GetURL(string email, int size, Rating rating = Rating.PG)
		{
			var hash = MD5Hash(email.ToLower());

			if (size < 1 | size > 600)
			{
				throw new ArgumentOutOfRangeException("size", "The image size should be between 20 and 80");
			}

			return string.Format("{0}{1}&s={2}&r={3}", _url, hash, size, rating.ToString().ToLower());
		}
开发者ID:pmourfield,项目名称:xamarin-store-app,代码行数:11,代码来源:Gravatar.cs

示例3: GetImageSource

        public static string GetImageSource(string email, string defaultImage, int size=80, Rating maxRating=Rating.X)
        {
            if (string.IsNullOrEmpty(email) || string.IsNullOrEmpty(email.Trim()))
                return defaultImage;

            var imageUrl = "http://www.gravatar.com/avatar.php?";
            var encoder = new UTF8Encoding();
            var md5 = new System.Security.Cryptography.MD5CryptoServiceProvider();
            var hashedBytes = md5.ComputeHash(encoder.GetBytes(email.ToLower()));
            var sb = new StringBuilder(hashedBytes.Length*2);

            for (var i = 0; i < hashedBytes.Length; i++)
                sb.Append(hashedBytes[i].ToString("X2"));

            imageUrl += "gravatar_id=" + sb.ToString().ToLower();
            imageUrl += "&rating=" + maxRating.ToString();
            imageUrl += "&size=" + size.ToString();

            if (!string.IsNullOrEmpty(defaultImage))
                imageUrl += "&default=" + System.Web.HttpUtility.UrlEncode(defaultImage);

            return imageUrl;
        }
开发者ID:xianmingliu,项目名称:CMS,代码行数:23,代码来源:GravatarHelper.cs

示例4: BuildGravatarUrl

        /// <summary>
        /// Builds a <see cref="System.Uri"/> corresponding to a given email address.
        /// </summary>
        /// <param name="email">The email address for which to build the <see cref="System.Uri"/>.</param>
        /// <param name="size">The size of the image to request.  The default is 32.</param>
        /// <param name="useHttps">Indicates whether or not the request should be performed over Secure HTTP.</param>
        /// <param name="rating">The mazimum rating of the returned image.</param>
        /// <param name="fallBack">The Gravatar service that will be used for fall-back.</param>
        /// <returns>The constructed <see cref="System.Uri"/>.</returns>
        private static Uri BuildGravatarUrl(string email, int size, bool useHttps, Rating rating, FallBackService fallBack)
        {
            var builder = new UriBuilder("http://www.gravatar.com/avatar/");

            if (useHttps)
            {
                builder.Scheme = "https";
            }

            builder.Path += HashEmail(email);

            string d;
            if (!fallBackStrings.TryGetValue(fallBack, out d))
            {
                d = "404";
            }

            var query = string.Format("s={0}&r={1}&d={2}",
                size.ToString(),
                rating.ToString().ToLowerInvariant(),
                d);

            builder.Query = query;

            return builder.Uri;
        }
开发者ID:Carbenium,项目名称:gitextensions,代码行数:35,代码来源:GravatarService.cs


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