private string ToString(bool urlencoded, IDictionary excludeKeys) { string item; string empty; int count; int num = this.Count; if (num != 0) { StringBuilder stringBuilder = new StringBuilder(); for (int i = 0; i < num; i++) { string key = this.GetKey(i); if (excludeKeys == null || key == null || excludeKeys[key] == null) { if (urlencoded) { key = UrlUtility.UrlEncodeUnicode(key); } if (!string.IsNullOrEmpty(key)) { empty = string.Concat(key, "="); } else { empty = string.Empty; } string str = empty; ArrayList arrayLists = (ArrayList)base.BaseGet(i); if (arrayLists != null) { count = arrayLists.Count; } else { count = 0; } int num1 = count; if (stringBuilder.Length > 0) { stringBuilder.Append('&'); } if (num1 != 1) { if (num1 != 0) { for (int j = 0; j < num1; j++) { if (j > 0) { stringBuilder.Append('&'); } stringBuilder.Append(str); item = (string)arrayLists[j]; if (urlencoded) { item = UrlUtility.UrlEncodeUnicode(item); } stringBuilder.Append(item); } } else { stringBuilder.Append(str); } } else { stringBuilder.Append(str); item = (string)arrayLists[0]; if (urlencoded) { item = UrlUtility.UrlEncodeUnicode(item); } stringBuilder.Append(item); } } } return(stringBuilder.ToString()); } else { return(string.Empty); } }
string ToString(bool urlencoded, IDictionary excludeKeys) { int n = Count; if (n == 0) { return(string.Empty); } StringBuilder s = new StringBuilder(); string key, keyPrefix, item; for (int i = 0; i < n; i++) { key = GetKey(i); if (excludeKeys != null && key != null && excludeKeys[key] != null) { continue; } if (urlencoded) { key = UrlUtility.UrlEncodeUnicode(key); } keyPrefix = (!string.IsNullOrEmpty(key)) ? (key + "=") : string.Empty; ArrayList values = (ArrayList)BaseGet(i); int numValues = (values != null) ? values.Count : 0; if (s.Length > 0) { s.Append('&'); } if (numValues == 1) { s.Append(keyPrefix); item = (string)values[0]; if (urlencoded) { item = UrlUtility.UrlEncodeUnicode(item); } s.Append(item); } else if (numValues == 0) { s.Append(keyPrefix); } else { for (int j = 0; j < numValues; j++) { if (j > 0) { s.Append('&'); } s.Append(keyPrefix); item = (string)values[j]; if (urlencoded) { item = UrlUtility.UrlEncodeUnicode(item); } s.Append(item); } } } return(s.ToString()); }
private string ToString(bool urlencoded, IDictionary excludeKeys) { int count = this.Count; if (count == 0) { return(string.Empty); } StringBuilder builder = new StringBuilder(); for (int i = 0; i < count; i++) { string key = this.GetKey(i); if (((excludeKeys == null) || (key == null)) || (excludeKeys[key] == null)) { string str3; if (urlencoded) { key = UrlUtility.UrlEncodeUnicode(key); } string str2 = !string.IsNullOrEmpty(key) ? (key + "=") : string.Empty; ArrayList list = (ArrayList)base.BaseGet(i); int num3 = (list != null) ? list.Count : 0; if (builder.Length > 0) { builder.Append('&'); } if (num3 == 1) { builder.Append(str2); str3 = (string)list[0]; if (urlencoded) { str3 = UrlUtility.UrlEncodeUnicode(str3); } builder.Append(str3); } else if (num3 == 0) { builder.Append(str2); } else { for (int j = 0; j < num3; j++) { if (j > 0) { builder.Append('&'); } builder.Append(str2); str3 = (string)list[j]; if (urlencoded) { str3 = UrlUtility.UrlEncodeUnicode(str3); } builder.Append(str3); } } } } return(builder.ToString()); }