using System; using System.IO; using System.Runtime.Serialization; namespace System.Net { /// Provides a file system implementation of the class. // 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); } } /// Initializes a new instance of the class from the specified instances of the and classes. /// A instance that contains the information required to serialize the new instance. /// An instance of the class that contains the source of the serialized stream associated with the new instance. // 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)); } /// Populates a instance with the data needed to serialize the . /// A , which will hold the serialized data for the . /// A containing the destination of the serialized stream associated with the new . // Token: 0x0600126C RID: 4716 RVA: 0x00037B48 File Offset: 0x00035D48 void ISerializable.GetObjectData(SerializationInfo serializationInfo, StreamingContext streamingContext) { this.GetObjectData(serializationInfo, streamingContext); } /// Releases all resources used by the . // Token: 0x0600126D RID: 4717 RVA: 0x00037B54 File Offset: 0x00035D54 void IDisposable.Dispose() { this.Dispose(true); GC.SuppressFinalize(this); } /// Gets the length of the content in the file system resource. /// The number of bytes returned from the file system resource. // Token: 0x170005FB RID: 1531 // (get) Token: 0x0600126E RID: 4718 RVA: 0x00037B64 File Offset: 0x00035D64 public override long ContentLength { get { this.CheckDisposed(); return this.contentLength; } } /// Gets the content type of the file system resource. /// The value "binary/octet-stream". // 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"; } } /// Gets a collection of header name/value pairs associated with the response. /// A that contains the header name/value pairs associated with the response. // Token: 0x170005FD RID: 1533 // (get) Token: 0x06001270 RID: 4720 RVA: 0x00037B84 File Offset: 0x00035D84 public override WebHeaderCollection Headers { get { this.CheckDisposed(); return this.webHeaders; } } /// Gets the URI of the file system resource that provided the response. /// A that contains the URI of the file system resource that provided the response. // 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; } } /// Populates a with the data needed to serialize the target object. /// The to populate with data. /// A that specifies the destination for this serialization. // 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)); } /// Returns the data stream from the file system resource. /// A for reading data from the file system resource. // 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); } /// Closes the response stream. // Token: 0x06001275 RID: 4725 RVA: 0x00037C48 File Offset: 0x00035E48 public override void Close() { ((IDisposable)this).Dispose(); } /// Releases the unmanaged resources used by the and optionally releases the managed resources. /// true to release both managed and unmanaged resources; false to release only unmanaged resources. // 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; } }