Beispiel #1
0
            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
                    }
                }
            }
Beispiel #3
0
 public void Dispose()
 {
     BodyStream?.Dispose();
 }