public FtpStorageFolder(string folder, FtpListItem ftpItem) { DateCreated = ftpItem.RawCreated < DateTime.FromFileTimeUtc(0) ? DateTimeOffset.MinValue : ftpItem.RawCreated; Name = ftpItem.Name; Path = PathNormalization.Combine(folder, ftpItem.Name); FtpPath = FtpHelpers.GetFtpPath(Path); }
public FtpStorageFolder(FtpItem ftpItem) { DateCreated = ftpItem.ItemDateCreatedReal; Name = ftpItem.ItemName; Path = ftpItem.ItemPath; FtpPath = FtpHelpers.GetFtpPath(ftpItem.ItemPath); }
public override IAsyncOperation <IStorageItem> GetItemAsync(string name) { return(AsyncInfo.Run <IStorageItem>(async(cancellationToken) => { using var ftpClient = new FtpClient(); ftpClient.Host = FtpHelpers.GetFtpHost(Path); ftpClient.Port = FtpHelpers.GetFtpPort(Path); ftpClient.Credentials = FtpManager.Credentials.Get(ftpClient.Host, FtpManager.Anonymous); if (!await ftpClient.EnsureConnectedAsync()) { return null; } var item = await ftpClient.GetObjectInfoAsync(FtpHelpers.GetFtpPath(PathNormalization.Combine(Path, name))); if (item != null) { if (item.Type == FtpFileSystemObjectType.File) { return new FtpStorageFile(Path, item); } else if (item.Type == FtpFileSystemObjectType.Directory) { return new FtpStorageFolder(Path, item); } } return null; })); }
public FtpStorageFile(string path, string name, DateTimeOffset dateCreated) { Path = path; Name = name; FtpPath = FtpHelpers.GetFtpPath(path); DateCreated = dateCreated; }
public FtpStorageFolder(IStorageItemWithPath item) { Name = System.IO.Path.GetFileName(item.Path); Path = item.Path; FtpPath = FtpHelpers.GetFtpPath(item.Path); }
public FtpStorageFile(IStorageItemWithPath item) { Path = item.Path; Name = IO.Path.GetFileName(item.Path); FtpPath = FtpHelpers.GetFtpPath(item.Path); }