Exemple #1
0
        internal void FtpUploadHelper(IWebOperation ftpWebOperation, string localFilePath, int maximumLength, string username, string password, FtpMode ftpMode)
        {
            if (ftpWebOperation == null)
            {
                throw new ArgumentNullException("ftpWebOperation");
            }
            if (String.IsNullOrEmpty(localFilePath))
            {
                throw new ArgumentException("Argument 'localFilePath' cannot be a null or empty string.");
            }

            ftpWebOperation.WebRequest.CachePolicy = new RequestCachePolicy(RequestCacheLevel.NoCacheNoStore);
            ((IFtpWebRequest)ftpWebOperation.WebRequest).SetFtpMode(ftpMode);
            ftpWebOperation.WebRequest.SetNetworkCredentials(username, password);
            ftpWebOperation.Upload(localFilePath, maximumLength);
        }
Exemple #2
0
        internal void FtpUploadHelper(IWebOperation ftpWebOperation, Stream localStream, int maximumLength, string username, string password, FtpMode ftpMode)
        {
            if (ftpWebOperation == null)
            {
                throw new ArgumentNullException("ftpWebOperation");
            }
            if (localStream == null)
            {
                throw new ArgumentNullException("localStream");
            }

            ftpWebOperation.WebRequest.CachePolicy = new RequestCachePolicy(RequestCacheLevel.NoCacheNoStore);
            ((IFtpWebRequest)ftpWebOperation.WebRequest).SetFtpMode(ftpMode);
            ftpWebOperation.WebRequest.SetNetworkCredentials(username, password);

            if (maximumLength >= 0 && localStream.Length >= maximumLength)
            {
                localStream.Position = localStream.Length - maximumLength;
            }
            ftpWebOperation.Upload(localStream);
        }
Exemple #3
0
      internal void FtpUploadHelper(IWebOperation ftpWebOperation, Stream localStream, int maximumLength, string username, string password, FtpMode ftpMode)
      {
         if (ftpWebOperation == null) throw new ArgumentNullException("ftpWebOperation");
         if (localStream == null) throw new ArgumentNullException("localStream");

         ftpWebOperation.WebRequest.CachePolicy = new RequestCachePolicy(RequestCacheLevel.NoCacheNoStore);
         ((IFtpWebRequest)ftpWebOperation.WebRequest).SetFtpMode(ftpMode);
         ftpWebOperation.WebRequest.SetNetworkCredentials(username, password);

         if (maximumLength >= 0 && localStream.Length >= maximumLength)
         {
            localStream.Position = localStream.Length - maximumLength;
         }
         ftpWebOperation.Upload(localStream);
      }
Exemple #4
0
      internal void FtpUploadHelper(IWebOperation ftpWebOperation, string localFilePath, int maximumLength, string username, string password, FtpMode ftpMode)
      {
         if (ftpWebOperation == null) throw new ArgumentNullException("ftpWebOperation");
         if (String.IsNullOrEmpty(localFilePath)) throw new ArgumentException("Argument 'localFilePath' cannot be a null or empty string.");

         ftpWebOperation.WebRequest.CachePolicy = new RequestCachePolicy(RequestCacheLevel.NoCacheNoStore);
         ((IFtpWebRequest)ftpWebOperation.WebRequest).SetFtpMode(ftpMode);
         ftpWebOperation.WebRequest.SetNetworkCredentials(username, password);
         ftpWebOperation.Upload(localFilePath, maximumLength);
      }