source: extensions/PiwigoLib/PiwigoLib/Proxy/Helper/PwgProxyReponseHelper.cs @ 3827

Last change on this file since 3827 was 3827, checked in by bayral, 15 years ago

pwg.tags.getImages support

File size: 1.1 KB
Line 
1using System;
2using System.Collections.Generic;
3using System.Linq;
4using System.Text;
5using System.Web;
6
7namespace Com.Piwigo.Lib.Proxy.Helper
8{
9    public static class PwgProxyReponseHelper<T>
10    {
11        public static void buildQueryFromArray(List<T> values, String paramName, ref Boolean firstOcc, StringBuilder queryStringBuilder)
12        {
13            String FormatString = String.Empty;
14            if (values != null)
15            {
16                if (values.Count == 1)
17                {
18                    FormatString = "{0}={1}";
19                }
20                else
21                {
22                    FormatString = "{0}[]={1}";
23                }
24                if (firstOcc != true)
25                {
26                    FormatString = String.Format("&{0}", FormatString);
27                }
28
29                foreach (T occurance in values)
30                {
31                    queryStringBuilder.AppendFormat(FormatString, paramName, HttpUtility.UrlEncode(occurance.ToString().ToLower()));
32                    firstOcc = false;
33                }
34
35            }
36
37        }
38    }
39}
Note: See TracBrowser for help on using the repository browser.