Exemplo n.º 1
0
        public void CommitWrite()
        {
            try
            {
                Android.Util.Log.Debug("NETFTP", "connected: " + _client.IsConnected.ToString());
                _stream.Close();
                Android.Util.Log.Debug("NETFTP", "connected: " + _client.IsConnected.ToString());

                //make sure target file does not exist:
                //try
                {
                    if (_client.FileExists(NetFtpFileStorage.IocToUri(_ioc).PathAndQuery))
                    {
                        _client.DeleteFile(NetFtpFileStorage.IocToUri(_ioc).PathAndQuery);
                    }
                }
                //catch (FtpCommandException)
                {
                    //TODO get a new clien? might be stale
                }

                _client.Rename(NetFtpFileStorage.IocToUri(_iocTemp).PathAndQuery,
                               NetFtpFileStorage.IocToUri(_ioc).PathAndQuery);
            }
            catch (FtpCommandException ex)
            {
                throw NetFtpFileStorage.ConvertException(ex);
            }
        }
Exemplo n.º 2
0
        public TransactedWrite(IOConnectionInfo ioc, NetFtpFileStorage fileStorage)
        {
            _ioc           = ioc;
            _iocTemp       = _ioc.CloneDeep();
            _iocTemp.Path += "." + new PwUuid(true).ToHexString().Substring(0, 6) + ".tmp";

            _fileStorage = fileStorage;
        }
Exemplo n.º 3
0
 public Stream OpenFile()
 {
     try
     {
         _client = _fileStorage.GetClient(_ioc, false);
         _stream = _client.OpenWrite(NetFtpFileStorage.IocToUri(_iocTemp).PathAndQuery);
         return(_stream);
     }
     catch (FtpCommandException ex)
     {
         throw NetFtpFileStorage.ConvertException(ex);
     }
 }
Exemplo n.º 4
0
        public void CommitWrite()
        {
            try
            {
                Android.Util.Log.Debug("NETFTP", "connected: " + _client.IsConnected.ToString());
                _stream.Close();
                _stream.Dispose();
                _client.GetReply();

                _client.MoveFile(NetFtpFileStorage.IocToLocalPath(_iocTemp),
                                 NetFtpFileStorage.IocToLocalPath(_ioc));
            }
            catch (FtpCommandException ex)
            {
                throw NetFtpFileStorage.ConvertException(ex);
            }
        }
Exemplo n.º 5
0
 public UntransactedWrite(IOConnectionInfo ioc, NetFtpFileStorage fileStorage)
 {
     _ioc         = ioc;
     _fileStorage = fileStorage;
 }