Exemplo n.º 1
0
        public async Task <YandexDiskDirectory> GetDirectoryAsync(UPath relativePath, System.Threading.CancellationToken cancellation)
        {
            var path   = _path.GetCopy().AppendSelf(relativePath).ToString();
            var answer = await YandexDisk.PerformListRequestAsync(_publicUrl, path, cancellation);

            return(new YandexDiskDirectory(answer, _publicUrl));
        }
Exemplo n.º 2
0
        public async Task <Stream> OpenAsync(FileOpenMode mode, CancellationToken cancellation)
        {
            if (mode != FileOpenMode.OPEN_OR_NEW)
            {
                throw new NotSupportedException();
            }

            var raw = await YandexDisk.PerformDownloadRequestAsync(_publicUrl, _rawData.path, cancellation);

            var file = await Utils.DownloadAsync(raw.href, cancellation);

            return(new MemoryStream(file));
        }