Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches

◆ GetValuesToUpload()

byte[] System.Net.WebClient.GetValuesToUpload ( NameValueCollection data)
inlineprivate

Definition at line 799 of file WebClient.cs.

800 {
801 WebHeaderCollection headers = Headers;
802 string text = headers["Content-Type"];
803 if (text != null && !string.Equals(text, "application/x-www-form-urlencoded", StringComparison.OrdinalIgnoreCase))
804 {
805 throw new WebException(System.SR.net_webclient_ContentType);
806 }
807 headers["Content-Type"] = "application/x-www-form-urlencoded";
808 string value = string.Empty;
809 StringBuilder stringBuilder = new StringBuilder();
810 string[] allKeys = data.AllKeys;
811 foreach (string text2 in allKeys)
812 {
813 stringBuilder.Append(value);
814 stringBuilder.Append(UrlEncode(text2));
815 stringBuilder.Append('=');
816 stringBuilder.Append(UrlEncode(data[text2]));
817 value = "&";
818 }
819 byte[] bytes = System.Text.Encoding.ASCII.GetBytes(stringBuilder.ToString());
820 _contentLength = bytes.Length;
821 return bytes;
822 }
static string UrlEncode(string str)
WebHeaderCollection Headers
Definition WebClient.cs:197
static string net_webclient_ContentType
Definition SR.cs:16
Definition SR.cs:7
static Encoding ASCII
Definition Encoding.cs:511
override string ToString()
StringBuilder Append(char value, int repeatCount)

References System.Net.WebClient._contentLength, System.Collections.Specialized.NameValueCollection.AllKeys, System.Text.Encoding.ASCII, System.bytes, System.Net.Equals, System.Net.WebClient.Headers, System.SR.net_webclient_ContentType, System.text, System.Net.WebClient.UrlEncode(), and System.value.

Referenced by System.Net.WebClient.UploadValues(), and System.Net.WebClient.UploadValuesAsync().