/// <summary>
 /// Constructor
 /// </summary>
 /// <param name="attributes">attributes</param>
 public SFTPFileAttributes(SFTPFileAttributes attributes)
 {
     this._fileSize    = attributes._fileSize;
     this._uid         = attributes._uid;
     this._gid         = attributes._gid;
     this._permissions = attributes._permissions;
     this._atime       = attributes._atime;
     this._mtime       = attributes._mtime;
 }
Beispiel #2
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="attributes">attributes</param>
 public SFTPFileAttributes(SFTPFileAttributes attributes)
 {
     this._fileSize = attributes._fileSize;
     this._uid = attributes._uid;
     this._gid = attributes._gid;
     this._permissions = attributes._permissions;
     this._atime = attributes._atime;
     this._mtime = attributes._mtime;
 }
Beispiel #3
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="fileName">file name</param>
 /// <param name="longName">long name</param>
 /// <param name="attributes">attributes</param>
 public SFTPFileInfo(string fileName, string longName, SFTPFileAttributes attributes)
     : base(attributes)
 {
     this._fileName = fileName;
     this._longName = longName;
 }
Beispiel #4
0
        private bool SFTPDownload_DownloadFile(
                        string remoteFullPath, string fileName, string localFileFullPath,
                        SFTPFileAttributes fileAttr, ref bool overwite)
        {
            if (IsFileTransferCanceled()) {
                Log("Canceled");
                return false;   // cancel
            }

            if (!overwite) {
                bool existence = File.Exists(localFileFullPath);

                if (existence) {
                    DialogResult result = DialogResult.None;
                    this.Invoke((MethodInvoker)delegate() {
                        string caption = SFTPPlugin.Instance.StringResource.GetString("SFTPForm.Confirmation");
                        string format = SFTPPlugin.Instance.StringResource.GetString("SFTPForm.AskOverwriteFormat");
                        string message = String.Format(format, localFileFullPath);

                        using (YesNoAllDialog dialog = new YesNoAllDialog(message, caption)) {
                            result = dialog.ShowDialog(this);
                        }
                    });

                    if (result == DialogResult.Cancel) {
                        Log("Canceled");
                        return false;   // cancel
                    }
                    if (result == DialogResult.No) {
                        Log(" | Skipped: " + localFileFullPath);
                        return true;    // skip
                    }
                    if (result == YesNoAllDialog.YesToAll) {
                        overwite = true;
                    }
                }
            }

            ulong fileSize = fileAttr.FileSize;
            _sftp.DownloadFile(remoteFullPath, localFileFullPath, _fileTransferCancellation,
                delegate(SFTPFileTransferStatus status, ulong transmitted) {
                    ShowProgress(localFileFullPath, fileName, status, fileSize, transmitted);
                });

            if (IsFileTransferCanceled())
                return false;   // canceled
            else
                return true;
        }