scripts
This commit is contained in:
@@ -0,0 +1,191 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Runtime.Serialization;
|
||||
|
||||
namespace System.Net
|
||||
{
|
||||
/// <summary>Provides a file system implementation of the <see cref="T:System.Net.WebResponse" /> class.</summary>
|
||||
// Token: 0x0200021C RID: 540
|
||||
[Serializable]
|
||||
public class FileWebResponse : WebResponse, IDisposable, ISerializable
|
||||
{
|
||||
// Token: 0x0600126A RID: 4714 RVA: 0x00037A44 File Offset: 0x00035C44
|
||||
internal FileWebResponse(global::System.Uri responseUri, FileStream fileStream)
|
||||
{
|
||||
try
|
||||
{
|
||||
this.responseUri = responseUri;
|
||||
this.fileStream = fileStream;
|
||||
this.contentLength = fileStream.Length;
|
||||
this.webHeaders = new WebHeaderCollection();
|
||||
this.webHeaders.Add("Content-Length", Convert.ToString(this.contentLength));
|
||||
this.webHeaders.Add("Content-Type", "application/octet-stream");
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw new WebException(ex.Message, ex);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Initializes a new instance of the <see cref="T:System.Net.FileWebResponse" /> class from the specified instances of the <see cref="T:System.Runtime.Serialization.SerializationInfo" /> and <see cref="T:System.Runtime.Serialization.StreamingContext" /> classes.</summary>
|
||||
/// <param name="serializationInfo">A <see cref="T:System.Runtime.Serialization.SerializationInfo" /> instance that contains the information required to serialize the new <see cref="T:System.Net.FileWebResponse" /> instance. </param>
|
||||
/// <param name="streamingContext">An instance of the <see cref="T:System.Runtime.Serialization.StreamingContext" /> class that contains the source of the serialized stream associated with the new <see cref="T:System.Net.FileWebResponse" /> instance. </param>
|
||||
// Token: 0x0600126B RID: 4715 RVA: 0x00037AE0 File Offset: 0x00035CE0
|
||||
[Obsolete("Serialization is obsoleted for this type", false)]
|
||||
protected FileWebResponse(SerializationInfo serializationInfo, StreamingContext streamingContext)
|
||||
{
|
||||
this.responseUri = (global::System.Uri)serializationInfo.GetValue("responseUri", typeof(global::System.Uri));
|
||||
this.contentLength = serializationInfo.GetInt64("contentLength");
|
||||
this.webHeaders = (WebHeaderCollection)serializationInfo.GetValue("webHeaders", typeof(WebHeaderCollection));
|
||||
}
|
||||
|
||||
/// <summary>Populates a <see cref="T:System.Runtime.Serialization.SerializationInfo" /> instance with the data needed to serialize the <see cref="T:System.Net.FileWebResponse" />.</summary>
|
||||
/// <param name="serializationInfo">A <see cref="T:System.Runtime.Serialization.SerializationInfo" /> , which will hold the serialized data for the <see cref="T:System.Net.FileWebResponse" />. </param>
|
||||
/// <param name="streamingContext">A <see cref="T:System.Runtime.Serialization.StreamingContext" /> containing the destination of the serialized stream associated with the new <see cref="T:System.Net.FileWebResponse" />. </param>
|
||||
// Token: 0x0600126C RID: 4716 RVA: 0x00037B48 File Offset: 0x00035D48
|
||||
void ISerializable.GetObjectData(SerializationInfo serializationInfo, StreamingContext streamingContext)
|
||||
{
|
||||
this.GetObjectData(serializationInfo, streamingContext);
|
||||
}
|
||||
|
||||
/// <summary>Releases all resources used by the <see cref="T:System.Net.FileWebResponse" />.</summary>
|
||||
// Token: 0x0600126D RID: 4717 RVA: 0x00037B54 File Offset: 0x00035D54
|
||||
void IDisposable.Dispose()
|
||||
{
|
||||
this.Dispose(true);
|
||||
GC.SuppressFinalize(this);
|
||||
}
|
||||
|
||||
/// <summary>Gets the length of the content in the file system resource.</summary>
|
||||
/// <returns>The number of bytes returned from the file system resource.</returns>
|
||||
// Token: 0x170005FB RID: 1531
|
||||
// (get) Token: 0x0600126E RID: 4718 RVA: 0x00037B64 File Offset: 0x00035D64
|
||||
public override long ContentLength
|
||||
{
|
||||
get
|
||||
{
|
||||
this.CheckDisposed();
|
||||
return this.contentLength;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Gets the content type of the file system resource.</summary>
|
||||
/// <returns>The value "binary/octet-stream".</returns>
|
||||
// Token: 0x170005FC RID: 1532
|
||||
// (get) Token: 0x0600126F RID: 4719 RVA: 0x00037B74 File Offset: 0x00035D74
|
||||
public override string ContentType
|
||||
{
|
||||
get
|
||||
{
|
||||
this.CheckDisposed();
|
||||
return "application/octet-stream";
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Gets a collection of header name/value pairs associated with the response.</summary>
|
||||
/// <returns>A <see cref="T:System.Net.WebHeaderCollection" /> that contains the header name/value pairs associated with the response.</returns>
|
||||
// Token: 0x170005FD RID: 1533
|
||||
// (get) Token: 0x06001270 RID: 4720 RVA: 0x00037B84 File Offset: 0x00035D84
|
||||
public override WebHeaderCollection Headers
|
||||
{
|
||||
get
|
||||
{
|
||||
this.CheckDisposed();
|
||||
return this.webHeaders;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Gets the URI of the file system resource that provided the response.</summary>
|
||||
/// <returns>A <see cref="T:System.Uri" /> that contains the URI of the file system resource that provided the response.</returns>
|
||||
// Token: 0x170005FE RID: 1534
|
||||
// (get) Token: 0x06001271 RID: 4721 RVA: 0x00037B94 File Offset: 0x00035D94
|
||||
public override global::System.Uri ResponseUri
|
||||
{
|
||||
get
|
||||
{
|
||||
this.CheckDisposed();
|
||||
return this.responseUri;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Populates a <see cref="T:System.Runtime.Serialization.SerializationInfo" /> with the data needed to serialize the target object.</summary>
|
||||
/// <param name="serializationInfo">The <see cref="T:System.Runtime.Serialization.SerializationInfo" /> to populate with data. </param>
|
||||
/// <param name="streamingContext">A <see cref="T:System.Runtime.Serialization.StreamingContext" /> that specifies the destination for this serialization.</param>
|
||||
// Token: 0x06001272 RID: 4722 RVA: 0x00037BA4 File Offset: 0x00035DA4
|
||||
protected override void GetObjectData(SerializationInfo serializationInfo, StreamingContext streamingContext)
|
||||
{
|
||||
serializationInfo.AddValue("responseUri", this.responseUri, typeof(global::System.Uri));
|
||||
serializationInfo.AddValue("contentLength", this.contentLength);
|
||||
serializationInfo.AddValue("webHeaders", this.webHeaders, typeof(WebHeaderCollection));
|
||||
}
|
||||
|
||||
/// <summary>Returns the data stream from the file system resource.</summary>
|
||||
/// <returns>A <see cref="T:System.IO.Stream" /> for reading data from the file system resource.</returns>
|
||||
// Token: 0x06001273 RID: 4723 RVA: 0x00037BFC File Offset: 0x00035DFC
|
||||
public override Stream GetResponseStream()
|
||||
{
|
||||
this.CheckDisposed();
|
||||
return this.fileStream;
|
||||
}
|
||||
|
||||
// Token: 0x06001274 RID: 4724 RVA: 0x00037C0C File Offset: 0x00035E0C
|
||||
~FileWebResponse()
|
||||
{
|
||||
this.Dispose(false);
|
||||
}
|
||||
|
||||
/// <summary>Closes the response stream.</summary>
|
||||
// Token: 0x06001275 RID: 4725 RVA: 0x00037C48 File Offset: 0x00035E48
|
||||
public override void Close()
|
||||
{
|
||||
((IDisposable)this).Dispose();
|
||||
}
|
||||
|
||||
/// <summary>Releases the unmanaged resources used by the <see cref="T:System.Net.FileWebResponse" /> and optionally releases the managed resources.</summary>
|
||||
/// <param name="disposing">true to release both managed and unmanaged resources; false to release only unmanaged resources. </param>
|
||||
// Token: 0x06001276 RID: 4726 RVA: 0x00037C50 File Offset: 0x00035E50
|
||||
private void Dispose(bool disposing)
|
||||
{
|
||||
if (this.disposed)
|
||||
{
|
||||
return;
|
||||
}
|
||||
this.disposed = true;
|
||||
if (disposing)
|
||||
{
|
||||
this.responseUri = null;
|
||||
this.webHeaders = null;
|
||||
}
|
||||
FileStream fileStream = this.fileStream;
|
||||
this.fileStream = null;
|
||||
if (fileStream != null)
|
||||
{
|
||||
fileStream.Close();
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x06001277 RID: 4727 RVA: 0x00037CA0 File Offset: 0x00035EA0
|
||||
private void CheckDisposed()
|
||||
{
|
||||
if (this.disposed)
|
||||
{
|
||||
throw new ObjectDisposedException(base.GetType().FullName);
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x04000FCD RID: 4045
|
||||
private global::System.Uri responseUri;
|
||||
|
||||
// Token: 0x04000FCE RID: 4046
|
||||
private FileStream fileStream;
|
||||
|
||||
// Token: 0x04000FCF RID: 4047
|
||||
private long contentLength;
|
||||
|
||||
// Token: 0x04000FD0 RID: 4048
|
||||
private WebHeaderCollection webHeaders;
|
||||
|
||||
// Token: 0x04000FD1 RID: 4049
|
||||
private bool disposed;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user