public SftpFolder(ISftpDataSource source, Renci.SshNet.Sftp.SftpFile file, CoreDispatcher dispatcher) : base(source, file, dispatcher) { if (!file.IsDirectory) { throw new ArgumentException("The SFTP item is not a directory."); } }
public static SftpItemBase Factory(Renci.SshNet.Sftp.SftpFile sftpFile, ISftpDataSource source, CoreDispatcher dispatcher) { if (sftpFile.IsDirectory) { return(new SftpFolder(source, sftpFile, dispatcher) { ImagePath = "Assets/BlankFolder.png" }); } else { return(new SftpFile(source, sftpFile, dispatcher) { ImagePath = "Assets/Document.png" }); } }
public SftpFile(ISftpDataSource source, Renci.SshNet.Sftp.SftpFile sftpFile, CoreDispatcher dispatcher) : base(source, sftpFile, dispatcher) { if (sftpFile.IsDirectory) { throw new ArgumentException("The SFTP item is a directory."); } this.Size = (ulong)this.SftpFile.Length; var contentTypeCommand = this.SftpDataSource.SshClient.CreateCommand(string.Format("file -b --mime-type \"{0}\"", this.Path)); this.contentTypeTask = contentTypeCommand.ExecuteAsync().ContinueWith(async contentType => { this.ContentType = (await contentType).TrimEnd('\r', '\n'); }); }
public SftpItemBase(ISftpDataSource source, Renci.SshNet.Sftp.SftpFile file, CoreDispatcher dispatcher) : base(dispatcher) { this.SftpDataSource = source; this.SftpFile = file; }