private RequestParameter[] GetImageOptionsParameters(ImageOptions options)
        {
            if (!options.Width.HasValue && !options.Height.HasValue)
            {
                return(new RequestParameter[0]);
            }

            List <RequestParameter> parameters = new List <RequestParameter>();

            if (options.Width.HasValue)
            {
                parameters.Add(RequestParameter.Create("width", options.Width));
            }

            if (options.Height.HasValue)
            {
                parameters.Add(RequestParameter.Create("height", options.Height));
            }

            if (options.ResizeMode != ImageResizeMode.Default)
            {
                parameters.Add(RequestParameter.Create("mode", options.ResizeMode));
            }

            return(parameters.ToArray());
        }
Exemple #2
0
 /// <summary>
 /// Creates a new request parameter.
 /// </summary>
 /// <param name="parameterName">The name of the parameter.</param>
 /// <param name="value">The value.</param>
 public static RequestParameter Create(string parameterName, object value)
 {
     return(new RequestParameter(parameterName, RequestParameter.GetString(value)));
 }