public Stream OpenFile() { try { _client = _fileStorage.GetClient(_ioc, false); _stream = _client.OpenWrite(_fileStorage.IocToUri(_iocTemp).PathAndQuery); return(_stream); } catch (FtpCommandException ex) { throw NetFtpFileStorage.ConvertException(ex); } }
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); } }