FtpWebResponse.cs :  » 2.6.4-mono-.net-core » System.Net » System » Net » C# / CSharp Open Source

Home
C# / CSharp Open Source
1.2.6.4 mono .net core
2.2.6.4 mono core
3.Aspect Oriented Frameworks
4.Bloggers
5.Build Systems
6.Business Application
7.Charting Reporting Tools
8.Chat Servers
9.Code Coverage Tools
10.Content Management Systems CMS
11.CRM ERP
12.Database
13.Development
14.Email
15.Forum
16.Game
17.GIS
18.GUI
19.IDEs
20.Installers Generators
21.Inversion of Control Dependency Injection
22.Issue Tracking
23.Logging Tools
24.Message
25.Mobile
26.Network Clients
27.Network Servers
28.Office
29.PDF
30.Persistence Frameworks
31.Portals
32.Profilers
33.Project Management
34.RSS RDF
35.Rule Engines
36.Script
37.Search Engines
38.Sound Audio
39.Source Control
40.SQL Clients
41.Template Engines
42.Testing
43.UML
44.Web Frameworks
45.Web Service
46.Web Testing
47.Wiki Engines
48.Windows Presentation Foundation
49.Workflows
50.XML Parsers
C# / C Sharp
C# / C Sharp by API
C# / CSharp Tutorial
C# / CSharp Open Source » 2.6.4 mono .net core » System.Net 
System.Net » System » Net » FtpWebResponse.cs
//
// System.Net.FtpWebResponse.cs
//
// Authors:
//  Carlos Alberto Cortez (calberto.cortez@gmail.com)
//
// (c) Copyright 2006 Novell, Inc. (http://www.novell.com)
//

using System;
using System.IO;
using System.Runtime.Serialization;
using System.Net;

#if NET_2_0

namespace System.Net{
  public class FtpWebResponse : WebResponse
  {
    Stream stream;
    Uri uri;
    FtpStatusCode statusCode;
    DateTime lastModified = DateTime.MinValue;
    string bannerMessage = String.Empty;
    string welcomeMessage = String.Empty;
    string exitMessage = String.Empty;
    string statusDescription;
    string method;
    //bool keepAlive;
    bool disposed;
    FtpWebRequest request;
    internal long contentLength = -1;
    
    internal FtpWebResponse (FtpWebRequest request, Uri uri, string method, bool keepAlive)
    {
      this.request = request;
      this.uri = uri;
      this.method = method;
      //this.keepAlive = keepAlive;
    }

    internal FtpWebResponse (FtpWebRequest request, Uri uri, string method, FtpStatusCode statusCode, string statusDescription)
    {
      this.request = request;
      this.uri = uri;
      this.method = method;
      this.statusCode = statusCode;
      this.statusDescription = statusDescription;
    }

    internal FtpWebResponse (FtpWebRequest request, Uri uri, string method, FtpStatus status) :
      this (request, uri, method, status.StatusCode, status.StatusDescription)
    {
    }
    
    public override long ContentLength {
      get {
        return contentLength;
      }
    }

    public override WebHeaderCollection Headers {
      get {
        return new WebHeaderCollection ();
      }
    }

    public override Uri ResponseUri {
      get {
        return uri;
      }
    }

    public DateTime LastModified {
      get {
        return lastModified;
      }
      internal set {
        lastModified = value;
      }
    }

    public string BannerMessage {
      get {
        return bannerMessage;
      }
      internal set {
        bannerMessage = value;
      }
    }
    
    public string WelcomeMessage {
      get {
        return welcomeMessage;
      }
      internal set {
        welcomeMessage = value;
      }
    }

    public string ExitMessage {
      get {
        return exitMessage;
      }
      internal set {
        exitMessage = value;
      }
    }

    public FtpStatusCode StatusCode {
      get {
        return statusCode;
      }
      private set {
        statusCode = value;
      }
    }

    public string StatusDescription {
      get {
        return statusDescription;
      }
      private set {
        statusDescription = value;
      }
    }
    
    public override void Close ()
    {
      if (disposed)
        return;
      
      disposed = true;
      if (stream != null) {
        stream.Close ();
        if (stream == Stream.Null)
          request.OperationCompleted ();
      }
      stream = null;
    }

    public override Stream GetResponseStream ()
    {
      if (stream == null)
        return Stream.Null; // After a STOR we get this
      
      if (method != WebRequestMethods.Ftp.DownloadFile &&
          method != WebRequestMethods.Ftp.ListDirectory)
        CheckDisposed ();
      
      return stream;
    }

    internal Stream Stream {
      set {
        stream = value;
      }

      get { return stream; }
    }

    internal void UpdateStatus (FtpStatus status) {
      statusCode = status.StatusCode;
      statusDescription = status.StatusDescription;
    }

    void CheckDisposed ()
    {
      if (disposed)
        throw new ObjectDisposedException (GetType ().FullName);
    }

    internal bool IsFinal () {
      return ((int) statusCode >= 200);
    }
  }
}

#endif

www.java2v.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.