199 lines
4.1 KiB
C#
199 lines
4.1 KiB
C#
// Decompiled with JetBrains decompiler
|
|
// Type: Rei.Fs.CloseNotifyStream
|
|
// Assembly: Rei.Fs, Version=1.13.2.8796, Culture=neutral, PublicKeyToken=null
|
|
// MVID: D8B08A8B-697C-4439-9CFF-1BE4EE46F7B0
|
|
// Assembly location: F:\Eigene Dateien\Dropbox\portable Collection\Progs\CarotDAV\Rei.Fs.dll
|
|
|
|
using System;
|
|
using System.IO;
|
|
using System.Runtime.CompilerServices;
|
|
|
|
namespace Rei.Fs
|
|
{
|
|
public class CloseNotifyStream : Stream
|
|
{
|
|
private Stream pBaseStream;
|
|
private long pTotalWrite;
|
|
public object Tag;
|
|
private bool pDisposed;
|
|
|
|
public event EventHandler ClosedEvent;
|
|
|
|
public event EventHandler ClosingEvent;
|
|
|
|
public CloseNotifyStream(Stream basestream)
|
|
{
|
|
this.pDisposed = false;
|
|
this.pBaseStream = basestream;
|
|
this.pTotalWrite = 0L;
|
|
}
|
|
|
|
public Stream BaseStream
|
|
{
|
|
get
|
|
{
|
|
return this.pBaseStream;
|
|
}
|
|
}
|
|
|
|
public long TotalWrite
|
|
{
|
|
get
|
|
{
|
|
return this.pTotalWrite;
|
|
}
|
|
}
|
|
|
|
public override bool CanRead
|
|
{
|
|
get
|
|
{
|
|
return this.pBaseStream.CanRead;
|
|
}
|
|
}
|
|
|
|
public override bool CanSeek
|
|
{
|
|
get
|
|
{
|
|
return this.pBaseStream.CanSeek;
|
|
}
|
|
}
|
|
|
|
public override bool CanWrite
|
|
{
|
|
get
|
|
{
|
|
return this.pBaseStream.CanWrite;
|
|
}
|
|
}
|
|
|
|
public override bool CanTimeout
|
|
{
|
|
get
|
|
{
|
|
return this.pBaseStream.CanTimeout;
|
|
}
|
|
}
|
|
|
|
public override long Length
|
|
{
|
|
get
|
|
{
|
|
return this.pBaseStream.Length;
|
|
}
|
|
}
|
|
|
|
public override long Position
|
|
{
|
|
get
|
|
{
|
|
return this.pBaseStream.Position;
|
|
}
|
|
set
|
|
{
|
|
this.pBaseStream.Position = value;
|
|
}
|
|
}
|
|
|
|
public override int ReadTimeout
|
|
{
|
|
get
|
|
{
|
|
return this.pBaseStream.ReadTimeout;
|
|
}
|
|
set
|
|
{
|
|
this.pBaseStream.ReadTimeout = value;
|
|
}
|
|
}
|
|
|
|
public override int WriteTimeout
|
|
{
|
|
get
|
|
{
|
|
return this.pBaseStream.WriteTimeout;
|
|
}
|
|
set
|
|
{
|
|
this.pBaseStream.WriteTimeout = value;
|
|
}
|
|
}
|
|
|
|
public override int Read(byte[] buffer, int offset, int count)
|
|
{
|
|
return this.pBaseStream.Read(buffer, offset, count);
|
|
}
|
|
|
|
public override IAsyncResult BeginRead(byte[] buffer, int offset, int count, AsyncCallback callback, object state)
|
|
{
|
|
return base.BeginRead(buffer, offset, count, callback, RuntimeHelpers.GetObjectValue(state));
|
|
}
|
|
|
|
public override int EndRead(IAsyncResult asyncResult)
|
|
{
|
|
return base.EndRead(asyncResult);
|
|
}
|
|
|
|
public override long Seek(long offset, SeekOrigin origin)
|
|
{
|
|
return this.pBaseStream.Seek(offset, origin);
|
|
}
|
|
|
|
public override void SetLength(long value)
|
|
{
|
|
this.pBaseStream.SetLength(value);
|
|
}
|
|
|
|
public override void Write(byte[] buffer, int offset, int count)
|
|
{
|
|
this.pTotalWrite = checked (this.pTotalWrite + (long) count);
|
|
this.pBaseStream.Write(buffer, offset, count);
|
|
}
|
|
|
|
public override IAsyncResult BeginWrite(byte[] buffer, int offset, int count, AsyncCallback callback, object state)
|
|
{
|
|
this.pTotalWrite = checked (this.pTotalWrite + (long) count);
|
|
return base.BeginWrite(buffer, offset, count, callback, RuntimeHelpers.GetObjectValue(state));
|
|
}
|
|
|
|
public override void EndWrite(IAsyncResult asyncResult)
|
|
{
|
|
base.EndWrite(asyncResult);
|
|
}
|
|
|
|
public override void Flush()
|
|
{
|
|
this.pBaseStream.Flush();
|
|
}
|
|
|
|
protected override void Dispose(bool disposing)
|
|
{
|
|
try
|
|
{
|
|
if (!disposing || this.pDisposed)
|
|
return;
|
|
this.pDisposed = true;
|
|
try
|
|
{
|
|
EventHandler closingEventEvent = this.ClosingEventEvent;
|
|
if (closingEventEvent != null)
|
|
closingEventEvent((object) this, EventArgs.Empty);
|
|
}
|
|
finally
|
|
{
|
|
this.pBaseStream.Close();
|
|
}
|
|
EventHandler closedEventEvent = this.ClosedEventEvent;
|
|
if (closedEventEvent == null)
|
|
return;
|
|
closedEventEvent((object) this, EventArgs.Empty);
|
|
}
|
|
finally
|
|
{
|
|
base.Dispose(disposing);
|
|
}
|
|
}
|
|
}
|
|
}
|