/// inheritedDoc public override async Task UpdateVersionContentAsync(StoredFileVersion version, Stream stream) { if (stream == null) { throw new Exception($"{nameof(stream)} must not be null"); } var blob = GetBlobClient(GetAzureFileName(version)); // update properties version.FileSize = stream.Length; await VersionRepository.UpdateAsync(version); await blob.UploadAsync(stream, overwrite : true); }
/// inheritedDoc public override async Task UpdateVersionContentAsync(StoredFileVersion version, Stream stream) { if (stream == null) { throw new Exception($"{nameof(stream)} must not be null"); } var filePath = PhysicalFilePath(version); // delete old file if (File.Exists(filePath)) { File.Delete(filePath); } // create directory if missing var dir = Path.GetDirectoryName(filePath); if (string.IsNullOrWhiteSpace(dir)) { throw new Exception($"File path is not specified. Possible reason: ({nameof(ISheshaSettings.UploadFolder)} is not specified)"); } if (!Directory.Exists(dir)) { Directory.CreateDirectory(dir); } // update properties version.FileSize = stream.Length; await VersionRepository.UpdateAsync(version); await using (var fs = new FileStream(filePath, FileMode.Create)) { await stream.CopyToAsync(fs); } }
public virtual async Task UpdateAsync(AppVersion version) { await VersionRepository.UpdateAsync(version); }