RestImageResize/ImageTransformQuery.cs
/// <summary>
/// Creates and fills instance of <see cref="ImageTransformQuery"/> from URL query string values collection.
/// </summary>
/// <param name="queryString">The URL query string values collection.</param>
/// <param name="defaultTransform">The default transform.</param>
/// <returns>
/// The query instance.
/// </returns>
Creates and fills instance of  from URL query string values collection.
Creates and fills instance of from URL query string values collection .
[NotNull]
        public static ImageTransformQuery FromQueryString([NotNull] NameValueCollection queryString, ImageTransform defaultTransform = ImageTransform.DownFit)
        {
            if (queryString == null) throw new ArgumentNullException(nameof(queryString));
            var queryKeys = new HashSet<string>(new[]
            {
                "width",
                "height",
                "transform",
                "h"
            }, StringComparer.InvariantCultureIgnoreCase);
            var result = new ImageTransformQuery
            {
                Width = (int)SmartConvert.ChangeType<uint>(queryString["width"]),
                Height = (int)SmartConvert.ChangeType<uint>(queryString["height"]),
                Transform = SmartConvert.ChangeType(queryString["transform"], defaultTransform),
                Hash = queryString["h"]
            };
            foreach (string key in queryString)
            {
                if (!queryKeys.Contains(key))
                    result.Parameters.Add(key, queryString[key]);
            }
            return result;
        }
[ NotNull ] public static ImageTransformQuery FromQueryString ( [ NotNull ] NameValueCollection queryString , ImageTransform defaultTransform = ImageTransform . DownFit ) { if ( queryString == null ) throw new ArgumentNullException ( nameof ( queryString ) ) ; var queryKeys = new HashSet < string > ( new [ ] { " " , " " , " " , " " } , StringComparer . InvariantCultureIgnoreCase ) ; var result = new ImageTransformQuery { Width = ( int ) SmartConvert . ChangeType < uint > ( queryString [ " " ] ) , Height = ( int ) SmartConvert . ChangeType < uint > ( queryString [ " " ] ) , Transform = SmartConvert . ChangeType ( queryString [ " " ] , defaultTransform ) , Hash = queryString [ " " ] } ; foreach ( string key in queryString ) { if ( ! queryKeys . Contains ( key ) ) result . Parameters . Add ( key , queryString [ key ] ) ; } return result ; }
Creates and fills instance of  from URL query string values collection.
Creates and fills instance of from URL query string values collection .
The query instance.
The query instance .
NameValueCollection
[NotNull]
defaultTransform
ImageTransform
The default transform.
The default transform .
queryString
The URL query string values collection.
The URL query string values collection .