scripts
This commit is contained in:
@@ -0,0 +1,2214 @@
|
||||
using System;
|
||||
using System.Collections.Specialized;
|
||||
using System.ComponentModel;
|
||||
using System.IO;
|
||||
using System.Net.Cache;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
|
||||
namespace System.Net
|
||||
{
|
||||
/// <summary>Provides common methods for sending data to and receiving data from a resource identified by a URI.</summary>
|
||||
// Token: 0x0200025F RID: 607
|
||||
[ComVisible(true)]
|
||||
public class WebClient : global::System.ComponentModel.Component
|
||||
{
|
||||
// Token: 0x060015A2 RID: 5538 RVA: 0x00045484 File Offset: 0x00043684
|
||||
static WebClient()
|
||||
{
|
||||
int num = 0;
|
||||
int i = 48;
|
||||
while (i <= 57)
|
||||
{
|
||||
WebClient.hexBytes[num] = (byte)i;
|
||||
i++;
|
||||
num++;
|
||||
}
|
||||
int j = 97;
|
||||
while (j <= 102)
|
||||
{
|
||||
WebClient.hexBytes[num] = (byte)j;
|
||||
j++;
|
||||
num++;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Occurs when an asynchronous data download operation completes.</summary>
|
||||
// Token: 0x14000027 RID: 39
|
||||
// (add) Token: 0x060015A3 RID: 5539 RVA: 0x000454EC File Offset: 0x000436EC
|
||||
// (remove) Token: 0x060015A4 RID: 5540 RVA: 0x00045508 File Offset: 0x00043708
|
||||
public event DownloadDataCompletedEventHandler DownloadDataCompleted;
|
||||
|
||||
/// <summary>Occurs when an asynchronous file download operation completes.</summary>
|
||||
// Token: 0x14000028 RID: 40
|
||||
// (add) Token: 0x060015A5 RID: 5541 RVA: 0x00045524 File Offset: 0x00043724
|
||||
// (remove) Token: 0x060015A6 RID: 5542 RVA: 0x00045540 File Offset: 0x00043740
|
||||
public event global::System.ComponentModel.AsyncCompletedEventHandler DownloadFileCompleted;
|
||||
|
||||
/// <summary>Occurs when an asynchronous download operation successfully transfers some or all of the data.</summary>
|
||||
// Token: 0x14000029 RID: 41
|
||||
// (add) Token: 0x060015A7 RID: 5543 RVA: 0x0004555C File Offset: 0x0004375C
|
||||
// (remove) Token: 0x060015A8 RID: 5544 RVA: 0x00045578 File Offset: 0x00043778
|
||||
public event DownloadProgressChangedEventHandler DownloadProgressChanged;
|
||||
|
||||
/// <summary>Occurs when an asynchronous resource-download operation completes.</summary>
|
||||
// Token: 0x1400002A RID: 42
|
||||
// (add) Token: 0x060015A9 RID: 5545 RVA: 0x00045594 File Offset: 0x00043794
|
||||
// (remove) Token: 0x060015AA RID: 5546 RVA: 0x000455B0 File Offset: 0x000437B0
|
||||
public event DownloadStringCompletedEventHandler DownloadStringCompleted;
|
||||
|
||||
/// <summary>Occurs when an asynchronous operation to open a stream containing a resource completes.</summary>
|
||||
// Token: 0x1400002B RID: 43
|
||||
// (add) Token: 0x060015AB RID: 5547 RVA: 0x000455CC File Offset: 0x000437CC
|
||||
// (remove) Token: 0x060015AC RID: 5548 RVA: 0x000455E8 File Offset: 0x000437E8
|
||||
public event OpenReadCompletedEventHandler OpenReadCompleted;
|
||||
|
||||
/// <summary>Occurs when an asynchronous operation to open a stream to write data to a resource completes.</summary>
|
||||
// Token: 0x1400002C RID: 44
|
||||
// (add) Token: 0x060015AD RID: 5549 RVA: 0x00045604 File Offset: 0x00043804
|
||||
// (remove) Token: 0x060015AE RID: 5550 RVA: 0x00045620 File Offset: 0x00043820
|
||||
public event OpenWriteCompletedEventHandler OpenWriteCompleted;
|
||||
|
||||
/// <summary>Occurs when an asynchronous data-upload operation completes.</summary>
|
||||
// Token: 0x1400002D RID: 45
|
||||
// (add) Token: 0x060015AF RID: 5551 RVA: 0x0004563C File Offset: 0x0004383C
|
||||
// (remove) Token: 0x060015B0 RID: 5552 RVA: 0x00045658 File Offset: 0x00043858
|
||||
public event UploadDataCompletedEventHandler UploadDataCompleted;
|
||||
|
||||
/// <summary>Occurs when an asynchronous file-upload operation completes.</summary>
|
||||
// Token: 0x1400002E RID: 46
|
||||
// (add) Token: 0x060015B1 RID: 5553 RVA: 0x00045674 File Offset: 0x00043874
|
||||
// (remove) Token: 0x060015B2 RID: 5554 RVA: 0x00045690 File Offset: 0x00043890
|
||||
public event UploadFileCompletedEventHandler UploadFileCompleted;
|
||||
|
||||
/// <summary>Occurs when an asynchronous upload operation successfully transfers some or all of the data.</summary>
|
||||
// Token: 0x1400002F RID: 47
|
||||
// (add) Token: 0x060015B3 RID: 5555 RVA: 0x000456AC File Offset: 0x000438AC
|
||||
// (remove) Token: 0x060015B4 RID: 5556 RVA: 0x000456C8 File Offset: 0x000438C8
|
||||
public event UploadProgressChangedEventHandler UploadProgressChanged;
|
||||
|
||||
/// <summary>Occurs when an asynchronous string-upload operation completes.</summary>
|
||||
// Token: 0x14000030 RID: 48
|
||||
// (add) Token: 0x060015B5 RID: 5557 RVA: 0x000456E4 File Offset: 0x000438E4
|
||||
// (remove) Token: 0x060015B6 RID: 5558 RVA: 0x00045700 File Offset: 0x00043900
|
||||
public event UploadStringCompletedEventHandler UploadStringCompleted;
|
||||
|
||||
/// <summary>Occurs when an asynchronous upload of a name/value collection completes.</summary>
|
||||
// Token: 0x14000031 RID: 49
|
||||
// (add) Token: 0x060015B7 RID: 5559 RVA: 0x0004571C File Offset: 0x0004391C
|
||||
// (remove) Token: 0x060015B8 RID: 5560 RVA: 0x00045738 File Offset: 0x00043938
|
||||
public event UploadValuesCompletedEventHandler UploadValuesCompleted;
|
||||
|
||||
/// <summary>Gets or sets the base URI for requests made by a <see cref="T:System.Net.WebClient" />.</summary>
|
||||
/// <returns>A <see cref="T:System.String" /> containing the base URI for requests made by a <see cref="T:System.Net.WebClient" /> or <see cref="F:System.String.Empty" /> if no base address has been specified.</returns>
|
||||
/// <exception cref="T:System.ArgumentException">
|
||||
/// <see cref="P:System.Net.WebClient.BaseAddress" /> is set to an invalid URI. The inner exception may contain information that will help you locate the error.</exception>
|
||||
/// <PermissionSet>
|
||||
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
|
||||
/// </PermissionSet>
|
||||
// Token: 0x1700071C RID: 1820
|
||||
// (get) Token: 0x060015B9 RID: 5561 RVA: 0x00045754 File Offset: 0x00043954
|
||||
// (set) Token: 0x060015BA RID: 5562 RVA: 0x00045790 File Offset: 0x00043990
|
||||
public string BaseAddress
|
||||
{
|
||||
get
|
||||
{
|
||||
if (this.baseString == null && this.baseAddress == null)
|
||||
{
|
||||
return string.Empty;
|
||||
}
|
||||
this.baseString = this.baseAddress.ToString();
|
||||
return this.baseString;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (value == null || value.Length == 0)
|
||||
{
|
||||
this.baseAddress = null;
|
||||
}
|
||||
else
|
||||
{
|
||||
this.baseAddress = new global::System.Uri(value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x060015BB RID: 5563 RVA: 0x000457BC File Offset: 0x000439BC
|
||||
private static Exception GetMustImplement()
|
||||
{
|
||||
return new NotImplementedException();
|
||||
}
|
||||
|
||||
/// <summary>Gets or sets the application's cache policy for any resources obtained by this WebClient instance using <see cref="T:System.Net.WebRequest" /> objects.</summary>
|
||||
/// <returns>A <see cref="T:System.Net.Cache.RequestCachePolicy" /> object that represents the application's caching requirements.</returns>
|
||||
// Token: 0x1700071D RID: 1821
|
||||
// (get) Token: 0x060015BC RID: 5564 RVA: 0x000457C4 File Offset: 0x000439C4
|
||||
// (set) Token: 0x060015BD RID: 5565 RVA: 0x000457CC File Offset: 0x000439CC
|
||||
[global::System.MonoTODO]
|
||||
public global::System.Net.Cache.RequestCachePolicy CachePolicy
|
||||
{
|
||||
get
|
||||
{
|
||||
throw WebClient.GetMustImplement();
|
||||
}
|
||||
set
|
||||
{
|
||||
throw WebClient.GetMustImplement();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Gets or sets a <see cref="T:System.Boolean" /> value that controls whether the <see cref="P:System.Net.CredentialCache.DefaultCredentials" /> are sent with requests.</summary>
|
||||
/// <returns>true if the default credentials are used; otherwise false. The default value is false.</returns>
|
||||
/// <PermissionSet>
|
||||
/// <IPermission class="System.Security.Permissions.EnvironmentPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Read="USERNAME" />
|
||||
/// </PermissionSet>
|
||||
// Token: 0x1700071E RID: 1822
|
||||
// (get) Token: 0x060015BE RID: 5566 RVA: 0x000457D4 File Offset: 0x000439D4
|
||||
// (set) Token: 0x060015BF RID: 5567 RVA: 0x000457DC File Offset: 0x000439DC
|
||||
[global::System.MonoTODO]
|
||||
public bool UseDefaultCredentials
|
||||
{
|
||||
get
|
||||
{
|
||||
throw WebClient.GetMustImplement();
|
||||
}
|
||||
set
|
||||
{
|
||||
throw WebClient.GetMustImplement();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Gets or sets the network credentials that are sent to the host and used to authenticate the request.</summary>
|
||||
/// <returns>An <see cref="T:System.Net.ICredentials" /> containing the authentication credentials for the request. The default is null.</returns>
|
||||
/// <PermissionSet>
|
||||
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="UnmanagedCode, ControlEvidence" />
|
||||
/// </PermissionSet>
|
||||
// Token: 0x1700071F RID: 1823
|
||||
// (get) Token: 0x060015C0 RID: 5568 RVA: 0x000457E4 File Offset: 0x000439E4
|
||||
// (set) Token: 0x060015C1 RID: 5569 RVA: 0x000457EC File Offset: 0x000439EC
|
||||
public ICredentials Credentials
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.credentials;
|
||||
}
|
||||
set
|
||||
{
|
||||
this.credentials = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Gets or sets a collection of header name/value pairs associated with the request.</summary>
|
||||
/// <returns>A <see cref="T:System.Net.WebHeaderCollection" /> containing header name/value pairs associated with this request.</returns>
|
||||
// Token: 0x17000720 RID: 1824
|
||||
// (get) Token: 0x060015C2 RID: 5570 RVA: 0x000457F8 File Offset: 0x000439F8
|
||||
// (set) Token: 0x060015C3 RID: 5571 RVA: 0x00045818 File Offset: 0x00043A18
|
||||
public WebHeaderCollection Headers
|
||||
{
|
||||
get
|
||||
{
|
||||
if (this.headers == null)
|
||||
{
|
||||
this.headers = new WebHeaderCollection();
|
||||
}
|
||||
return this.headers;
|
||||
}
|
||||
set
|
||||
{
|
||||
this.headers = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Gets or sets a collection of query name/value pairs associated with the request.</summary>
|
||||
/// <returns>A <see cref="T:System.Collections.Specialized.NameValueCollection" /> that contains query name/value pairs associated with the request. If no pairs are associated with the request, the value is an empty <see cref="T:System.Collections.Specialized.NameValueCollection" />.</returns>
|
||||
/// <PermissionSet>
|
||||
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="UnmanagedCode" />
|
||||
/// </PermissionSet>
|
||||
// Token: 0x17000721 RID: 1825
|
||||
// (get) Token: 0x060015C4 RID: 5572 RVA: 0x00045824 File Offset: 0x00043A24
|
||||
// (set) Token: 0x060015C5 RID: 5573 RVA: 0x00045844 File Offset: 0x00043A44
|
||||
public global::System.Collections.Specialized.NameValueCollection QueryString
|
||||
{
|
||||
get
|
||||
{
|
||||
if (this.queryString == null)
|
||||
{
|
||||
this.queryString = new global::System.Collections.Specialized.NameValueCollection();
|
||||
}
|
||||
return this.queryString;
|
||||
}
|
||||
set
|
||||
{
|
||||
this.queryString = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Gets a collection of header name/value pairs associated with the response.</summary>
|
||||
/// <returns>A <see cref="T:System.Net.WebHeaderCollection" /> containing header name/value pairs associated with the response, or null if no response has been received.</returns>
|
||||
/// <PermissionSet>
|
||||
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="UnmanagedCode, ControlEvidence" />
|
||||
/// </PermissionSet>
|
||||
// Token: 0x17000722 RID: 1826
|
||||
// (get) Token: 0x060015C6 RID: 5574 RVA: 0x00045850 File Offset: 0x00043A50
|
||||
public WebHeaderCollection ResponseHeaders
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.responseHeaders;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Gets and sets the <see cref="T:System.Text.Encoding" /> used to upload and download strings.</summary>
|
||||
/// <returns>A <see cref="T:System.Text.Encoding" /> that is used to encode strings. The default value of this property is the encoding returned by <see cref="P:System.Text.Encoding.Default" />.</returns>
|
||||
// Token: 0x17000723 RID: 1827
|
||||
// (get) Token: 0x060015C7 RID: 5575 RVA: 0x00045858 File Offset: 0x00043A58
|
||||
// (set) Token: 0x060015C8 RID: 5576 RVA: 0x00045860 File Offset: 0x00043A60
|
||||
public Encoding Encoding
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.encoding;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (value == null)
|
||||
{
|
||||
throw new ArgumentNullException("Encoding");
|
||||
}
|
||||
this.encoding = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Gets or sets the proxy used by this <see cref="T:System.Net.WebClient" /> object.</summary>
|
||||
/// <returns>An <see cref="T:System.Net.IWebProxy" /> instance used to send requests.</returns>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <see cref="P:System.Net.WebClient.Proxy" /> is set to null. </exception>
|
||||
// Token: 0x17000724 RID: 1828
|
||||
// (get) Token: 0x060015C9 RID: 5577 RVA: 0x0004587C File Offset: 0x00043A7C
|
||||
// (set) Token: 0x060015CA RID: 5578 RVA: 0x00045884 File Offset: 0x00043A84
|
||||
public IWebProxy Proxy
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.proxy;
|
||||
}
|
||||
set
|
||||
{
|
||||
this.proxy = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Gets whether a Web request is in progress.</summary>
|
||||
/// <returns>true if the Web request is still in progress; otherwise false.</returns>
|
||||
// Token: 0x17000725 RID: 1829
|
||||
// (get) Token: 0x060015CB RID: 5579 RVA: 0x00045890 File Offset: 0x00043A90
|
||||
public bool IsBusy
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.is_busy;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x060015CC RID: 5580 RVA: 0x00045898 File Offset: 0x00043A98
|
||||
private void CheckBusy()
|
||||
{
|
||||
if (this.IsBusy)
|
||||
{
|
||||
throw new NotSupportedException("WebClient does not support conccurent I/O operations.");
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x060015CD RID: 5581 RVA: 0x000458B0 File Offset: 0x00043AB0
|
||||
private void SetBusy()
|
||||
{
|
||||
lock (this)
|
||||
{
|
||||
this.CheckBusy();
|
||||
this.is_busy = true;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Downloads the resource with the specified URI as a <see cref="T:System.Byte" /> array.</summary>
|
||||
/// <returns>A <see cref="T:System.Byte" /> array containing the downloaded resource.</returns>
|
||||
/// <param name="address">The URI from which to download data. </param>
|
||||
/// <exception cref="T:System.Net.WebException">The URI formed by combining <see cref="P:System.Net.WebClient.BaseAddress" /> and <paramref name="address" /> is invalid.-or- An error occurred while downloading data. </exception>
|
||||
/// <exception cref="T:System.NotSupportedException">The method has been called simultaneously on multiple threads.</exception>
|
||||
/// <PermissionSet>
|
||||
/// <IPermission class="System.Security.Permissions.EnvironmentPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
|
||||
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
|
||||
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="UnmanagedCode, ControlEvidence" />
|
||||
/// </PermissionSet>
|
||||
// Token: 0x060015CE RID: 5582 RVA: 0x000458FC File Offset: 0x00043AFC
|
||||
public byte[] DownloadData(string address)
|
||||
{
|
||||
if (address == null)
|
||||
{
|
||||
throw new ArgumentNullException("address");
|
||||
}
|
||||
return this.DownloadData(this.CreateUri(address));
|
||||
}
|
||||
|
||||
/// <summary>Downloads the resource with the specified URI as a <see cref="T:System.Byte" /> array.</summary>
|
||||
/// <returns>A <see cref="T:System.Byte" /> array containing the downloaded resource.</returns>
|
||||
/// <param name="address">The URI represented by the <see cref="T:System.Uri" /> object, from which to download data.</param>
|
||||
// Token: 0x060015CF RID: 5583 RVA: 0x0004591C File Offset: 0x00043B1C
|
||||
public byte[] DownloadData(global::System.Uri address)
|
||||
{
|
||||
if (address == null)
|
||||
{
|
||||
throw new ArgumentNullException("address");
|
||||
}
|
||||
byte[] array;
|
||||
try
|
||||
{
|
||||
this.SetBusy();
|
||||
this.async = false;
|
||||
array = this.DownloadDataCore(address, null);
|
||||
}
|
||||
finally
|
||||
{
|
||||
this.is_busy = false;
|
||||
}
|
||||
return array;
|
||||
}
|
||||
|
||||
// Token: 0x060015D0 RID: 5584 RVA: 0x00045988 File Offset: 0x00043B88
|
||||
private byte[] DownloadDataCore(global::System.Uri address, object userToken)
|
||||
{
|
||||
WebRequest webRequest = null;
|
||||
byte[] array;
|
||||
try
|
||||
{
|
||||
webRequest = this.SetupRequest(address);
|
||||
WebResponse webResponse = this.GetWebResponse(webRequest);
|
||||
Stream responseStream = webResponse.GetResponseStream();
|
||||
array = this.ReadAll(responseStream, (int)webResponse.ContentLength, userToken);
|
||||
}
|
||||
catch (ThreadInterruptedException)
|
||||
{
|
||||
if (webRequest != null)
|
||||
{
|
||||
webRequest.Abort();
|
||||
}
|
||||
throw;
|
||||
}
|
||||
catch (WebException ex)
|
||||
{
|
||||
throw;
|
||||
}
|
||||
catch (Exception ex2)
|
||||
{
|
||||
throw new WebException("An error occurred performing a WebClient request.", ex2);
|
||||
}
|
||||
return array;
|
||||
}
|
||||
|
||||
/// <summary>Downloads the resource with the specified URI to a local file.</summary>
|
||||
/// <param name="address">The URI from which to download data. </param>
|
||||
/// <param name="fileName">The name of the local file that is to receive the data. </param>
|
||||
/// <exception cref="T:System.Net.WebException">The URI formed by combining <see cref="P:System.Net.WebClient.BaseAddress" /> and <paramref name="address" /> is invalid.-or- <paramref name="filename" /> is null or <see cref="F:System.String.Empty" />.-or-The file does not exist.-or- An error occurred while downloading data. </exception>
|
||||
/// <exception cref="T:System.NotSupportedException">The method has been called simultaneously on multiple threads.</exception>
|
||||
/// <PermissionSet>
|
||||
/// <IPermission class="System.Security.Permissions.EnvironmentPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
|
||||
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
|
||||
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="UnmanagedCode, ControlEvidence" />
|
||||
/// </PermissionSet>
|
||||
// Token: 0x060015D1 RID: 5585 RVA: 0x00045A48 File Offset: 0x00043C48
|
||||
public void DownloadFile(string address, string fileName)
|
||||
{
|
||||
if (address == null)
|
||||
{
|
||||
throw new ArgumentNullException("address");
|
||||
}
|
||||
this.DownloadFile(this.CreateUri(address), fileName);
|
||||
}
|
||||
|
||||
/// <summary>Downloads the resource with the specified URI to a local file.</summary>
|
||||
/// <param name="address">The URI specified as a <see cref="T:System.String" />, from which to download data. </param>
|
||||
/// <param name="fileName">The name of the local file that is to receive the data. </param>
|
||||
/// <exception cref="T:System.Net.WebException">The URI formed by combining <see cref="P:System.Net.WebClient.BaseAddress" /> and <paramref name="address" /> is invalid.-or- <paramref name="filename" /> is null or <see cref="F:System.String.Empty" />.-or- The file does not exist. -or- An error occurred while downloading data. </exception>
|
||||
/// <exception cref="T:System.NotSupportedException">The method has been called simultaneously on multiple threads.</exception>
|
||||
// Token: 0x060015D2 RID: 5586 RVA: 0x00045A6C File Offset: 0x00043C6C
|
||||
public void DownloadFile(global::System.Uri address, string fileName)
|
||||
{
|
||||
if (address == null)
|
||||
{
|
||||
throw new ArgumentNullException("address");
|
||||
}
|
||||
if (fileName == null)
|
||||
{
|
||||
throw new ArgumentNullException("fileName");
|
||||
}
|
||||
try
|
||||
{
|
||||
this.SetBusy();
|
||||
this.async = false;
|
||||
this.DownloadFileCore(address, fileName, null);
|
||||
}
|
||||
catch (WebException ex)
|
||||
{
|
||||
throw;
|
||||
}
|
||||
catch (Exception ex2)
|
||||
{
|
||||
throw new WebException("An error occurred performing a WebClient request.", ex2);
|
||||
}
|
||||
finally
|
||||
{
|
||||
this.is_busy = false;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x060015D3 RID: 5587 RVA: 0x00045B2C File Offset: 0x00043D2C
|
||||
private void DownloadFileCore(global::System.Uri address, string fileName, object userToken)
|
||||
{
|
||||
WebRequest webRequest = null;
|
||||
using (FileStream fileStream = new FileStream(fileName, FileMode.Create))
|
||||
{
|
||||
try
|
||||
{
|
||||
webRequest = this.SetupRequest(address);
|
||||
WebResponse webResponse = this.GetWebResponse(webRequest);
|
||||
Stream responseStream = webResponse.GetResponseStream();
|
||||
int num = (int)webResponse.ContentLength;
|
||||
int num2 = ((num > -1 && num <= 32768) ? num : 32768);
|
||||
byte[] array = new byte[num2];
|
||||
long num3 = 0L;
|
||||
int num4;
|
||||
while ((num4 = responseStream.Read(array, 0, num2)) != 0)
|
||||
{
|
||||
if (this.async)
|
||||
{
|
||||
num3 += (long)num4;
|
||||
this.OnDownloadProgressChanged(new DownloadProgressChangedEventArgs(num3, webResponse.ContentLength, userToken));
|
||||
}
|
||||
fileStream.Write(array, 0, num4);
|
||||
}
|
||||
}
|
||||
catch (ThreadInterruptedException)
|
||||
{
|
||||
if (webRequest != null)
|
||||
{
|
||||
webRequest.Abort();
|
||||
}
|
||||
throw;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Opens a readable stream for the data downloaded from a resource with the URI specified as a <see cref="T:System.String" />.</summary>
|
||||
/// <returns>A <see cref="T:System.IO.Stream" /> used to read data from a resource.</returns>
|
||||
/// <param name="address">The URI specified as a <see cref="T:System.String" /> from which to download data. </param>
|
||||
/// <exception cref="T:System.Net.WebException">The URI formed by combining <see cref="P:System.Net.WebClient.BaseAddress" />, <paramref name="address" /> is invalid.-or- An error occurred while downloading data. </exception>
|
||||
/// <PermissionSet>
|
||||
/// <IPermission class="System.Security.Permissions.EnvironmentPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
|
||||
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
|
||||
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="UnmanagedCode, ControlEvidence" />
|
||||
/// </PermissionSet>
|
||||
// Token: 0x060015D4 RID: 5588 RVA: 0x00045C40 File Offset: 0x00043E40
|
||||
public Stream OpenRead(string address)
|
||||
{
|
||||
if (address == null)
|
||||
{
|
||||
throw new ArgumentNullException("address");
|
||||
}
|
||||
return this.OpenRead(this.CreateUri(address));
|
||||
}
|
||||
|
||||
/// <summary>Opens a readable stream for the data downloaded from a resource with the URI specified as a <see cref="T:System.Uri" /></summary>
|
||||
/// <returns>A <see cref="T:System.IO.Stream" /> used to read data from a resource.</returns>
|
||||
/// <param name="address">The URI specified as a <see cref="T:System.Uri" /> from which to download data. </param>
|
||||
/// <exception cref="T:System.Net.WebException">The URI formed by combining <see cref="P:System.Net.WebClient.BaseAddress" />, <paramref name="address" /> is invalid.-or- An error occurred while downloading data. </exception>
|
||||
// Token: 0x060015D5 RID: 5589 RVA: 0x00045C60 File Offset: 0x00043E60
|
||||
public Stream OpenRead(global::System.Uri address)
|
||||
{
|
||||
if (address == null)
|
||||
{
|
||||
throw new ArgumentNullException("address");
|
||||
}
|
||||
Stream responseStream;
|
||||
try
|
||||
{
|
||||
this.SetBusy();
|
||||
this.async = false;
|
||||
WebRequest webRequest = this.SetupRequest(address);
|
||||
WebResponse webResponse = this.GetWebResponse(webRequest);
|
||||
responseStream = webResponse.GetResponseStream();
|
||||
}
|
||||
catch (WebException ex)
|
||||
{
|
||||
throw;
|
||||
}
|
||||
catch (Exception ex2)
|
||||
{
|
||||
throw new WebException("An error occurred performing a WebClient request.", ex2);
|
||||
}
|
||||
finally
|
||||
{
|
||||
this.is_busy = false;
|
||||
}
|
||||
return responseStream;
|
||||
}
|
||||
|
||||
/// <summary>Opens a stream for writing data to the specified resource.</summary>
|
||||
/// <returns>A <see cref="T:System.IO.Stream" /> used to write data to the resource.</returns>
|
||||
/// <param name="address">The URI of the resource to receive the data. </param>
|
||||
/// <exception cref="T:System.Net.WebException">The URI formed by combining <see cref="P:System.Net.WebClient.BaseAddress" />, and <paramref name="address" /> is invalid.-or- An error occurred while opening the stream. </exception>
|
||||
/// <PermissionSet>
|
||||
/// <IPermission class="System.Security.Permissions.EnvironmentPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
|
||||
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
|
||||
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="UnmanagedCode, ControlEvidence" />
|
||||
/// </PermissionSet>
|
||||
// Token: 0x060015D6 RID: 5590 RVA: 0x00045D28 File Offset: 0x00043F28
|
||||
public Stream OpenWrite(string address)
|
||||
{
|
||||
if (address == null)
|
||||
{
|
||||
throw new ArgumentNullException("address");
|
||||
}
|
||||
return this.OpenWrite(this.CreateUri(address));
|
||||
}
|
||||
|
||||
/// <summary>Opens a stream for writing data to the specified resource, using the specified method.</summary>
|
||||
/// <returns>A <see cref="T:System.IO.Stream" /> used to write data to the resource.</returns>
|
||||
/// <param name="address">The URI of the resource to receive the data. </param>
|
||||
/// <param name="method">The method used to send the data to the resource. If null, the default is POST for http and STOR for ftp.</param>
|
||||
/// <exception cref="T:System.Net.WebException">The URI formed by combining <see cref="P:System.Net.WebClient.BaseAddress" />, and <paramref name="address" /> is invalid.-or- An error occurred while opening the stream. </exception>
|
||||
/// <PermissionSet>
|
||||
/// <IPermission class="System.Security.Permissions.EnvironmentPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
|
||||
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
|
||||
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="UnmanagedCode, ControlEvidence" />
|
||||
/// </PermissionSet>
|
||||
// Token: 0x060015D7 RID: 5591 RVA: 0x00045D48 File Offset: 0x00043F48
|
||||
public Stream OpenWrite(string address, string method)
|
||||
{
|
||||
if (address == null)
|
||||
{
|
||||
throw new ArgumentNullException("address");
|
||||
}
|
||||
return this.OpenWrite(this.CreateUri(address), method);
|
||||
}
|
||||
|
||||
/// <summary>Opens a stream for writing data to the specified resource.</summary>
|
||||
/// <returns>A <see cref="T:System.IO.Stream" /> used to write data to the resource.</returns>
|
||||
/// <param name="address">The URI of the resource to receive the data.</param>
|
||||
/// <exception cref="T:System.Net.WebException">The URI formed by combining <see cref="P:System.Net.WebClient.BaseAddress" />, and <paramref name="address" /> is invalid.-or- An error occurred while opening the stream. </exception>
|
||||
// Token: 0x060015D8 RID: 5592 RVA: 0x00045D6C File Offset: 0x00043F6C
|
||||
public Stream OpenWrite(global::System.Uri address)
|
||||
{
|
||||
return this.OpenWrite(address, null);
|
||||
}
|
||||
|
||||
/// <summary>Opens a stream for writing data to the specified resource, by using the specified method.</summary>
|
||||
/// <returns>A <see cref="T:System.IO.Stream" /> used to write data to the resource.</returns>
|
||||
/// <param name="address">The URI of the resource to receive the data.</param>
|
||||
/// <param name="method">The method used to send the data to the resource. If null, the default is POST for http and STOR for ftp.</param>
|
||||
/// <exception cref="T:System.Net.WebException">The URI formed by combining <see cref="P:System.Net.WebClient.BaseAddress" />, and <paramref name="address" /> is invalid.-or- An error occurred while opening the stream. </exception>
|
||||
// Token: 0x060015D9 RID: 5593 RVA: 0x00045D78 File Offset: 0x00043F78
|
||||
public Stream OpenWrite(global::System.Uri address, string method)
|
||||
{
|
||||
if (address == null)
|
||||
{
|
||||
throw new ArgumentNullException("address");
|
||||
}
|
||||
Stream requestStream;
|
||||
try
|
||||
{
|
||||
this.SetBusy();
|
||||
this.async = false;
|
||||
WebRequest webRequest = this.SetupRequest(address, method, true);
|
||||
requestStream = webRequest.GetRequestStream();
|
||||
}
|
||||
catch (WebException ex)
|
||||
{
|
||||
throw;
|
||||
}
|
||||
catch (Exception ex2)
|
||||
{
|
||||
throw new WebException("An error occurred performing a WebClient request.", ex2);
|
||||
}
|
||||
finally
|
||||
{
|
||||
this.is_busy = false;
|
||||
}
|
||||
return requestStream;
|
||||
}
|
||||
|
||||
// Token: 0x060015DA RID: 5594 RVA: 0x00045E34 File Offset: 0x00044034
|
||||
private string DetermineMethod(global::System.Uri address, string method, bool is_upload)
|
||||
{
|
||||
if (method != null)
|
||||
{
|
||||
return method;
|
||||
}
|
||||
if (address.Scheme == global::System.Uri.UriSchemeFtp)
|
||||
{
|
||||
return (!is_upload) ? "RETR" : "STOR";
|
||||
}
|
||||
return (!is_upload) ? "GET" : "POST";
|
||||
}
|
||||
|
||||
/// <summary>Uploads a data buffer to a resource identified by a URI.</summary>
|
||||
/// <returns>A <see cref="T:System.Byte" /> array containing the body of the response from the resource.</returns>
|
||||
/// <param name="address">The URI of the resource to receive the data. </param>
|
||||
/// <param name="data">The data buffer to send to the resource. </param>
|
||||
/// <exception cref="T:System.Net.WebException">The URI formed by combining <see cref="P:System.Net.WebClient.BaseAddress" />, and <paramref name="address" /> is invalid.-or- <paramref name="data" /> is null. -or-An error occurred while sending the data.-or- There was no response from the server hosting the resource. </exception>
|
||||
/// <PermissionSet>
|
||||
/// <IPermission class="System.Security.Permissions.EnvironmentPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
|
||||
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
|
||||
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="UnmanagedCode, ControlEvidence" />
|
||||
/// </PermissionSet>
|
||||
// Token: 0x060015DB RID: 5595 RVA: 0x00045E8C File Offset: 0x0004408C
|
||||
public byte[] UploadData(string address, byte[] data)
|
||||
{
|
||||
if (address == null)
|
||||
{
|
||||
throw new ArgumentNullException("address");
|
||||
}
|
||||
return this.UploadData(this.CreateUri(address), data);
|
||||
}
|
||||
|
||||
/// <summary>Uploads a data buffer to the specified resource, using the specified method.</summary>
|
||||
/// <returns>A <see cref="T:System.Byte" /> array containing the body of the response from the resource.</returns>
|
||||
/// <param name="address">The URI of the resource to receive the data. </param>
|
||||
/// <param name="method">The HTTP method used to send the data to the resource. If null, the default is POST for http and STOR for ftp.</param>
|
||||
/// <param name="data">The data buffer to send to the resource. </param>
|
||||
/// <exception cref="T:System.Net.WebException">The URI formed by combining <see cref="P:System.Net.WebClient.BaseAddress" />, and <paramref name="address" /> is invalid.-or- <paramref name="data" /> is null.-or- An error occurred while uploading the data.-or- There was no response from the server hosting the resource. </exception>
|
||||
/// <PermissionSet>
|
||||
/// <IPermission class="System.Security.Permissions.EnvironmentPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
|
||||
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
|
||||
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="UnmanagedCode, ControlEvidence" />
|
||||
/// </PermissionSet>
|
||||
// Token: 0x060015DC RID: 5596 RVA: 0x00045EB0 File Offset: 0x000440B0
|
||||
public byte[] UploadData(string address, string method, byte[] data)
|
||||
{
|
||||
if (address == null)
|
||||
{
|
||||
throw new ArgumentNullException("address");
|
||||
}
|
||||
return this.UploadData(this.CreateUri(address), method, data);
|
||||
}
|
||||
|
||||
/// <summary>Uploads a data buffer to a resource identified by a URI.</summary>
|
||||
/// <returns>A <see cref="T:System.Byte" /> array containing the body of the response from the resource.</returns>
|
||||
/// <param name="address">The URI of the resource to receive the data. </param>
|
||||
/// <param name="data">The data buffer to send to the resource. </param>
|
||||
/// <exception cref="T:System.Net.WebException">The URI formed by combining <see cref="P:System.Net.WebClient.BaseAddress" />, and <paramref name="address" /> is invalid.-or- <paramref name="data" /> is null. -or-An error occurred while sending the data.-or- There was no response from the server hosting the resource. </exception>
|
||||
// Token: 0x060015DD RID: 5597 RVA: 0x00045EE0 File Offset: 0x000440E0
|
||||
public byte[] UploadData(global::System.Uri address, byte[] data)
|
||||
{
|
||||
return this.UploadData(address, null, data);
|
||||
}
|
||||
|
||||
/// <summary>Uploads a data buffer to the specified resource, using the specified method.</summary>
|
||||
/// <returns>A <see cref="T:System.Byte" /> array containing the body of the response from the resource.</returns>
|
||||
/// <param name="address">The URI of the resource to receive the data. </param>
|
||||
/// <param name="method">The HTTP method used to send the data to the resource. If null, the default is POST for http and STOR for ftp.</param>
|
||||
/// <param name="data">The data buffer to send to the resource.</param>
|
||||
/// <exception cref="T:System.Net.WebException">The URI formed by combining <see cref="P:System.Net.WebClient.BaseAddress" />, and <paramref name="address" /> is invalid.-or- <paramref name="data" /> is null.-or- An error occurred while uploading the data.-or- There was no response from the server hosting the resource. </exception>
|
||||
// Token: 0x060015DE RID: 5598 RVA: 0x00045EEC File Offset: 0x000440EC
|
||||
public byte[] UploadData(global::System.Uri address, string method, byte[] data)
|
||||
{
|
||||
if (address == null)
|
||||
{
|
||||
throw new ArgumentNullException("address");
|
||||
}
|
||||
if (data == null)
|
||||
{
|
||||
throw new ArgumentNullException("data");
|
||||
}
|
||||
byte[] array;
|
||||
try
|
||||
{
|
||||
this.SetBusy();
|
||||
this.async = false;
|
||||
array = this.UploadDataCore(address, method, data, null);
|
||||
}
|
||||
catch (WebException)
|
||||
{
|
||||
throw;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw new WebException("An error occurred performing a WebClient request.", ex);
|
||||
}
|
||||
finally
|
||||
{
|
||||
this.is_busy = false;
|
||||
}
|
||||
return array;
|
||||
}
|
||||
|
||||
// Token: 0x060015DF RID: 5599 RVA: 0x00045FB4 File Offset: 0x000441B4
|
||||
private byte[] UploadDataCore(global::System.Uri address, string method, byte[] data, object userToken)
|
||||
{
|
||||
WebRequest webRequest = this.SetupRequest(address, method, true);
|
||||
byte[] array;
|
||||
try
|
||||
{
|
||||
int num = data.Length;
|
||||
webRequest.ContentLength = (long)num;
|
||||
using (Stream requestStream = webRequest.GetRequestStream())
|
||||
{
|
||||
requestStream.Write(data, 0, num);
|
||||
}
|
||||
WebResponse webResponse = this.GetWebResponse(webRequest);
|
||||
Stream responseStream = webResponse.GetResponseStream();
|
||||
array = this.ReadAll(responseStream, (int)webResponse.ContentLength, userToken);
|
||||
}
|
||||
catch (ThreadInterruptedException)
|
||||
{
|
||||
if (webRequest != null)
|
||||
{
|
||||
webRequest.Abort();
|
||||
}
|
||||
throw;
|
||||
}
|
||||
return array;
|
||||
}
|
||||
|
||||
/// <summary>Uploads the specified local file to a resource with the specified URI.</summary>
|
||||
/// <returns>A <see cref="T:System.Byte" /> array containing the body of the response from the resource.</returns>
|
||||
/// <param name="address">The URI of the resource to receive the file. For example, ftp://localhost/samplefile.txt.</param>
|
||||
/// <param name="fileName">The file to send to the resource. For example, "samplefile.txt".</param>
|
||||
/// <exception cref="T:System.Net.WebException">The URI formed by combining <see cref="P:System.Net.WebClient.BaseAddress" />, and <paramref name="address" /> is invalid.-or- <paramref name="fileName" /> is null, is <see cref="F:System.String.Empty" />, contains invalid characters, or does not exist.-or- An error occurred while uploading the file.-or- There was no response from the server hosting the resource.-or- The Content-type header begins with multipart. </exception>
|
||||
/// <PermissionSet>
|
||||
/// <IPermission class="System.Security.Permissions.EnvironmentPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
|
||||
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
|
||||
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="UnmanagedCode, ControlEvidence" />
|
||||
/// </PermissionSet>
|
||||
// Token: 0x060015E0 RID: 5600 RVA: 0x00046070 File Offset: 0x00044270
|
||||
public byte[] UploadFile(string address, string fileName)
|
||||
{
|
||||
if (address == null)
|
||||
{
|
||||
throw new ArgumentNullException("address");
|
||||
}
|
||||
return this.UploadFile(this.CreateUri(address), fileName);
|
||||
}
|
||||
|
||||
/// <summary>Uploads the specified local file to a resource with the specified URI.</summary>
|
||||
/// <returns>A <see cref="T:System.Byte" /> array containing the body of the response from the resource.</returns>
|
||||
/// <param name="address">The URI of the resource to receive the file. For example, ftp://localhost/samplefile.txt.</param>
|
||||
/// <param name="fileName">The file to send to the resource. For example, "samplefile.txt".</param>
|
||||
/// <exception cref="T:System.Net.WebException">The URI formed by combining <see cref="P:System.Net.WebClient.BaseAddress" />, and <paramref name="address" /> is invalid.-or- <paramref name="fileName" /> is null, is <see cref="F:System.String.Empty" />, contains invalid characters, or does not exist.-or- An error occurred while uploading the file.-or- There was no response from the server hosting the resource.-or- The Content-type header begins with multipart. </exception>
|
||||
// Token: 0x060015E1 RID: 5601 RVA: 0x00046094 File Offset: 0x00044294
|
||||
public byte[] UploadFile(global::System.Uri address, string fileName)
|
||||
{
|
||||
return this.UploadFile(address, null, fileName);
|
||||
}
|
||||
|
||||
/// <summary>Uploads the specified local file to the specified resource, using the specified method.</summary>
|
||||
/// <returns>A <see cref="T:System.Byte" /> array containing the body of the response from the resource.</returns>
|
||||
/// <param name="address">The URI of the resource to receive the file.</param>
|
||||
/// <param name="method">The HTTP method used to send the file to the resource. If null, the default is POST for http and STOR for ftp.</param>
|
||||
/// <param name="fileName">The file to send to the resource. </param>
|
||||
/// <exception cref="T:System.Net.WebException">The URI formed by combining <see cref="P:System.Net.WebClient.BaseAddress" />, and <paramref name="address" /> is invalid.-or- <paramref name="fileName" /> is null, is <see cref="F:System.String.Empty" />, contains invalid characters, or does not exist.-or- An error occurred while uploading the file.-or- There was no response from the server hosting the resource.-or- The Content-type header begins with multipart. </exception>
|
||||
/// <PermissionSet>
|
||||
/// <IPermission class="System.Security.Permissions.EnvironmentPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
|
||||
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
|
||||
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="UnmanagedCode, ControlEvidence" />
|
||||
/// </PermissionSet>
|
||||
// Token: 0x060015E2 RID: 5602 RVA: 0x000460A0 File Offset: 0x000442A0
|
||||
public byte[] UploadFile(string address, string method, string fileName)
|
||||
{
|
||||
return this.UploadFile(this.CreateUri(address), method, fileName);
|
||||
}
|
||||
|
||||
/// <summary>Uploads the specified local file to the specified resource, using the specified method.</summary>
|
||||
/// <returns>A <see cref="T:System.Byte" /> array containing the body of the response from the resource.</returns>
|
||||
/// <param name="address">The URI of the resource to receive the file.</param>
|
||||
/// <param name="method">The HTTP method used to send the file to the resource. If null, the default is POST for http and STOR for ftp.</param>
|
||||
/// <param name="fileName">The file to send to the resource. </param>
|
||||
/// <exception cref="T:System.Net.WebException">The URI formed by combining <see cref="P:System.Net.WebClient.BaseAddress" />, and <paramref name="address" /> is invalid.-or- <paramref name="fileName" /> is null, is <see cref="F:System.String.Empty" />, contains invalid characters, or does not exist.-or- An error occurred while uploading the file.-or- There was no response from the server hosting the resource.-or- The Content-type header begins with multipart. </exception>
|
||||
// Token: 0x060015E3 RID: 5603 RVA: 0x000460B4 File Offset: 0x000442B4
|
||||
public byte[] UploadFile(global::System.Uri address, string method, string fileName)
|
||||
{
|
||||
if (address == null)
|
||||
{
|
||||
throw new ArgumentNullException("address");
|
||||
}
|
||||
if (fileName == null)
|
||||
{
|
||||
throw new ArgumentNullException("fileName");
|
||||
}
|
||||
byte[] array;
|
||||
try
|
||||
{
|
||||
this.SetBusy();
|
||||
this.async = false;
|
||||
array = this.UploadFileCore(address, method, fileName, null);
|
||||
}
|
||||
catch (WebException ex)
|
||||
{
|
||||
throw;
|
||||
}
|
||||
catch (Exception ex2)
|
||||
{
|
||||
throw new WebException("An error occurred performing a WebClient request.", ex2);
|
||||
}
|
||||
finally
|
||||
{
|
||||
this.is_busy = false;
|
||||
}
|
||||
return array;
|
||||
}
|
||||
|
||||
// Token: 0x060015E4 RID: 5604 RVA: 0x0004617C File Offset: 0x0004437C
|
||||
private byte[] UploadFileCore(global::System.Uri address, string method, string fileName, object userToken)
|
||||
{
|
||||
string text = this.Headers["Content-Type"];
|
||||
if (text != null)
|
||||
{
|
||||
string text2 = text.ToLower();
|
||||
if (text2.StartsWith("multipart/"))
|
||||
{
|
||||
throw new WebException("Content-Type cannot be set to a multipart type for this request.");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
text = "application/octet-stream";
|
||||
}
|
||||
string text3 = "------------" + DateTime.Now.Ticks.ToString("x");
|
||||
this.Headers["Content-Type"] = string.Format("multipart/form-data; boundary={0}", text3);
|
||||
Stream stream = null;
|
||||
Stream stream2 = null;
|
||||
byte[] array = null;
|
||||
fileName = Path.GetFullPath(fileName);
|
||||
WebRequest webRequest = null;
|
||||
try
|
||||
{
|
||||
stream2 = File.OpenRead(fileName);
|
||||
webRequest = this.SetupRequest(address, method, true);
|
||||
stream = webRequest.GetRequestStream();
|
||||
byte[] bytes = Encoding.ASCII.GetBytes("--" + text3 + "\r\n");
|
||||
stream.Write(bytes, 0, bytes.Length);
|
||||
string text4 = string.Format("Content-Disposition: form-data; name=\"file\"; filename=\"{0}\"\r\nContent-Type: {1}\r\n\r\n", Path.GetFileName(fileName), text);
|
||||
byte[] bytes2 = Encoding.UTF8.GetBytes(text4);
|
||||
stream.Write(bytes2, 0, bytes2.Length);
|
||||
byte[] array2 = new byte[4096];
|
||||
int num;
|
||||
while ((num = stream2.Read(array2, 0, 4096)) != 0)
|
||||
{
|
||||
stream.Write(array2, 0, num);
|
||||
}
|
||||
stream.WriteByte(13);
|
||||
stream.WriteByte(10);
|
||||
stream.Write(bytes, 0, bytes.Length);
|
||||
stream.Close();
|
||||
stream = null;
|
||||
WebResponse webResponse = this.GetWebResponse(webRequest);
|
||||
Stream responseStream = webResponse.GetResponseStream();
|
||||
array = this.ReadAll(responseStream, (int)webResponse.ContentLength, userToken);
|
||||
}
|
||||
catch (ThreadInterruptedException)
|
||||
{
|
||||
if (webRequest != null)
|
||||
{
|
||||
webRequest.Abort();
|
||||
}
|
||||
throw;
|
||||
}
|
||||
finally
|
||||
{
|
||||
if (stream2 != null)
|
||||
{
|
||||
stream2.Close();
|
||||
}
|
||||
if (stream != null)
|
||||
{
|
||||
stream.Close();
|
||||
}
|
||||
}
|
||||
return array;
|
||||
}
|
||||
|
||||
/// <summary>Uploads the specified name/value collection to the resource identified by the specified URI.</summary>
|
||||
/// <returns>A <see cref="T:System.Byte" /> array containing the body of the response from the resource.</returns>
|
||||
/// <param name="address">The URI of the resource to receive the collection. </param>
|
||||
/// <param name="data">The <see cref="T:System.Collections.Specialized.NameValueCollection" /> to send to the resource. </param>
|
||||
/// <exception cref="T:System.Net.WebException">The URI formed by combining <see cref="P:System.Net.WebClient.BaseAddress" />, and <paramref name="address" /> is invalid.-or- <paramref name="data" /> is null.-or- There was no response from the server hosting the resource.-or- An error occurred while opening the stream.-or- The Content-type header is not null or "application/x-www-form-urlencoded". </exception>
|
||||
/// <PermissionSet>
|
||||
/// <IPermission class="System.Security.Permissions.EnvironmentPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
|
||||
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
|
||||
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="UnmanagedCode, ControlEvidence" />
|
||||
/// </PermissionSet>
|
||||
// Token: 0x060015E5 RID: 5605 RVA: 0x00046380 File Offset: 0x00044580
|
||||
public byte[] UploadValues(string address, global::System.Collections.Specialized.NameValueCollection data)
|
||||
{
|
||||
if (address == null)
|
||||
{
|
||||
throw new ArgumentNullException("address");
|
||||
}
|
||||
return this.UploadValues(this.CreateUri(address), data);
|
||||
}
|
||||
|
||||
/// <summary>Uploads the specified name/value collection to the resource identified by the specified URI, using the specified method.</summary>
|
||||
/// <returns>A <see cref="T:System.Byte" /> array containing the body of the response from the resource.</returns>
|
||||
/// <param name="address">The URI of the resource to receive the collection. </param>
|
||||
/// <param name="method">The HTTP method used to send the file to the resource. If null, the default is POST for http and STOR for ftp.</param>
|
||||
/// <param name="data">The <see cref="T:System.Collections.Specialized.NameValueCollection" /> to send to the resource. </param>
|
||||
/// <exception cref="T:System.Net.WebException">The URI formed by combining <see cref="P:System.Net.WebClient.BaseAddress" />, and <paramref name="address" /> is invalid.-or- <paramref name="data" /> is null.-or- An error occurred while opening the stream.-or- There was no response from the server hosting the resource.-or- The Content-type header value is not null and is not application/x-www-form-urlencoded. </exception>
|
||||
/// <PermissionSet>
|
||||
/// <IPermission class="System.Security.Permissions.EnvironmentPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
|
||||
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
|
||||
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="UnmanagedCode, ControlEvidence" />
|
||||
/// </PermissionSet>
|
||||
// Token: 0x060015E6 RID: 5606 RVA: 0x000463A4 File Offset: 0x000445A4
|
||||
public byte[] UploadValues(string address, string method, global::System.Collections.Specialized.NameValueCollection data)
|
||||
{
|
||||
if (address == null)
|
||||
{
|
||||
throw new ArgumentNullException("address");
|
||||
}
|
||||
return this.UploadValues(this.CreateUri(address), method, data);
|
||||
}
|
||||
|
||||
/// <summary>Uploads the specified name/value collection to the resource identified by the specified URI.</summary>
|
||||
/// <returns>A <see cref="T:System.Byte" /> array containing the body of the response from the resource.</returns>
|
||||
/// <param name="address">The URI of the resource to receive the collection. </param>
|
||||
/// <param name="data">The <see cref="T:System.Collections.Specialized.NameValueCollection" /> to send to the resource. </param>
|
||||
/// <exception cref="T:System.Net.WebException">The URI formed by combining <see cref="P:System.Net.WebClient.BaseAddress" />, and <paramref name="address" /> is invalid.-or- <paramref name="data" /> is null.-or- There was no response from the server hosting the resource.-or- An error occurred while opening the stream.-or- The Content-type header is not null or "application/x-www-form-urlencoded". </exception>
|
||||
// Token: 0x060015E7 RID: 5607 RVA: 0x000463D4 File Offset: 0x000445D4
|
||||
public byte[] UploadValues(global::System.Uri address, global::System.Collections.Specialized.NameValueCollection data)
|
||||
{
|
||||
return this.UploadValues(address, null, data);
|
||||
}
|
||||
|
||||
/// <summary>Uploads the specified name/value collection to the resource identified by the specified URI, using the specified method.</summary>
|
||||
/// <returns>A <see cref="T:System.Byte" /> array containing the body of the response from the resource.</returns>
|
||||
/// <param name="address">The URI of the resource to receive the collection. </param>
|
||||
/// <param name="method">The HTTP method used to send the file to the resource. If null, the default is POST for http and STOR for ftp.</param>
|
||||
/// <param name="data">The <see cref="T:System.Collections.Specialized.NameValueCollection" /> to send to the resource. </param>
|
||||
/// <exception cref="T:System.Net.WebException">The URI formed by combining <see cref="P:System.Net.WebClient.BaseAddress" />, and <paramref name="address" /> is invalid.-or- <paramref name="data" /> is null.-or- An error occurred while opening the stream.-or- There was no response from the server hosting the resource.-or- The Content-type header value is not null and is not application/x-www-form-urlencoded. </exception>
|
||||
// Token: 0x060015E8 RID: 5608 RVA: 0x000463E0 File Offset: 0x000445E0
|
||||
public byte[] UploadValues(global::System.Uri address, string method, global::System.Collections.Specialized.NameValueCollection data)
|
||||
{
|
||||
if (address == null)
|
||||
{
|
||||
throw new ArgumentNullException("address");
|
||||
}
|
||||
if (data == null)
|
||||
{
|
||||
throw new ArgumentNullException("data");
|
||||
}
|
||||
byte[] array;
|
||||
try
|
||||
{
|
||||
this.SetBusy();
|
||||
this.async = false;
|
||||
array = this.UploadValuesCore(address, method, data, null);
|
||||
}
|
||||
catch (WebException ex)
|
||||
{
|
||||
throw;
|
||||
}
|
||||
catch (Exception ex2)
|
||||
{
|
||||
throw new WebException("An error occurred performing a WebClient request.", ex2);
|
||||
}
|
||||
finally
|
||||
{
|
||||
this.is_busy = false;
|
||||
}
|
||||
return array;
|
||||
}
|
||||
|
||||
// Token: 0x060015E9 RID: 5609 RVA: 0x000464A8 File Offset: 0x000446A8
|
||||
private byte[] UploadValuesCore(global::System.Uri uri, string method, global::System.Collections.Specialized.NameValueCollection data, object userToken)
|
||||
{
|
||||
string text = this.Headers["Content-Type"];
|
||||
if (text != null && string.Compare(text, WebClient.urlEncodedCType, true) != 0)
|
||||
{
|
||||
throw new WebException("Content-Type header cannot be changed from its default value for this request.");
|
||||
}
|
||||
this.Headers["Content-Type"] = WebClient.urlEncodedCType;
|
||||
WebRequest webRequest = this.SetupRequest(uri, method, true);
|
||||
byte[] array2;
|
||||
try
|
||||
{
|
||||
MemoryStream memoryStream = new MemoryStream();
|
||||
foreach (object obj in data)
|
||||
{
|
||||
string text2 = (string)obj;
|
||||
byte[] array = Encoding.UTF8.GetBytes(text2);
|
||||
WebClient.UrlEncodeAndWrite(memoryStream, array);
|
||||
memoryStream.WriteByte(61);
|
||||
array = Encoding.UTF8.GetBytes(data[text2]);
|
||||
WebClient.UrlEncodeAndWrite(memoryStream, array);
|
||||
memoryStream.WriteByte(38);
|
||||
}
|
||||
int num = (int)memoryStream.Length;
|
||||
if (num > 0)
|
||||
{
|
||||
memoryStream.SetLength((long)(--num));
|
||||
}
|
||||
byte[] buffer = memoryStream.GetBuffer();
|
||||
webRequest.ContentLength = (long)num;
|
||||
using (Stream requestStream = webRequest.GetRequestStream())
|
||||
{
|
||||
requestStream.Write(buffer, 0, num);
|
||||
}
|
||||
memoryStream.Close();
|
||||
WebResponse webResponse = this.GetWebResponse(webRequest);
|
||||
Stream responseStream = webResponse.GetResponseStream();
|
||||
array2 = this.ReadAll(responseStream, (int)webResponse.ContentLength, userToken);
|
||||
}
|
||||
catch (ThreadInterruptedException)
|
||||
{
|
||||
webRequest.Abort();
|
||||
throw;
|
||||
}
|
||||
return array2;
|
||||
}
|
||||
|
||||
/// <summary>Downloads the requested resource as a <see cref="T:System.String" />. The resource to download is specified as a <see cref="T:System.String" /> containing the URI.</summary>
|
||||
/// <returns>A <see cref="T:System.String" /> containing the requested resource.</returns>
|
||||
/// <param name="address">A <see cref="T:System.String" /> containing the URI to download.</param>
|
||||
/// <exception cref="T:System.Net.WebException">The URI formed by combining <see cref="P:System.Net.WebClient.BaseAddress" /> and <paramref name="address" /> is invalid.-or- An error occurred while downloading the resource. </exception>
|
||||
/// <exception cref="T:System.NotSupportedException">The method has been called simultaneously on multiple threads.</exception>
|
||||
/// <PermissionSet>
|
||||
/// <IPermission class="System.Security.Permissions.EnvironmentPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
|
||||
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
|
||||
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="UnmanagedCode, ControlEvidence" />
|
||||
/// </PermissionSet>
|
||||
// Token: 0x060015EA RID: 5610 RVA: 0x00046678 File Offset: 0x00044878
|
||||
public string DownloadString(string address)
|
||||
{
|
||||
if (address == null)
|
||||
{
|
||||
throw new ArgumentNullException("address");
|
||||
}
|
||||
return this.encoding.GetString(this.DownloadData(this.CreateUri(address)));
|
||||
}
|
||||
|
||||
/// <summary>Downloads the requested resource as a <see cref="T:System.String" />. The resource to download is specified as a <see cref="T:System.Uri" />.</summary>
|
||||
/// <returns>A <see cref="T:System.String" /> containing the requested resource.</returns>
|
||||
/// <param name="address">A <see cref="T:System.Uri" /> object containing the URI to download.</param>
|
||||
/// <exception cref="T:System.Net.WebException">The URI formed by combining <see cref="P:System.Net.WebClient.BaseAddress" /> and <paramref name="address" /> is invalid.-or- An error occurred while downloading the resource. </exception>
|
||||
/// <exception cref="T:System.NotSupportedException">The method has been called simultaneously on multiple threads.</exception>
|
||||
// Token: 0x060015EB RID: 5611 RVA: 0x000466A4 File Offset: 0x000448A4
|
||||
public string DownloadString(global::System.Uri address)
|
||||
{
|
||||
if (address == null)
|
||||
{
|
||||
throw new ArgumentNullException("address");
|
||||
}
|
||||
return this.encoding.GetString(this.DownloadData(this.CreateUri(address)));
|
||||
}
|
||||
|
||||
/// <summary>Uploads the specified string to the specified resource, using the POST method.</summary>
|
||||
/// <returns>A <see cref="T:System.String" /> containing the response sent by the server.</returns>
|
||||
/// <param name="address">The URI of the resource to receive the string. For Http resources, this URI must identify a resource that can accept a request sent with the POST method, such as a script or ASP page. </param>
|
||||
/// <param name="data">The string to be uploaded.</param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="data" /> is null.</exception>
|
||||
/// <exception cref="T:System.Net.WebException">The URI formed by combining <see cref="P:System.Net.WebClient.BaseAddress" /> and <paramref name="address" /> is invalid.-or- There was no response from the server hosting the resource.</exception>
|
||||
/// <PermissionSet>
|
||||
/// <IPermission class="System.Security.Permissions.EnvironmentPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
|
||||
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
|
||||
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="UnmanagedCode, ControlEvidence" />
|
||||
/// </PermissionSet>
|
||||
// Token: 0x060015EC RID: 5612 RVA: 0x000466D8 File Offset: 0x000448D8
|
||||
public string UploadString(string address, string data)
|
||||
{
|
||||
if (address == null)
|
||||
{
|
||||
throw new ArgumentNullException("address");
|
||||
}
|
||||
if (data == null)
|
||||
{
|
||||
throw new ArgumentNullException("data");
|
||||
}
|
||||
byte[] array = this.UploadData(address, this.encoding.GetBytes(data));
|
||||
return this.encoding.GetString(array);
|
||||
}
|
||||
|
||||
/// <summary>Uploads the specified string to the specified resource, using the specified method.</summary>
|
||||
/// <returns>A <see cref="T:System.String" /> containing the response sent by the server.</returns>
|
||||
/// <param name="address">The URI of the resource to receive the file. This URI must identify a resource that can accept a request sent with the <paramref name="method" /> method. </param>
|
||||
/// <param name="method">The HTTP method used to send the string to the resource. If null, the default is POST for http and STOR for ftp.</param>
|
||||
/// <param name="data">The string to be uploaded.</param>
|
||||
/// <exception cref="T:System.Net.WebException">The URI formed by combining <see cref="P:System.Net.WebClient.BaseAddress" /> and <paramref name="address" /> is invalid.-or- There was no response from the server hosting the resource.-or-<paramref name="method" /> cannot be used to send content.</exception>
|
||||
/// <PermissionSet>
|
||||
/// <IPermission class="System.Security.Permissions.EnvironmentPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
|
||||
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
|
||||
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="UnmanagedCode, ControlEvidence" />
|
||||
/// </PermissionSet>
|
||||
// Token: 0x060015ED RID: 5613 RVA: 0x00046728 File Offset: 0x00044928
|
||||
public string UploadString(string address, string method, string data)
|
||||
{
|
||||
if (address == null)
|
||||
{
|
||||
throw new ArgumentNullException("address");
|
||||
}
|
||||
if (data == null)
|
||||
{
|
||||
throw new ArgumentNullException("data");
|
||||
}
|
||||
byte[] array = this.UploadData(address, method, this.encoding.GetBytes(data));
|
||||
return this.encoding.GetString(array);
|
||||
}
|
||||
|
||||
/// <summary>Uploads the specified string to the specified resource, using the POST method.</summary>
|
||||
/// <returns>A <see cref="T:System.String" /> containing the response sent by the server.</returns>
|
||||
/// <param name="address">The URI of the resource to receive the string. For Http resources, this URI must identify a resource that can accept a request sent with the POST method, such as a script or ASP page. </param>
|
||||
/// <param name="data">The string to be uploaded.</param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="data" /> is null.</exception>
|
||||
/// <exception cref="T:System.Net.WebException">The URI formed by combining <see cref="P:System.Net.WebClient.BaseAddress" /> and <paramref name="address" /> is invalid.-or- There was no response from the server hosting the resource.</exception>
|
||||
// Token: 0x060015EE RID: 5614 RVA: 0x00046778 File Offset: 0x00044978
|
||||
public string UploadString(global::System.Uri address, string data)
|
||||
{
|
||||
if (address == null)
|
||||
{
|
||||
throw new ArgumentNullException("address");
|
||||
}
|
||||
if (data == null)
|
||||
{
|
||||
throw new ArgumentNullException("data");
|
||||
}
|
||||
byte[] array = this.UploadData(address, this.encoding.GetBytes(data));
|
||||
return this.encoding.GetString(array);
|
||||
}
|
||||
|
||||
/// <summary>Uploads the specified string to the specified resource, using the specified method.</summary>
|
||||
/// <returns>A <see cref="T:System.String" /> containing the response sent by the server.</returns>
|
||||
/// <param name="address">The URI of the resource to receive the file. This URI must identify a resource that can accept a request sent with the <paramref name="method" /> method. </param>
|
||||
/// <param name="method">The HTTP method used to send the string to the resource. If null, the default is POST for http and STOR for ftp.</param>
|
||||
/// <param name="data">The string to be uploaded.</param>
|
||||
/// <exception cref="T:System.Net.WebException">The URI formed by combining <see cref="P:System.Net.WebClient.BaseAddress" /> and <paramref name="address" /> is invalid.-or- There was no response from the server hosting the resource.-or-<paramref name="method" /> cannot be used to send content.</exception>
|
||||
// Token: 0x060015EF RID: 5615 RVA: 0x000467D0 File Offset: 0x000449D0
|
||||
public string UploadString(global::System.Uri address, string method, string data)
|
||||
{
|
||||
if (address == null)
|
||||
{
|
||||
throw new ArgumentNullException("address");
|
||||
}
|
||||
if (data == null)
|
||||
{
|
||||
throw new ArgumentNullException("data");
|
||||
}
|
||||
byte[] array = this.UploadData(address, method, this.encoding.GetBytes(data));
|
||||
return this.encoding.GetString(array);
|
||||
}
|
||||
|
||||
// Token: 0x060015F0 RID: 5616 RVA: 0x00046828 File Offset: 0x00044A28
|
||||
private global::System.Uri CreateUri(string address)
|
||||
{
|
||||
return this.MakeUri(address);
|
||||
}
|
||||
|
||||
// Token: 0x060015F1 RID: 5617 RVA: 0x00046834 File Offset: 0x00044A34
|
||||
private global::System.Uri CreateUri(global::System.Uri address)
|
||||
{
|
||||
string query = address.Query;
|
||||
if (string.IsNullOrEmpty(query))
|
||||
{
|
||||
query = this.GetQueryString(true);
|
||||
}
|
||||
if (this.baseAddress == null && query == null)
|
||||
{
|
||||
return address;
|
||||
}
|
||||
if (this.baseAddress == null)
|
||||
{
|
||||
return new global::System.Uri(address.ToString() + query, query != null);
|
||||
}
|
||||
if (query == null)
|
||||
{
|
||||
return new global::System.Uri(this.baseAddress, address.ToString());
|
||||
}
|
||||
return new global::System.Uri(this.baseAddress, address.ToString() + query, query != null);
|
||||
}
|
||||
|
||||
// Token: 0x060015F2 RID: 5618 RVA: 0x000468D4 File Offset: 0x00044AD4
|
||||
private string GetQueryString(bool add_qmark)
|
||||
{
|
||||
if (this.queryString == null || this.queryString.Count == 0)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
StringBuilder stringBuilder = new StringBuilder();
|
||||
if (add_qmark)
|
||||
{
|
||||
stringBuilder.Append('?');
|
||||
}
|
||||
foreach (object obj in this.queryString)
|
||||
{
|
||||
string text = (string)obj;
|
||||
stringBuilder.AppendFormat("{0}={1}&", text, this.UrlEncode(this.queryString[text]));
|
||||
}
|
||||
if (stringBuilder.Length != 0)
|
||||
{
|
||||
stringBuilder.Length--;
|
||||
}
|
||||
if (stringBuilder.Length == 0)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
return stringBuilder.ToString();
|
||||
}
|
||||
|
||||
// Token: 0x060015F3 RID: 5619 RVA: 0x000469BC File Offset: 0x00044BBC
|
||||
private global::System.Uri MakeUri(string path)
|
||||
{
|
||||
string text = this.GetQueryString(true);
|
||||
if (this.baseAddress == null && text == null)
|
||||
{
|
||||
try
|
||||
{
|
||||
return new global::System.Uri(path);
|
||||
}
|
||||
catch (ArgumentNullException)
|
||||
{
|
||||
if (Environment.UnityWebSecurityEnabled)
|
||||
{
|
||||
throw;
|
||||
}
|
||||
path = Path.GetFullPath(path);
|
||||
return new global::System.Uri("file://" + path);
|
||||
}
|
||||
catch (global::System.UriFormatException)
|
||||
{
|
||||
if (Environment.UnityWebSecurityEnabled)
|
||||
{
|
||||
throw;
|
||||
}
|
||||
path = Path.GetFullPath(path);
|
||||
return new global::System.Uri("file://" + path);
|
||||
}
|
||||
}
|
||||
if (this.baseAddress == null)
|
||||
{
|
||||
return new global::System.Uri(path + text, text != null);
|
||||
}
|
||||
if (text == null)
|
||||
{
|
||||
return new global::System.Uri(this.baseAddress, path);
|
||||
}
|
||||
return new global::System.Uri(this.baseAddress, path + text, text != null);
|
||||
}
|
||||
|
||||
// Token: 0x060015F4 RID: 5620 RVA: 0x00046AE0 File Offset: 0x00044CE0
|
||||
private WebRequest SetupRequest(global::System.Uri uri)
|
||||
{
|
||||
WebRequest webRequest = this.GetWebRequest(uri);
|
||||
if (this.Proxy != null)
|
||||
{
|
||||
webRequest.Proxy = this.Proxy;
|
||||
}
|
||||
webRequest.Credentials = this.credentials;
|
||||
if (this.headers != null && this.headers.Count != 0 && webRequest is HttpWebRequest)
|
||||
{
|
||||
HttpWebRequest httpWebRequest = (HttpWebRequest)webRequest;
|
||||
string text = this.headers["Expect"];
|
||||
string text2 = this.headers["Content-Type"];
|
||||
string text3 = this.headers["Accept"];
|
||||
string text4 = this.headers["Connection"];
|
||||
string text5 = this.headers["User-Agent"];
|
||||
string text6 = this.headers["Referer"];
|
||||
this.headers.RemoveInternal("Expect");
|
||||
this.headers.RemoveInternal("Content-Type");
|
||||
this.headers.RemoveInternal("Accept");
|
||||
this.headers.RemoveInternal("Connection");
|
||||
this.headers.RemoveInternal("Referer");
|
||||
this.headers.RemoveInternal("User-Agent");
|
||||
webRequest.Headers = this.headers;
|
||||
if (text != null && text.Length > 0)
|
||||
{
|
||||
httpWebRequest.Expect = text;
|
||||
}
|
||||
if (text3 != null && text3.Length > 0)
|
||||
{
|
||||
httpWebRequest.Accept = text3;
|
||||
}
|
||||
if (text2 != null && text2.Length > 0)
|
||||
{
|
||||
httpWebRequest.ContentType = text2;
|
||||
}
|
||||
if (text4 != null && text4.Length > 0)
|
||||
{
|
||||
httpWebRequest.Connection = text4;
|
||||
}
|
||||
if (text5 != null && text5.Length > 0)
|
||||
{
|
||||
httpWebRequest.UserAgent = text5;
|
||||
}
|
||||
if (text6 != null && text6.Length > 0)
|
||||
{
|
||||
httpWebRequest.Referer = text6;
|
||||
}
|
||||
}
|
||||
this.responseHeaders = null;
|
||||
return webRequest;
|
||||
}
|
||||
|
||||
// Token: 0x060015F5 RID: 5621 RVA: 0x00046CC8 File Offset: 0x00044EC8
|
||||
private WebRequest SetupRequest(global::System.Uri uri, string method, bool is_upload)
|
||||
{
|
||||
WebRequest webRequest = this.SetupRequest(uri);
|
||||
webRequest.Method = this.DetermineMethod(uri, method, is_upload);
|
||||
return webRequest;
|
||||
}
|
||||
|
||||
// Token: 0x060015F6 RID: 5622 RVA: 0x00046CF0 File Offset: 0x00044EF0
|
||||
private byte[] ReadAll(Stream stream, int length, object userToken)
|
||||
{
|
||||
MemoryStream memoryStream = null;
|
||||
bool flag = length == -1;
|
||||
int num = ((!flag) ? length : 8192);
|
||||
if (flag)
|
||||
{
|
||||
memoryStream = new MemoryStream();
|
||||
}
|
||||
int num2 = 0;
|
||||
byte[] array = new byte[num];
|
||||
int num3;
|
||||
while ((num3 = stream.Read(array, num2, num)) != 0)
|
||||
{
|
||||
if (flag)
|
||||
{
|
||||
memoryStream.Write(array, 0, num3);
|
||||
}
|
||||
else
|
||||
{
|
||||
num2 += num3;
|
||||
num -= num3;
|
||||
}
|
||||
if (this.async)
|
||||
{
|
||||
this.OnDownloadProgressChanged(new DownloadProgressChangedEventArgs((long)num3, (long)length, userToken));
|
||||
}
|
||||
}
|
||||
if (flag)
|
||||
{
|
||||
return memoryStream.ToArray();
|
||||
}
|
||||
return array;
|
||||
}
|
||||
|
||||
// Token: 0x060015F7 RID: 5623 RVA: 0x00046D90 File Offset: 0x00044F90
|
||||
private string UrlEncode(string str)
|
||||
{
|
||||
StringBuilder stringBuilder = new StringBuilder();
|
||||
int length = str.Length;
|
||||
for (int i = 0; i < length; i++)
|
||||
{
|
||||
char c = str[i];
|
||||
if (c == ' ')
|
||||
{
|
||||
stringBuilder.Append('+');
|
||||
}
|
||||
else if ((c < '0' && c != '-' && c != '.') || (c < 'A' && c > '9') || (c > 'Z' && c < 'a' && c != '_') || c > 'z')
|
||||
{
|
||||
stringBuilder.Append('%');
|
||||
int num = (int)(c >> 4);
|
||||
stringBuilder.Append((char)WebClient.hexBytes[num]);
|
||||
num = (int)(c & '\u000f');
|
||||
stringBuilder.Append((char)WebClient.hexBytes[num]);
|
||||
}
|
||||
else
|
||||
{
|
||||
stringBuilder.Append(c);
|
||||
}
|
||||
}
|
||||
return stringBuilder.ToString();
|
||||
}
|
||||
|
||||
// Token: 0x060015F8 RID: 5624 RVA: 0x00046E6C File Offset: 0x0004506C
|
||||
private static void UrlEncodeAndWrite(Stream stream, byte[] bytes)
|
||||
{
|
||||
if (bytes == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
int num = bytes.Length;
|
||||
if (num == 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
for (int i = 0; i < num; i++)
|
||||
{
|
||||
char c = (char)bytes[i];
|
||||
if (c == ' ')
|
||||
{
|
||||
stream.WriteByte(43);
|
||||
}
|
||||
else if ((c < '0' && c != '-' && c != '.') || (c < 'A' && c > '9') || (c > 'Z' && c < 'a' && c != '_') || c > 'z')
|
||||
{
|
||||
stream.WriteByte(37);
|
||||
int num2 = (int)(c >> 4);
|
||||
stream.WriteByte(WebClient.hexBytes[num2]);
|
||||
num2 = (int)(c & '\u000f');
|
||||
stream.WriteByte(WebClient.hexBytes[num2]);
|
||||
}
|
||||
else
|
||||
{
|
||||
stream.WriteByte((byte)c);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Cancels a pending asynchronous operation.</summary>
|
||||
/// <PermissionSet>
|
||||
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="UnmanagedCode, ControlEvidence" />
|
||||
/// </PermissionSet>
|
||||
// Token: 0x060015F9 RID: 5625 RVA: 0x00046F38 File Offset: 0x00045138
|
||||
public void CancelAsync()
|
||||
{
|
||||
lock (this)
|
||||
{
|
||||
if (this.async_thread != null)
|
||||
{
|
||||
Thread thread = this.async_thread;
|
||||
this.CompleteAsync();
|
||||
thread.Interrupt();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x060015FA RID: 5626 RVA: 0x00046F98 File Offset: 0x00045198
|
||||
private void CompleteAsync()
|
||||
{
|
||||
lock (this)
|
||||
{
|
||||
this.is_busy = false;
|
||||
this.async_thread = null;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Downloads the specified resource as a <see cref="T:System.Byte" /> array. This method does not block the calling thread.</summary>
|
||||
/// <param name="address">A <see cref="T:System.Uri" /> containing the URI to download.</param>
|
||||
/// <exception cref="T:System.Net.WebException">The URI formed by combining <see cref="P:System.Net.WebClient.BaseAddress" /> and <paramref name="address" /> is invalid.-or- An error occurred while downloading the resource. </exception>
|
||||
// Token: 0x060015FB RID: 5627 RVA: 0x00046FE4 File Offset: 0x000451E4
|
||||
public void DownloadDataAsync(global::System.Uri address)
|
||||
{
|
||||
this.DownloadDataAsync(address, null);
|
||||
}
|
||||
|
||||
/// <summary>Downloads the specified resource as a <see cref="T:System.Byte" /> array. This method does not block the calling thread.</summary>
|
||||
/// <param name="address">A <see cref="T:System.Uri" /> containing the URI to download.</param>
|
||||
/// <param name="userToken">A user-defined object that is passed to the method invoked when the asynchronous operation completes.</param>
|
||||
/// <exception cref="T:System.Net.WebException">The URI formed by combining <see cref="P:System.Net.WebClient.BaseAddress" /> and <paramref name="address" /> is invalid.-or- An error occurred while downloading the resource. </exception>
|
||||
// Token: 0x060015FC RID: 5628 RVA: 0x00046FF0 File Offset: 0x000451F0
|
||||
public void DownloadDataAsync(global::System.Uri address, object userToken)
|
||||
{
|
||||
if (address == null)
|
||||
{
|
||||
throw new ArgumentNullException("address");
|
||||
}
|
||||
lock (this)
|
||||
{
|
||||
this.SetBusy();
|
||||
this.async = true;
|
||||
this.async_thread = new Thread(delegate(object state)
|
||||
{
|
||||
object[] array2 = (object[])state;
|
||||
try
|
||||
{
|
||||
byte[] array3 = this.DownloadDataCore((global::System.Uri)array2[0], array2[1]);
|
||||
this.OnDownloadDataCompleted(new DownloadDataCompletedEventArgs(array3, null, false, array2[1]));
|
||||
}
|
||||
catch (ThreadInterruptedException)
|
||||
{
|
||||
this.OnDownloadDataCompleted(new DownloadDataCompletedEventArgs(null, null, true, array2[1]));
|
||||
throw;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
this.OnDownloadDataCompleted(new DownloadDataCompletedEventArgs(null, ex, false, array2[1]));
|
||||
}
|
||||
});
|
||||
object[] array = new object[] { address, userToken };
|
||||
this.async_thread.Start(array);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Downloads, to a local file, the resource with the specified URI. This method does not block the calling thread.</summary>
|
||||
/// <param name="address">The URI of the resource to download. </param>
|
||||
/// <param name="fileName">The name of the file to be placed on the local computer. </param>
|
||||
/// <exception cref="T:System.Net.WebException">The URI formed by combining <see cref="P:System.Net.WebClient.BaseAddress" /> and <paramref name="address" /> is invalid.-or- An error occurred while downloading the resource. </exception>
|
||||
/// <exception cref="T:System.InvalidOperationException">The local file specified by <paramref name="fileName" /> is in use by another thread.</exception>
|
||||
// Token: 0x060015FD RID: 5629 RVA: 0x00047084 File Offset: 0x00045284
|
||||
public void DownloadFileAsync(global::System.Uri address, string fileName)
|
||||
{
|
||||
this.DownloadFileAsync(address, fileName, null);
|
||||
}
|
||||
|
||||
/// <summary>Downloads, to a local file, the resource with the specified URI. This method does not block the calling thread.</summary>
|
||||
/// <param name="address">The URI of the resource to download. </param>
|
||||
/// <param name="fileName">The name of the file to be placed on the local computer. </param>
|
||||
/// <param name="userToken">A user-defined object that is passed to the method invoked when the asynchronous operation completes.</param>
|
||||
/// <exception cref="T:System.Net.WebException">The URI formed by combining <see cref="P:System.Net.WebClient.BaseAddress" /> and <paramref name="address" /> is invalid.-or- An error occurred while downloading the resource. </exception>
|
||||
/// <exception cref="T:System.InvalidOperationException">The local file specified by <paramref name="fileName" /> is in use by another thread.</exception>
|
||||
// Token: 0x060015FE RID: 5630 RVA: 0x00047090 File Offset: 0x00045290
|
||||
public void DownloadFileAsync(global::System.Uri address, string fileName, object userToken)
|
||||
{
|
||||
if (address == null)
|
||||
{
|
||||
throw new ArgumentNullException("address");
|
||||
}
|
||||
if (fileName == null)
|
||||
{
|
||||
throw new ArgumentNullException("fileName");
|
||||
}
|
||||
lock (this)
|
||||
{
|
||||
this.SetBusy();
|
||||
this.async = true;
|
||||
this.async_thread = new Thread(delegate(object state)
|
||||
{
|
||||
object[] array2 = (object[])state;
|
||||
try
|
||||
{
|
||||
this.DownloadFileCore((global::System.Uri)array2[0], (string)array2[1], array2[2]);
|
||||
this.OnDownloadFileCompleted(new global::System.ComponentModel.AsyncCompletedEventArgs(null, false, array2[2]));
|
||||
}
|
||||
catch (ThreadInterruptedException)
|
||||
{
|
||||
this.OnDownloadFileCompleted(new global::System.ComponentModel.AsyncCompletedEventArgs(null, true, array2[2]));
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
this.OnDownloadFileCompleted(new global::System.ComponentModel.AsyncCompletedEventArgs(ex, false, array2[2]));
|
||||
}
|
||||
});
|
||||
object[] array = new object[] { address, fileName, userToken };
|
||||
this.async_thread.Start(array);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Downloads the resource specified as a <see cref="T:System.Uri" />. This method does not block the calling thread.</summary>
|
||||
/// <param name="address">A <see cref="T:System.Uri" /> containing the URI to download.</param>
|
||||
/// <exception cref="T:System.Net.WebException">The URI formed by combining <see cref="P:System.Net.WebClient.BaseAddress" /> and <paramref name="address" /> is invalid.-or- An error occurred while downloading the resource. </exception>
|
||||
// Token: 0x060015FF RID: 5631 RVA: 0x00047138 File Offset: 0x00045338
|
||||
public void DownloadStringAsync(global::System.Uri address)
|
||||
{
|
||||
this.DownloadStringAsync(address, null);
|
||||
}
|
||||
|
||||
/// <summary>Downloads the specified string to the specified resource. This method does not block the calling thread.</summary>
|
||||
/// <param name="address">A <see cref="T:System.Uri" /> containing the URI to download.</param>
|
||||
/// <param name="userToken">A user-defined object that is passed to the method invoked when the asynchronous operation completes.</param>
|
||||
/// <exception cref="T:System.Net.WebException">The URI formed by combining <see cref="P:System.Net.WebClient.BaseAddress" /> and <paramref name="address" /> is invalid.-or- An error occurred while downloading the resource. </exception>
|
||||
// Token: 0x06001600 RID: 5632 RVA: 0x00047144 File Offset: 0x00045344
|
||||
public void DownloadStringAsync(global::System.Uri address, object userToken)
|
||||
{
|
||||
if (address == null)
|
||||
{
|
||||
throw new ArgumentNullException("address");
|
||||
}
|
||||
lock (this)
|
||||
{
|
||||
this.SetBusy();
|
||||
this.async = true;
|
||||
this.async_thread = new Thread(delegate(object state)
|
||||
{
|
||||
object[] array2 = (object[])state;
|
||||
try
|
||||
{
|
||||
string @string = this.encoding.GetString(this.DownloadDataCore((global::System.Uri)array2[0], array2[1]));
|
||||
this.OnDownloadStringCompleted(new DownloadStringCompletedEventArgs(@string, null, false, array2[1]));
|
||||
}
|
||||
catch (ThreadInterruptedException)
|
||||
{
|
||||
this.OnDownloadStringCompleted(new DownloadStringCompletedEventArgs(null, null, true, array2[1]));
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
this.OnDownloadStringCompleted(new DownloadStringCompletedEventArgs(null, ex, false, array2[1]));
|
||||
}
|
||||
});
|
||||
object[] array = new object[] { address, userToken };
|
||||
this.async_thread.Start(array);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Opens a readable stream containing the specified resource. This method does not block the calling thread.</summary>
|
||||
/// <param name="address">The URI of the resource to retrieve.</param>
|
||||
/// <exception cref="T:System.Net.WebException">The URI formed by combining <see cref="P:System.Net.WebClient.BaseAddress" /> and address is invalid.-or- An error occurred while downloading the resource. -or- An error occurred while opening the stream.</exception>
|
||||
// Token: 0x06001601 RID: 5633 RVA: 0x000471D8 File Offset: 0x000453D8
|
||||
public void OpenReadAsync(global::System.Uri address)
|
||||
{
|
||||
this.OpenReadAsync(address, null);
|
||||
}
|
||||
|
||||
/// <summary>Opens a readable stream containing the specified resource. This method does not block the calling thread.</summary>
|
||||
/// <param name="address">The URI of the resource to retrieve.</param>
|
||||
/// <param name="userToken">A user-defined object that is passed to the method invoked when the asynchronous operation completes.</param>
|
||||
/// <exception cref="T:System.Net.WebException">The URI formed by combining <see cref="P:System.Net.WebClient.BaseAddress" /> and address is invalid.-or- An error occurred while downloading the resource. -or- An error occurred while opening the stream.</exception>
|
||||
// Token: 0x06001602 RID: 5634 RVA: 0x000471E4 File Offset: 0x000453E4
|
||||
public void OpenReadAsync(global::System.Uri address, object userToken)
|
||||
{
|
||||
if (address == null)
|
||||
{
|
||||
throw new ArgumentNullException("address");
|
||||
}
|
||||
lock (this)
|
||||
{
|
||||
this.SetBusy();
|
||||
this.async = true;
|
||||
this.async_thread = new Thread(delegate(object state)
|
||||
{
|
||||
object[] array2 = (object[])state;
|
||||
WebRequest webRequest = null;
|
||||
try
|
||||
{
|
||||
webRequest = this.SetupRequest((global::System.Uri)array2[0]);
|
||||
WebResponse webResponse = this.GetWebResponse(webRequest);
|
||||
Stream responseStream = webResponse.GetResponseStream();
|
||||
this.OnOpenReadCompleted(new OpenReadCompletedEventArgs(responseStream, null, false, array2[1]));
|
||||
}
|
||||
catch (ThreadInterruptedException)
|
||||
{
|
||||
if (webRequest != null)
|
||||
{
|
||||
webRequest.Abort();
|
||||
}
|
||||
this.OnOpenReadCompleted(new OpenReadCompletedEventArgs(null, null, true, array2[1]));
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
this.OnOpenReadCompleted(new OpenReadCompletedEventArgs(null, ex, false, array2[1]));
|
||||
}
|
||||
});
|
||||
object[] array = new object[] { address, userToken };
|
||||
this.async_thread.Start(array);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Opens a stream for writing data to the specified resource. This method does not block the calling thread.</summary>
|
||||
/// <param name="address">The URI of the resource to receive the data. </param>
|
||||
// Token: 0x06001603 RID: 5635 RVA: 0x00047278 File Offset: 0x00045478
|
||||
public void OpenWriteAsync(global::System.Uri address)
|
||||
{
|
||||
this.OpenWriteAsync(address, null);
|
||||
}
|
||||
|
||||
/// <summary>Opens a stream for writing data to the specified resource. This method does not block the calling thread.</summary>
|
||||
/// <param name="address">The URI of the resource to receive the data. </param>
|
||||
/// <param name="method">The method used to send the data to the resource. If null, the default is POST for http and STOR for ftp.</param>
|
||||
// Token: 0x06001604 RID: 5636 RVA: 0x00047284 File Offset: 0x00045484
|
||||
public void OpenWriteAsync(global::System.Uri address, string method)
|
||||
{
|
||||
this.OpenWriteAsync(address, method, null);
|
||||
}
|
||||
|
||||
/// <summary>Opens a stream for writing data to the specified resource, using the specified method. This method does not block the calling thread.</summary>
|
||||
/// <param name="address">The URI of the resource to receive the data.</param>
|
||||
/// <param name="method">The method used to send the data to the resource. If null, the default is POST for http and STOR for ftp.</param>
|
||||
/// <param name="userToken">A user-defined object that is passed to the method invoked when the asynchronous operation completes</param>
|
||||
/// <exception cref="T:System.Net.WebException">The URI formed by combining <see cref="P:System.Net.WebClient.BaseAddress" /> and <paramref name="address" /> is invalid.-or- An error occurred while opening the stream. </exception>
|
||||
// Token: 0x06001605 RID: 5637 RVA: 0x00047290 File Offset: 0x00045490
|
||||
public void OpenWriteAsync(global::System.Uri address, string method, object userToken)
|
||||
{
|
||||
if (address == null)
|
||||
{
|
||||
throw new ArgumentNullException("address");
|
||||
}
|
||||
lock (this)
|
||||
{
|
||||
this.SetBusy();
|
||||
this.async = true;
|
||||
this.async_thread = new Thread(delegate(object state)
|
||||
{
|
||||
object[] array2 = (object[])state;
|
||||
WebRequest webRequest = null;
|
||||
try
|
||||
{
|
||||
webRequest = this.SetupRequest((global::System.Uri)array2[0], (string)array2[1], true);
|
||||
Stream requestStream = webRequest.GetRequestStream();
|
||||
this.OnOpenWriteCompleted(new OpenWriteCompletedEventArgs(requestStream, null, false, array2[2]));
|
||||
}
|
||||
catch (ThreadInterruptedException)
|
||||
{
|
||||
if (webRequest != null)
|
||||
{
|
||||
webRequest.Abort();
|
||||
}
|
||||
this.OnOpenWriteCompleted(new OpenWriteCompletedEventArgs(null, null, true, array2[2]));
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
this.OnOpenWriteCompleted(new OpenWriteCompletedEventArgs(null, ex, false, array2[2]));
|
||||
}
|
||||
});
|
||||
object[] array = new object[] { address, method, userToken };
|
||||
this.async_thread.Start(array);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Uploads a data buffer to a resource identified by a URI, using the POST method. This method does not block the calling thread.</summary>
|
||||
/// <param name="address">The URI of the resource to receive the data. </param>
|
||||
/// <param name="data">The data buffer to send to the resource. </param>
|
||||
/// <exception cref="T:System.Net.WebException">The URI formed by combining <see cref="P:System.Net.WebClient.BaseAddress" /> and <paramref name="address" /> is invalid.-or- An error occurred while opening the stream.-or- There was no response from the server hosting the resource. </exception>
|
||||
// Token: 0x06001606 RID: 5638 RVA: 0x00047328 File Offset: 0x00045528
|
||||
public void UploadDataAsync(global::System.Uri address, byte[] data)
|
||||
{
|
||||
this.UploadDataAsync(address, null, data);
|
||||
}
|
||||
|
||||
/// <summary>Uploads a data buffer to a resource identified by a URI, using the specified method. This method does not block the calling thread.</summary>
|
||||
/// <param name="address">The URI of the resource to receive the data.</param>
|
||||
/// <param name="method">The HTTP method used to send the file to the resource. If null, the default is POST for http and STOR for ftp.</param>
|
||||
/// <param name="data">The data buffer to send to the resource.</param>
|
||||
/// <exception cref="T:System.Net.WebException">The URI formed by combining <see cref="P:System.Net.WebClient.BaseAddress" /> and <paramref name="address" /> is invalid.-or- An error occurred while opening the stream.-or- There was no response from the server hosting the resource. </exception>
|
||||
// Token: 0x06001607 RID: 5639 RVA: 0x00047334 File Offset: 0x00045534
|
||||
public void UploadDataAsync(global::System.Uri address, string method, byte[] data)
|
||||
{
|
||||
this.UploadDataAsync(address, method, data, null);
|
||||
}
|
||||
|
||||
/// <summary>Uploads a data buffer to a resource identified by a URI, using the specified method and identifying token.</summary>
|
||||
/// <param name="address">The URI of the resource to receive the data.</param>
|
||||
/// <param name="method">The HTTP method used to send the file to the resource. If null, the default is POST for http and STOR for ftp.</param>
|
||||
/// <param name="data">The data buffer to send to the resource.</param>
|
||||
/// <param name="userToken">A user-defined object that is passed to the method invoked when the asynchronous operation completes.</param>
|
||||
/// <exception cref="T:System.Net.WebException">The URI formed by combining <see cref="P:System.Net.WebClient.BaseAddress" /> and <paramref name="address" /> is invalid.-or- An error occurred while opening the stream.-or- There was no response from the server hosting the resource. </exception>
|
||||
// Token: 0x06001608 RID: 5640 RVA: 0x00047340 File Offset: 0x00045540
|
||||
public void UploadDataAsync(global::System.Uri address, string method, byte[] data, object userToken)
|
||||
{
|
||||
if (address == null)
|
||||
{
|
||||
throw new ArgumentNullException("address");
|
||||
}
|
||||
if (data == null)
|
||||
{
|
||||
throw new ArgumentNullException("data");
|
||||
}
|
||||
lock (this)
|
||||
{
|
||||
this.SetBusy();
|
||||
this.async = true;
|
||||
this.async_thread = new Thread(delegate(object state)
|
||||
{
|
||||
object[] array2 = (object[])state;
|
||||
try
|
||||
{
|
||||
byte[] array3 = this.UploadDataCore((global::System.Uri)array2[0], (string)array2[1], (byte[])array2[2], array2[3]);
|
||||
this.OnUploadDataCompleted(new UploadDataCompletedEventArgs(array3, null, false, array2[3]));
|
||||
}
|
||||
catch (ThreadInterruptedException)
|
||||
{
|
||||
this.OnUploadDataCompleted(new UploadDataCompletedEventArgs(null, null, true, array2[3]));
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
this.OnUploadDataCompleted(new UploadDataCompletedEventArgs(null, ex, false, array2[3]));
|
||||
}
|
||||
});
|
||||
object[] array = new object[] { address, method, data, userToken };
|
||||
this.async_thread.Start(array);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Uploads the specified local file to the specified resource, using the POST method. This method does not block the calling thread.</summary>
|
||||
/// <param name="address">The URI of the resource to receive the file. For HTTP resources, this URI must identify a resource that can accept a request sent with the POST method, such as a script or ASP page. </param>
|
||||
/// <param name="fileName">The file to send to the resource. </param>
|
||||
/// <exception cref="T:System.Net.WebException">The URI formed by combining <see cref="P:System.Net.WebClient.BaseAddress" /> and <paramref name="address" /> is invalid.-or- <paramref name="fileName" /> is null, is <see cref="F:System.String.Empty" />, contains invalid character, or the specified path to the file does not exist.-or- An error occurred while opening the stream.-or- There was no response from the server hosting the resource.-or- The Content-type header begins with multipart. </exception>
|
||||
// Token: 0x06001609 RID: 5641 RVA: 0x000473F0 File Offset: 0x000455F0
|
||||
public void UploadFileAsync(global::System.Uri address, string fileName)
|
||||
{
|
||||
this.UploadFileAsync(address, null, fileName);
|
||||
}
|
||||
|
||||
/// <summary>Uploads the specified local file to the specified resource, using the POST method. This method does not block the calling thread.</summary>
|
||||
/// <param name="address">The URI of the resource to receive the file. For HTTP resources, this URI must identify a resource that can accept a request sent with the POST method, such as a script or ASP page. </param>
|
||||
/// <param name="method">The HTTP method used to send the data to the resource. If null, the default is POST for http and STOR for ftp.</param>
|
||||
/// <param name="fileName">The file to send to the resource. </param>
|
||||
/// <exception cref="T:System.Net.WebException">The URI formed by combining <see cref="P:System.Net.WebClient.BaseAddress" /> and <paramref name="address" /> is invalid.-or- <paramref name="fileName" /> is null, is <see cref="F:System.String.Empty" />, contains invalid character, or the specified path to the file does not exist.-or- An error occurred while opening the stream.-or- There was no response from the server hosting the resource.-or- The Content-type header begins with multipart. </exception>
|
||||
// Token: 0x0600160A RID: 5642 RVA: 0x000473FC File Offset: 0x000455FC
|
||||
public void UploadFileAsync(global::System.Uri address, string method, string fileName)
|
||||
{
|
||||
this.UploadFileAsync(address, method, fileName, null);
|
||||
}
|
||||
|
||||
/// <summary>Uploads the specified local file to the specified resource, using the POST method. This method does not block the calling thread.</summary>
|
||||
/// <param name="address">The URI of the resource to receive the file. For HTTP resources, this URI must identify a resource that can accept a request sent with the POST method, such as a script or ASP page.</param>
|
||||
/// <param name="method">The HTTP method used to send the data to the resource. If null, the default is POST for http and STOR for ftp.</param>
|
||||
/// <param name="fileName">The file to send to the resource.</param>
|
||||
/// <param name="userToken">A user-defined object that is passed to the method invoked when the asynchronous operation completes.</param>
|
||||
/// <exception cref="T:System.Net.WebException">The URI formed by combining <see cref="P:System.Net.WebClient.BaseAddress" /> and <paramref name="address" /> is invalid.-or- <paramref name="fileName" /> is null, is <see cref="F:System.String.Empty" />, contains invalid character, or the specified path to the file does not exist.-or- An error occurred while opening the stream.-or- There was no response from the server hosting the resource.-or- The Content-type header begins with multipart. </exception>
|
||||
// Token: 0x0600160B RID: 5643 RVA: 0x00047408 File Offset: 0x00045608
|
||||
public void UploadFileAsync(global::System.Uri address, string method, string fileName, object userToken)
|
||||
{
|
||||
if (address == null)
|
||||
{
|
||||
throw new ArgumentNullException("address");
|
||||
}
|
||||
if (fileName == null)
|
||||
{
|
||||
throw new ArgumentNullException("fileName");
|
||||
}
|
||||
lock (this)
|
||||
{
|
||||
this.SetBusy();
|
||||
this.async = true;
|
||||
this.async_thread = new Thread(delegate(object state)
|
||||
{
|
||||
object[] array2 = (object[])state;
|
||||
try
|
||||
{
|
||||
byte[] array3 = this.UploadFileCore((global::System.Uri)array2[0], (string)array2[1], (string)array2[2], array2[3]);
|
||||
this.OnUploadFileCompleted(new UploadFileCompletedEventArgs(array3, null, false, array2[3]));
|
||||
}
|
||||
catch (ThreadInterruptedException)
|
||||
{
|
||||
this.OnUploadFileCompleted(new UploadFileCompletedEventArgs(null, null, true, array2[3]));
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
this.OnUploadFileCompleted(new UploadFileCompletedEventArgs(null, ex, false, array2[3]));
|
||||
}
|
||||
});
|
||||
object[] array = new object[] { address, method, fileName, userToken };
|
||||
this.async_thread.Start(array);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Uploads the specified string to the specified resource. This method does not block the calling thread.</summary>
|
||||
/// <param name="address">The URI of the resource to receive the file. For HTTP resources, this URI must identify a resource that can accept a request sent with the POST method, such as a script or ASP page. </param>
|
||||
/// <param name="data">The string to be uploaded.</param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="data" /> is null.</exception>
|
||||
/// <exception cref="T:System.Net.WebException">The URI formed by combining <see cref="P:System.Net.WebClient.BaseAddress" /> and <paramref name="address" /> is invalid.-or- There was no response from the server hosting the resource.</exception>
|
||||
// Token: 0x0600160C RID: 5644 RVA: 0x000474B8 File Offset: 0x000456B8
|
||||
public void UploadStringAsync(global::System.Uri address, string data)
|
||||
{
|
||||
this.UploadStringAsync(address, null, data);
|
||||
}
|
||||
|
||||
/// <summary>Uploads the specified string to the specified resource. This method does not block the calling thread.</summary>
|
||||
/// <param name="address">The URI of the resource to receive the file. For HTTP resources, this URI must identify a resource that can accept a request sent with the POST method, such as a script or ASP page.</param>
|
||||
/// <param name="method">The HTTP method used to send the file to the resource. If null, the default is POST for http and STOR for ftp.</param>
|
||||
/// <param name="data">The string to be uploaded.</param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="data" /> is null.</exception>
|
||||
/// <exception cref="T:System.Net.WebException">The URI formed by combining <see cref="P:System.Net.WebClient.BaseAddress" /> and <paramref name="address" /> is invalid.-or- There was no response from the server hosting the resource.</exception>
|
||||
// Token: 0x0600160D RID: 5645 RVA: 0x000474C4 File Offset: 0x000456C4
|
||||
public void UploadStringAsync(global::System.Uri address, string method, string data)
|
||||
{
|
||||
this.UploadStringAsync(address, method, data, null);
|
||||
}
|
||||
|
||||
/// <summary>Uploads the specified string to the specified resource. This method does not block the calling thread.</summary>
|
||||
/// <param name="address">The URI of the resource to receive the file. For HTTP resources, this URI must identify a resource that can accept a request sent with the POST method, such as a script or ASP page.</param>
|
||||
/// <param name="method">The HTTP method used to send the file to the resource. If null, the default is POST for http and STOR for ftp.</param>
|
||||
/// <param name="data">The string to be uploaded.</param>
|
||||
/// <param name="userToken">A user-defined object that is passed to the method invoked when the asynchronous operation completes.</param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="data" /> is null.</exception>
|
||||
/// <exception cref="T:System.Net.WebException">The URI formed by combining <see cref="P:System.Net.WebClient.BaseAddress" /> and <paramref name="address" /> is invalid.-or- There was no response from the server hosting the resource.</exception>
|
||||
// Token: 0x0600160E RID: 5646 RVA: 0x000474D0 File Offset: 0x000456D0
|
||||
public void UploadStringAsync(global::System.Uri address, string method, string data, object userToken)
|
||||
{
|
||||
if (address == null)
|
||||
{
|
||||
throw new ArgumentNullException("address");
|
||||
}
|
||||
if (data == null)
|
||||
{
|
||||
throw new ArgumentNullException("data");
|
||||
}
|
||||
lock (this)
|
||||
{
|
||||
this.CheckBusy();
|
||||
this.async = true;
|
||||
this.async_thread = new Thread(delegate(object state)
|
||||
{
|
||||
object[] array2 = (object[])state;
|
||||
try
|
||||
{
|
||||
string text = this.UploadString((global::System.Uri)array2[0], (string)array2[1], (string)array2[2]);
|
||||
this.OnUploadStringCompleted(new UploadStringCompletedEventArgs(text, null, false, array2[3]));
|
||||
}
|
||||
catch (ThreadInterruptedException)
|
||||
{
|
||||
this.OnUploadStringCompleted(new UploadStringCompletedEventArgs(null, null, true, array2[3]));
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
this.OnUploadStringCompleted(new UploadStringCompletedEventArgs(null, ex, false, array2[3]));
|
||||
}
|
||||
});
|
||||
object[] array = new object[] { address, method, data, userToken };
|
||||
this.async_thread.Start(array);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Uploads the data in the specified name/value collection to the resource identified by the specified URI. This method does not block the calling thread.</summary>
|
||||
/// <param name="address">The URI of the resource to receive the collection. This URI must identify a resource that can accept a request sent with the default method. See remarks.</param>
|
||||
/// <param name="data">The <see cref="T:System.Collections.Specialized.NameValueCollection" /> to send to the resource.</param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="data" /> is null.</exception>
|
||||
/// <exception cref="T:System.Net.WebException">The URI formed by combining <see cref="P:System.Net.WebClient.BaseAddress" /> and <paramref name="address" /> is invalid.-or- There was no response from the server hosting the resource.</exception>
|
||||
// Token: 0x0600160F RID: 5647 RVA: 0x00047580 File Offset: 0x00045780
|
||||
public void UploadValuesAsync(global::System.Uri address, global::System.Collections.Specialized.NameValueCollection values)
|
||||
{
|
||||
this.UploadValuesAsync(address, null, values);
|
||||
}
|
||||
|
||||
/// <summary>Uploads the data in the specified name/value collection to the resource identified by the specified URI, using the specified method. This method does not block the calling thread.</summary>
|
||||
/// <param name="address">The URI of the resource to receive the collection. This URI must identify a resource that can accept a request sent with the <paramref name="method" /> method.</param>
|
||||
/// <param name="method">The method used to send the string to the resource. If null, the default is POST for http and STOR for ftp.</param>
|
||||
/// <param name="data">The <see cref="T:System.Collections.Specialized.NameValueCollection" /> to send to the resource.</param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="data" /> is null. -or- <paramref name="address" /> is null.</exception>
|
||||
/// <exception cref="T:System.Net.WebException">The URI formed by combining <see cref="P:System.Net.WebClient.BaseAddress" /> and <paramref name="address" /> is invalid.-or- There was no response from the server hosting the resource.-or-<paramref name="method" /> cannot be used to send content.</exception>
|
||||
// Token: 0x06001610 RID: 5648 RVA: 0x0004758C File Offset: 0x0004578C
|
||||
public void UploadValuesAsync(global::System.Uri address, string method, global::System.Collections.Specialized.NameValueCollection values)
|
||||
{
|
||||
this.UploadValuesAsync(address, method, values, null);
|
||||
}
|
||||
|
||||
/// <summary>Uploads the data in the specified name/value collection to the resource identified by the specified URI, using the specified method. This method does not block the calling thread, and allows the caller to pass an object to the method that is invoked when the operation completes.</summary>
|
||||
/// <param name="address">The URI of the resource to receive the collection. This URI must identify a resource that can accept a request sent with the <paramref name="method" /> method.</param>
|
||||
/// <param name="method">The HTTP method used to send the string to the resource. If null, the default is POST for http and STOR for ftp.</param>
|
||||
/// <param name="data">The <see cref="T:System.Collections.Specialized.NameValueCollection" /> to send to the resource.</param>
|
||||
/// <param name="userToken">A user-defined object that is passed to the method invoked when the asynchronous operation completes.</param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="data" /> is null. -or- <paramref name="address" /> is null.</exception>
|
||||
/// <exception cref="T:System.Net.WebException">The URI formed by combining <see cref="P:System.Net.WebClient.BaseAddress" /> and <paramref name="address" /> is invalid.-or- There was no response from the server hosting the resource.-or-<paramref name="method" /> cannot be used to send content.</exception>
|
||||
// Token: 0x06001611 RID: 5649 RVA: 0x00047598 File Offset: 0x00045798
|
||||
public void UploadValuesAsync(global::System.Uri address, string method, global::System.Collections.Specialized.NameValueCollection values, object userToken)
|
||||
{
|
||||
if (address == null)
|
||||
{
|
||||
throw new ArgumentNullException("address");
|
||||
}
|
||||
if (values == null)
|
||||
{
|
||||
throw new ArgumentNullException("values");
|
||||
}
|
||||
lock (this)
|
||||
{
|
||||
this.CheckBusy();
|
||||
this.async = true;
|
||||
this.async_thread = new Thread(delegate(object state)
|
||||
{
|
||||
object[] array2 = (object[])state;
|
||||
try
|
||||
{
|
||||
byte[] array3 = this.UploadValuesCore((global::System.Uri)array2[0], (string)array2[1], (global::System.Collections.Specialized.NameValueCollection)array2[2], array2[3]);
|
||||
this.OnUploadValuesCompleted(new UploadValuesCompletedEventArgs(array3, null, false, array2[3]));
|
||||
}
|
||||
catch (ThreadInterruptedException)
|
||||
{
|
||||
this.OnUploadValuesCompleted(new UploadValuesCompletedEventArgs(null, null, true, array2[3]));
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
this.OnUploadValuesCompleted(new UploadValuesCompletedEventArgs(null, ex, false, array2[3]));
|
||||
}
|
||||
});
|
||||
object[] array = new object[] { address, method, values, userToken };
|
||||
this.async_thread.Start(array);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Raises the <see cref="E:System.Net.WebClient.DownloadDataCompleted" /> event.</summary>
|
||||
/// <param name="e">A <see cref="T:System.Net.DownloadDataCompletedEventArgs" /> object that contains event data.</param>
|
||||
// Token: 0x06001612 RID: 5650 RVA: 0x00047648 File Offset: 0x00045848
|
||||
protected virtual void OnDownloadDataCompleted(DownloadDataCompletedEventArgs args)
|
||||
{
|
||||
this.CompleteAsync();
|
||||
if (this.DownloadDataCompleted != null)
|
||||
{
|
||||
this.DownloadDataCompleted(this, args);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Raises the <see cref="E:System.Net.WebClient.DownloadFileCompleted" /> event.</summary>
|
||||
/// <param name="e">An <see cref="T:System.ComponentModel.AsyncCompletedEventArgs" /> object containing event data.</param>
|
||||
// Token: 0x06001613 RID: 5651 RVA: 0x00047668 File Offset: 0x00045868
|
||||
protected virtual void OnDownloadFileCompleted(global::System.ComponentModel.AsyncCompletedEventArgs args)
|
||||
{
|
||||
this.CompleteAsync();
|
||||
if (this.DownloadFileCompleted != null)
|
||||
{
|
||||
this.DownloadFileCompleted(this, args);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Raises the <see cref="E:System.Net.WebClient.DownloadProgressChanged" /> event.</summary>
|
||||
/// <param name="e">A <see cref="T:System.Net.DownloadProgressChangedEventArgs" /> object containing event data.</param>
|
||||
// Token: 0x06001614 RID: 5652 RVA: 0x00047688 File Offset: 0x00045888
|
||||
protected virtual void OnDownloadProgressChanged(DownloadProgressChangedEventArgs e)
|
||||
{
|
||||
if (this.DownloadProgressChanged != null)
|
||||
{
|
||||
this.DownloadProgressChanged(this, e);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Raises the <see cref="E:System.Net.WebClient.DownloadStringCompleted" /> event.</summary>
|
||||
/// <param name="e">A <see cref="T:System.Net.DownloadStringCompletedEventArgs" /> object containing event data.</param>
|
||||
// Token: 0x06001615 RID: 5653 RVA: 0x000476A4 File Offset: 0x000458A4
|
||||
protected virtual void OnDownloadStringCompleted(DownloadStringCompletedEventArgs args)
|
||||
{
|
||||
this.CompleteAsync();
|
||||
if (this.DownloadStringCompleted != null)
|
||||
{
|
||||
this.DownloadStringCompleted(this, args);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Raises the <see cref="E:System.Net.WebClient.OpenReadCompleted" /> event.</summary>
|
||||
/// <param name="e">A <see cref="T:System.Net.OpenReadCompletedEventArgs" /> object containing event data.</param>
|
||||
// Token: 0x06001616 RID: 5654 RVA: 0x000476C4 File Offset: 0x000458C4
|
||||
protected virtual void OnOpenReadCompleted(OpenReadCompletedEventArgs args)
|
||||
{
|
||||
this.CompleteAsync();
|
||||
if (this.OpenReadCompleted != null)
|
||||
{
|
||||
this.OpenReadCompleted(this, args);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Raises the <see cref="E:System.Net.WebClient.OpenWriteCompleted" /> event.</summary>
|
||||
/// <param name="e">A <see cref="T:System.Net.OpenWriteCompletedEventArgs" /> object containing event data.</param>
|
||||
// Token: 0x06001617 RID: 5655 RVA: 0x000476E4 File Offset: 0x000458E4
|
||||
protected virtual void OnOpenWriteCompleted(OpenWriteCompletedEventArgs args)
|
||||
{
|
||||
this.CompleteAsync();
|
||||
if (this.OpenWriteCompleted != null)
|
||||
{
|
||||
this.OpenWriteCompleted(this, args);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Raises the <see cref="E:System.Net.WebClient.UploadDataCompleted" /> event.</summary>
|
||||
/// <param name="e">A <see cref="T:System.Net.UploadDataCompletedEventArgs" /> object containing event data.</param>
|
||||
// Token: 0x06001618 RID: 5656 RVA: 0x00047704 File Offset: 0x00045904
|
||||
protected virtual void OnUploadDataCompleted(UploadDataCompletedEventArgs args)
|
||||
{
|
||||
this.CompleteAsync();
|
||||
if (this.UploadDataCompleted != null)
|
||||
{
|
||||
this.UploadDataCompleted(this, args);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Raises the <see cref="E:System.Net.WebClient.UploadFileCompleted" /> event.</summary>
|
||||
/// <param name="e">An <see cref="T:System.Net.UploadFileCompletedEventArgs" /> object containing event data.</param>
|
||||
// Token: 0x06001619 RID: 5657 RVA: 0x00047724 File Offset: 0x00045924
|
||||
protected virtual void OnUploadFileCompleted(UploadFileCompletedEventArgs args)
|
||||
{
|
||||
this.CompleteAsync();
|
||||
if (this.UploadFileCompleted != null)
|
||||
{
|
||||
this.UploadFileCompleted(this, args);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Raises the <see cref="E:System.Net.WebClient.UploadProgressChanged" /> event.</summary>
|
||||
/// <param name="e">An <see cref="T:System.Net.UploadProgressChangedEventArgs" /> object containing event data.</param>
|
||||
// Token: 0x0600161A RID: 5658 RVA: 0x00047744 File Offset: 0x00045944
|
||||
protected virtual void OnUploadProgressChanged(UploadProgressChangedEventArgs e)
|
||||
{
|
||||
if (this.UploadProgressChanged != null)
|
||||
{
|
||||
this.UploadProgressChanged(this, e);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Raises the <see cref="E:System.Net.WebClient.UploadStringCompleted" /> event.</summary>
|
||||
/// <param name="e">An <see cref="T:System.Net.UploadStringCompletedEventArgs" /> object containing event data.</param>
|
||||
// Token: 0x0600161B RID: 5659 RVA: 0x00047760 File Offset: 0x00045960
|
||||
protected virtual void OnUploadStringCompleted(UploadStringCompletedEventArgs args)
|
||||
{
|
||||
this.CompleteAsync();
|
||||
if (this.UploadStringCompleted != null)
|
||||
{
|
||||
this.UploadStringCompleted(this, args);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Raises the <see cref="E:System.Net.WebClient.UploadValuesCompleted" /> event.</summary>
|
||||
/// <param name="e">A <see cref="T:System.Net.UploadValuesCompletedEventArgs" /> object containing event data.</param>
|
||||
// Token: 0x0600161C RID: 5660 RVA: 0x00047780 File Offset: 0x00045980
|
||||
protected virtual void OnUploadValuesCompleted(UploadValuesCompletedEventArgs args)
|
||||
{
|
||||
this.CompleteAsync();
|
||||
if (this.UploadValuesCompleted != null)
|
||||
{
|
||||
this.UploadValuesCompleted(this, args);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Returns the <see cref="T:System.Net.WebResponse" /> for the specified <see cref="T:System.Net.WebRequest" /> using the specified <see cref="T:System.IAsyncResult" />.</summary>
|
||||
/// <returns>A <see cref="T:System.Net.WebResponse" /> containing the response for the specified <see cref="T:System.Net.WebRequest" />.</returns>
|
||||
/// <param name="request">A <see cref="T:System.Net.WebRequest" /> that is used to obtain the response.</param>
|
||||
/// <param name="result">An <see cref="T:System.IAsyncResult" /> object obtained from a previous call to <see cref="M:System.Net.WebRequest.BeginGetResponse(System.AsyncCallback,System.Object)" /> .</param>
|
||||
// Token: 0x0600161D RID: 5661 RVA: 0x000477A0 File Offset: 0x000459A0
|
||||
protected virtual WebResponse GetWebResponse(WebRequest request, IAsyncResult result)
|
||||
{
|
||||
WebResponse webResponse = request.EndGetResponse(result);
|
||||
this.responseHeaders = webResponse.Headers;
|
||||
return webResponse;
|
||||
}
|
||||
|
||||
/// <summary>Returns a <see cref="T:System.Net.WebRequest" /> object for the specified resource.</summary>
|
||||
/// <returns>A new <see cref="T:System.Net.WebRequest" /> object for the specified resource.</returns>
|
||||
/// <param name="address">A <see cref="T:System.Uri" /> that identifies the resource to request.</param>
|
||||
// Token: 0x0600161E RID: 5662 RVA: 0x000477C4 File Offset: 0x000459C4
|
||||
protected virtual WebRequest GetWebRequest(global::System.Uri address)
|
||||
{
|
||||
return WebRequest.Create(address);
|
||||
}
|
||||
|
||||
/// <summary>Returns the <see cref="T:System.Net.WebResponse" /> for the specified <see cref="T:System.Net.WebRequest" />.</summary>
|
||||
/// <returns>A <see cref="T:System.Net.WebResponse" /> containing the response for the specified <see cref="T:System.Net.WebRequest" />.</returns>
|
||||
/// <param name="request">A <see cref="T:System.Net.WebRequest" /> that is used to obtain the response. </param>
|
||||
// Token: 0x0600161F RID: 5663 RVA: 0x000477CC File Offset: 0x000459CC
|
||||
protected virtual WebResponse GetWebResponse(WebRequest request)
|
||||
{
|
||||
WebResponse response = request.GetResponse();
|
||||
this.responseHeaders = response.Headers;
|
||||
return response;
|
||||
}
|
||||
|
||||
// Token: 0x040011F1 RID: 4593
|
||||
private static readonly string urlEncodedCType = "application/x-www-form-urlencoded";
|
||||
|
||||
// Token: 0x040011F2 RID: 4594
|
||||
private static byte[] hexBytes = new byte[16];
|
||||
|
||||
// Token: 0x040011F3 RID: 4595
|
||||
private ICredentials credentials;
|
||||
|
||||
// Token: 0x040011F4 RID: 4596
|
||||
private WebHeaderCollection headers;
|
||||
|
||||
// Token: 0x040011F5 RID: 4597
|
||||
private WebHeaderCollection responseHeaders;
|
||||
|
||||
// Token: 0x040011F6 RID: 4598
|
||||
private global::System.Uri baseAddress;
|
||||
|
||||
// Token: 0x040011F7 RID: 4599
|
||||
private string baseString;
|
||||
|
||||
// Token: 0x040011F8 RID: 4600
|
||||
private global::System.Collections.Specialized.NameValueCollection queryString;
|
||||
|
||||
// Token: 0x040011F9 RID: 4601
|
||||
private bool is_busy;
|
||||
|
||||
// Token: 0x040011FA RID: 4602
|
||||
private bool async;
|
||||
|
||||
// Token: 0x040011FB RID: 4603
|
||||
private Thread async_thread;
|
||||
|
||||
// Token: 0x040011FC RID: 4604
|
||||
private Encoding encoding = Encoding.Default;
|
||||
|
||||
// Token: 0x040011FD RID: 4605
|
||||
private IWebProxy proxy;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user