Exemple #1
0
        public async Task <bool> Exists(string fileToken)
        {
            FileToken token = FileToken.Parse(fileToken, _fileStoreName);

            using (var c = GetNewClient())
            {
                return(await c.FileExistsAsync(token.Path));
            }
        }
Exemple #2
0
        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);
        }
Exemple #3
0
        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);
        }
Exemple #4
0
        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));
        }
Exemple #5
0
        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);
                }
            }
        }
Exemple #6
0
        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)));
        }
Exemple #7
0
        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)));
        }
Exemple #9
0
        public Task <string> GetFileName(string fileToken)
        {
            FileToken token = FileToken.Parse(fileToken, _fileStoreName);

            return(Task.FromResult(token.Path.GetFtpFileName()));
        }
Exemple #10
0
 public async Task <bool> Exists(string fileToken)
 {
     return(await Exists(FileToken.Parse(fileToken, _fileStoreName)));
 }