Пример #1
0
        public async Task PutAsync(CachedImageResult cachedImage, byte[] buffer)
        {
            if (PreparePut(cachedImage, buffer))
            {
                var path = BuildPath(cachedImage.Path);

                // save file
                if (cachedImage.Extension == "svg")
                {
                    await _fileSystem.WriteAllTextAsync(path, Encoding.UTF8.GetString(buffer));
                }
                else
                {
                    await _fileSystem.WriteAllBytesAsync(path, buffer);
                }

                // Refresh info
                cachedImage.Exists = true;
                cachedImage.File   = _fileSystem.GetFile(path);
            }
        }