Exemple #1
0
        public FtpMediaStream(IngestMedia media, bool forWrite)
        {
            _media = media;
            if (media == null || media.Directory == null)
            {
                throw new ApplicationException();
            }
            Uri uri = new Uri(media.FullPath);

            _client             = new System.Net.FtpClient.FtpClient();
            _client.Credentials = ((IngestDirectory)media.Directory)._getNetworkCredential();
            _client.Host        = uri.Host;
            try
            {
                _client.Connect();
                if (forWrite)
                {
                    _ftpStream = _client.OpenWrite(uri.LocalPath);
                }
                else
                {
                    _ftpStream = _client.OpenRead(uri.LocalPath);
                }
            }
            catch
            {
                _client.Dispose();
                throw;
            }
        }
Exemple #2
0
        public FtpMediaStream(IngestMedia media, bool forWrite)
        {
            if (media?.Directory == null)
            {
                throw new ApplicationException();
            }
            var uri = new Uri(media.FullPath);

            _client = new System.Net.FtpClient.FtpClient
            {
                Credentials = ((IngestDirectory)media.Directory).GetNetworkCredential(),
                Host        = uri.Host
            };
            try
            {
                _client.Connect();
                _ftpStream = forWrite ?
                             _client.OpenWrite(uri.LocalPath) :
                             _client.OpenRead(uri.LocalPath);
            }
            catch
            {
                _client.Dispose();
                throw;
            }
        }
 public FtpMediaStream(IngestMedia media)
 {
     _media = media;
     if (media == null || media.Directory == null)
         throw new ApplicationException();
     Uri uri = new Uri(media.FullPath);
     _client = new System.Net.FtpClient.FtpClient();
     _client.Credentials = media.Directory.NetworkCredential;
     _client.Host = uri.Host;
     try
     {
         _client.Connect();
         _ftpStream = _client.OpenRead(uri.LocalPath);
     }
     catch
     {
         _client.Dispose();
     }
 }