public override void Write(byte[] buffer, int offset, int count)
{
lock (OutputStreams)
{
IsLastWriteSuccessful = true;
if (count > 0 && IsRecordEnabled)
{
byte[] add = new byte[count];
Buffer.BlockCopy(buffer, offset, add, 0, count);
Trace.TraceInformation("Write() : add chunk for {0}", RuntimeHelpers.GetHashCode(this));
internalBuffer.Add(add);
}
List<Stream> streamsBroken = new List<Stream>();
foreach (var stream in OutputStreams)
{
try
{
Trace.TraceInformation("Write() : write data for {0}", RuntimeHelpers.GetHashCode(this));
stream.Write(buffer, offset, count);
}
catch (IOException)
{
IsLastWriteSuccessful = false;
streamsBroken.Add(stream);
}
}
foreach (var stream in streamsBroken)
{
OutputStreams.Remove(stream);
Trace.TraceInformation("AddStream() : Remove stream for {0}", RuntimeHelpers.GetHashCode(this));
}
}
}