Represents SFTP file information
Exemple #1
1
 public void UserIdTest()
 {
     SftpSession sftpSession = null; // TODO: Initialize to an appropriate value
     string fullName = string.Empty; // TODO: Initialize to an appropriate value
     SftpFileAttributes attributes = null; // TODO: Initialize to an appropriate value
     SftpFile target = new SftpFile(sftpSession, fullName, attributes); // TODO: Initialize to an appropriate value
     int expected = 0; // TODO: Initialize to an appropriate value
     int actual;
     target.UserId = expected;
     actual = target.UserId;
     Assert.AreEqual(expected, actual);
     Assert.Inconclusive("Verify the correctness of this test method.");
 }
Exemple #2
0
 public void DeleteTest()
 {
     SftpSession sftpSession = null; // TODO: Initialize to an appropriate value
     string fullName = string.Empty; // TODO: Initialize to an appropriate value
     SftpFileAttributes attributes = null; // TODO: Initialize to an appropriate value
     SftpFile target = new SftpFile(sftpSession, fullName, attributes); // TODO: Initialize to an appropriate value
     target.Delete();
     Assert.Inconclusive("A method that does not return a value cannot be verified.");
 }
Exemple #3
0
 public void GroupCanWriteTest()
 {
     SftpSession sftpSession = null; // TODO: Initialize to an appropriate value
     string fullName = string.Empty; // TODO: Initialize to an appropriate value
     SftpFileAttributes attributes = null; // TODO: Initialize to an appropriate value
     SftpFile target = new SftpFile(sftpSession, fullName, attributes); // TODO: Initialize to an appropriate value
     bool expected = false; // TODO: Initialize to an appropriate value
     bool actual;
     target.GroupCanWrite = expected;
     actual = target.GroupCanWrite;
     Assert.AreEqual(expected, actual);
     Assert.Inconclusive("Verify the correctness of this test method.");
 }
Exemple #4
0
 private ClientItemType _ItemTypeOf(SftpFile f)
 {
     if (f.IsDirectory)
         return ClientItemType.Folder;
     if (f.IsRegularFile)
         return ClientItemType.File;
     return ClientItemType.Other;
 }
Exemple #5
0
 /// <summary>
 /// Convert an SftpFile to a ClientItem
 /// </summary>
 private ClientItem ConvertItem(SftpFile f)
 {
     return new ClientItem
         {
             Name = f.Name,
             FullPath = controller.GetCommonPath(f.FullName, false),
             Type = _ItemTypeOf(f),
             Size = f.Attributes.Size,
             LastWriteTime = f.LastWriteTime
         };
 }
 private RemoteFileInfo CreateFileInfo(SftpFile sftpFile)
 {
     RemoteFileInfo fileInfo = new RemoteFileInfo();
     fileInfo.Name = sftpFile.Name;
     fileInfo.FullName = sftpFile.FullName;
     fileInfo.Extension = Path.GetExtension(sftpFile.FullName);
     fileInfo.IsDirectory = sftpFile.IsDirectory;
     fileInfo.Size = sftpFile.Length;
     fileInfo.ModifiedTime = sftpFile.LastWriteTime;
     return fileInfo;
 }
 private void DownloadFile(SftpClient client, SftpFile file, string directory)
 {
     Console.WriteLine("Downloading {0}", file.FullName);
     using (Stream fileStream = File.OpenWrite(Path.Combine(directory, file.Name)))
     {
         client.DownloadFile(file.FullName, fileStream);
     }
 }
Exemple #8
0
 public void LengthTest()
 {
     SftpSession sftpSession = null; // TODO: Initialize to an appropriate value
     string fullName = string.Empty; // TODO: Initialize to an appropriate value
     SftpFileAttributes attributes = null; // TODO: Initialize to an appropriate value
     SftpFile target = new SftpFile(sftpSession, fullName, attributes); // TODO: Initialize to an appropriate value
     long actual;
     actual = target.Length;
     Assert.Inconclusive("Verify the correctness of this test method.");
 }
Exemple #9
0
 public void LastWriteTimeUtcTest()
 {
     SftpSession sftpSession = null; // TODO: Initialize to an appropriate value
     string fullName = string.Empty; // TODO: Initialize to an appropriate value
     SftpFileAttributes attributes = null; // TODO: Initialize to an appropriate value
     SftpFile target = new SftpFile(sftpSession, fullName, attributes); // TODO: Initialize to an appropriate value
     DateTime expected = new DateTime(); // TODO: Initialize to an appropriate value
     DateTime actual;
     target.LastWriteTimeUtc = expected;
     actual = target.LastWriteTimeUtc;
     Assert.AreEqual(expected, actual);
     Assert.Inconclusive("Verify the correctness of this test method.");
 }
Exemple #10
0
 private static ClientItemType _ItemTypeOf(SftpFile f)
 {
     if (f.IsDirectory)
         return ClientItemType.Folder;
     else if (f.IsRegularFile)
         return ClientItemType.File;
     else
         return ClientItemType.Other;
 }
 public SftpVirtualFile(SftpVirtualPathProvider owningProvider, IVirtualDirectory directory, SftpFile file)
     : this(owningProvider, directory, file.Name, file.LastWriteTime)
 {
     this.Provider = owningProvider;
     this._file = file;
 }
 private IEnumerable<SftpFile> GetFilesRecur(SftpClient ssh, SftpFile sftpDir)
 {
     if (!sftpDir.IsDirectory)
     {
         return new[] {sftpDir};
     }
     var fl = new List<SftpFile>();
     foreach (var sftpFile in ssh.ListDirectory(sftpDir.FullName))
     {
         if (sftpFile.IsRegularFile)
         {
             fl.Add(sftpFile);
         }
         else if (sftpFile.IsDirectory && sftpFile.Name != "." && sftpFile.Name != "..")
         {
             fl.AddRange(GetFilesRecur(ssh, sftpFile));
         }
     }
     return fl;
 }
 public SftpVirtualDirectory(SftpVirtualPathProvider owningProvider, IVirtualDirectory parentDirectory, SftpFile file)
     : this(owningProvider, parentDirectory, file.Name, file.LastWriteTime)
 {
     File = file;
 }