public override Task SaveAsync(CancellationToken token) { if (_saved) { throw new InvalidOperationException("Already saved"); } BodyStream.Dispose(); File.Move(_tempPath, Path); _saved = true; return(Task.FromResult((object)null)); }
public void Dispose() { BodyStream?.Dispose(); if (!IsSaved && File.Exists(TempPath)) { try { File.Delete(TempPath); } catch { // This was opportunistic at best // if we can't delete it, there isn't anything good to do } } }
public void Dispose() { BodyStream?.Dispose(); }