//Write from buffer to secondary stream //Write from buffer to primary stream public override void Write(byte[] buffer, int offset, int count) { try { //write buffer to secondary stream Secondary.Write(buffer, offset, count); } catch (Exception ex) { throw new TeeException(ex); } //write buffer to primary stream Primary.Write(buffer, offset, count); }
//Read from primary stream into buffer //Write buffer to secondary stream public override int Read(byte[] buffer, int offset, int count) { //read into buffer from primary stream int read = Primary.Read(buffer, offset, count); try { //write buffer to secondary stream Secondary.Write(buffer, offset, read); } catch (Exception ex) { throw new TeeException(ex); } return(read); }