Ejemplo n.º 1
0
 private SftpObjectDatabase(SftpObjectDatabase parent, string p, TransportSftp instance)
 {
     this._instance = instance;
     try
     {
         _ftp = instance.NewSftp();
         _ftp.ChangeDirectory(parent._objectsPath);
         _ftp.ChangeDirectory(p);
         _objectsPath = _ftp.CurrentDirectory();
     }
     catch (TransportException)
     {
         CleanUp();
         throw;
     }
     catch (Exception je)
     {
         throw new TransportException("Can't enter " + p + " from " + parent._objectsPath + ": " + je.Message, je);
     }
 }
Ejemplo n.º 2
0
            private void CleanUp()
            {
                if (_ftp != null)
                {
                    try
                    {
                        if (_ftp.IsConnected)
                            _ftp.Disconnect();
                    }
                    finally
                    {
                        _ftp = null;
                    }
                }
#if DEBUG
                GC.SuppressFinalize(this); // Disarm lock-release checker
#endif
            }
Ejemplo n.º 3
0
            public SftpObjectDatabase(string path, TransportSftp instance)
            {
                this._instance = instance;

                if (path.StartsWith("/~"))
                {
                    path = path.Substring(1);
                }

                if (path.StartsWith("~/"))
                {
                    path = path.Substring(2);
                }

                try
                {
                    _ftp = instance.NewSftp();
                    _ftp.ChangeDirectory(path);
                    _ftp.ChangeDirectory("objects");
                    _objectsPath = _ftp.CurrentDirectory();
                }
                catch (TransportException)
                {
                    CleanUp();
                    throw;
                }
                catch (Exception je)
                {
                    throw new TransportException("Can't enter " + path + "/objects: " + je.Message, je);
                }
            }