Disassembled CarotDav v1.14.7 with dotPeek 2017.2
This commit is contained in:
231
Rei.Fs/FooteredWriteStream.cs
Normal file
231
Rei.Fs/FooteredWriteStream.cs
Normal file
@@ -0,0 +1,231 @@
|
||||
// Decompiled with JetBrains decompiler
|
||||
// Type: Rei.Fs.FooteredWriteStream
|
||||
// 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 Microsoft.VisualBasic.CompilerServices;
|
||||
using System;
|
||||
using System.IO;
|
||||
|
||||
namespace Rei.Fs
|
||||
{
|
||||
public class FooteredWriteStream : Stream
|
||||
{
|
||||
private Stream pBaseStream;
|
||||
private byte[] pfooter;
|
||||
private bool pHasError;
|
||||
private bool pDisposed;
|
||||
|
||||
public FooteredWriteStream(Stream basestream, byte[] footer)
|
||||
{
|
||||
this.pHasError = false;
|
||||
this.pDisposed = false;
|
||||
this.pBaseStream = basestream;
|
||||
this.pfooter = footer;
|
||||
}
|
||||
|
||||
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
|
||||
{
|
||||
try
|
||||
{
|
||||
this.pBaseStream.Position = value;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
ProjectData.SetProjectError(ex);
|
||||
this.pHasError = true;
|
||||
throw;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
try
|
||||
{
|
||||
return this.pBaseStream.Read(buffer, offset, count);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
ProjectData.SetProjectError(ex);
|
||||
this.pHasError = true;
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
public override long Seek(long offset, SeekOrigin origin)
|
||||
{
|
||||
try
|
||||
{
|
||||
return this.pBaseStream.Seek(offset, origin);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
ProjectData.SetProjectError(ex);
|
||||
this.pHasError = true;
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
public override void SetLength(long value)
|
||||
{
|
||||
try
|
||||
{
|
||||
this.pBaseStream.SetLength(value);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
ProjectData.SetProjectError(ex);
|
||||
this.pHasError = true;
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
public override void Write(byte[] buffer, int offset, int count)
|
||||
{
|
||||
try
|
||||
{
|
||||
this.pBaseStream.Write(buffer, offset, count);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
ProjectData.SetProjectError(ex);
|
||||
this.pHasError = true;
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
public override void Flush()
|
||||
{
|
||||
try
|
||||
{
|
||||
this.pBaseStream.Flush();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
ProjectData.SetProjectError(ex);
|
||||
this.pHasError = true;
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (!disposing || this.pDisposed)
|
||||
return;
|
||||
this.pDisposed = true;
|
||||
if (this.pHasError)
|
||||
{
|
||||
try
|
||||
{
|
||||
this.pBaseStream.Close();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
ProjectData.SetProjectError(ex);
|
||||
ProjectData.ClearProjectError();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
try
|
||||
{
|
||||
this.pBaseStream.Write(this.pfooter, 0, this.pfooter.Length);
|
||||
}
|
||||
catch (Exception ex1)
|
||||
{
|
||||
ProjectData.SetProjectError(ex1);
|
||||
try
|
||||
{
|
||||
this.pBaseStream.Close();
|
||||
}
|
||||
catch (Exception ex2)
|
||||
{
|
||||
ProjectData.SetProjectError(ex2);
|
||||
ProjectData.ClearProjectError();
|
||||
}
|
||||
throw;
|
||||
}
|
||||
this.pBaseStream.Close();
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user