Represents SFTP file information
Exemplo n.º 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.");
 }
Exemplo n.º 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.");
 }
Exemplo n.º 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.");
 }
Exemplo n.º 4
0
 private ClientItemType _ItemTypeOf(SftpFile f)
 {
     if (f.IsDirectory)
         return ClientItemType.Folder;
     if (f.IsRegularFile)
         return ClientItemType.File;
     return ClientItemType.Other;
 }
Exemplo n.º 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
         };
 }
Exemplo n.º 6
0
 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;
 }
Exemplo n.º 7
0
 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);
     }
 }
Exemplo n.º 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.");
 }
Exemplo n.º 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.");
 }
Exemplo n.º 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;
 }
Exemplo n.º 11
0
 public SftpVirtualFile(SftpVirtualPathProvider owningProvider, IVirtualDirectory directory, SftpFile file)
     : this(owningProvider, directory, file.Name, file.LastWriteTime)
 {
     this.Provider = owningProvider;
     this._file = file;
 }
Exemplo n.º 12
0
 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;
 }
Exemplo n.º 13
0
 public SftpVirtualDirectory(SftpVirtualPathProvider owningProvider, IVirtualDirectory parentDirectory, SftpFile file)
     : this(owningProvider, parentDirectory, file.Name, file.LastWriteTime)
 {
     File = file;
 }