public async Task <bool> Exists(string fileToken) { FileToken token = FileToken.Parse(fileToken, _fileStoreName); using (var c = GetNewClient()) { return(await c.FileExistsAsync(token.Path)); } }
public Task Delete(string fileToken) { var absolutePath = GetAbsolutePath(FileToken.Parse(fileToken, _fileStoreName)); if (System.IO.File.Exists(absolutePath)) { System.IO.File.Delete(absolutePath); } return(Task.CompletedTask); }
public Task Delete(string fileToken) { var token = FileToken.Parse(fileToken, _fileStoreName); if (System.IO.File.Exists(token.Path)) { System.IO.File.Delete(token.Path); } return(Task.CompletedTask); }
public async Task <Stream> OpenRead(string fileToken) { var token = FileToken.Parse(fileToken, _fileStoreName); if (!await Exists(token)) { throw new FileNotFoundException(); } return(new FileStream(GetAbsolutePath(FileToken.Parse(fileToken, _fileStoreName)), FileMode.Open)); }
public async Task Delete(string fileToken) { FileToken token = FileToken.Parse(fileToken, _fileStoreName); using (var client = GetNewClient()) { if (await client.FileExistsAsync(token.Path)) { await client.DeleteFileAsync(token.Path); } } }
public Task <Stream> OpenWrite(string token) { string localPath = GetAbsolutePath(FileToken.Parse(token, _fileStoreName)); string dir = Path.GetDirectoryName(localPath); if (!Directory.Exists(dir)) { Directory.CreateDirectory(dir); } return(Task.FromResult((Stream) new FileStream(localPath, FileMode.Create))); }
public async Task <Stream> OpenWrite(string token) { var fileToken = FileToken.Parse(token, _fileStoreName); string dir = fileToken.Path.GetFtpDirectoryName(); var client = GetNewClient(); if (!await client.DirectoryExistsAsync(dir)) { await client.CreateDirectoryAsync(dir); } return(await _client.OpenFileWriteStreamAsync(fileToken.Path)); }
public async Task <Stream> OpenRead(string token) { var fileToken = FileToken.Parse(token, _fileStoreName); var client = GetNewClient(); string dir = fileToken.Path.GetFtpDirectoryName(); if (!client.DirectoryExists(dir)) { client.CreateDirectory(dir); } return(new FtpStream(client, await client.OpenReadAsync(fileToken.Path))); }
public Task <string> GetFileName(string fileToken) { FileToken token = FileToken.Parse(fileToken, _fileStoreName); return(Task.FromResult(token.Path.GetFtpFileName())); }
public async Task <bool> Exists(string fileToken) { return(await Exists(FileToken.Parse(fileToken, _fileStoreName))); }