public override void Close() { try { if (UseBaseStream) { base.Close(); } else { if (CryptoReadStream != null) { UseBaseStream = true; try { CryptoReadStream.Close(); } catch (System.Security.Cryptography.CryptographicException) { // Nothing to do. } catch (System.Exception ex) { throw ex; } UseBaseStream = false; } if (CryptoWriteStream != null) { UseBaseStream = true; try { CryptoWriteStream.Close(); } catch (System.Security.Cryptography.CryptographicException) { // Nothing to do. } catch (System.Exception ex) { throw ex; } UseBaseStream = false; } } } catch (System.Exception ex) { throw ex; } }
public override void Write(byte[] array, int offset, int count) { try { if (UseBaseStream) { base.Write(array, offset, count); } else { UseBaseStream = true; CryptoWriteStream.Write(array, offset, count); UseBaseStream = false; } } catch (System.Exception ex) { throw ex; } }
public override void Flush() { try { if (UseBaseStream) { base.Flush(); } else { UseBaseStream = true; CryptoWriteStream.Flush(); UseBaseStream = false; } } catch (System.Exception ex) { throw ex; } }
public override void WriteByte(byte value) { try { if (UseBaseStream) { base.WriteByte(value); } else { UseBaseStream = true; CryptoWriteStream.WriteByte(value); UseBaseStream = false; } } catch (System.Exception ex) { throw ex; } }
protected override void Dispose(bool disposing) { try { if (disposing) { if (CryptoReadStream != null) { if (!UseBaseStream) { UseBaseStream = true; CryptoReadStream.Dispose(); CryptoReadStream = null; UseBaseStream = false; } } if (CryptoWriteStream != null) { if (!UseBaseStream) { UseBaseStream = true; CryptoWriteStream.Dispose(); CryptoWriteStream = null; UseBaseStream = false; } } if (DES != null) { DES = null; } } base.Dispose(disposing); } catch (System.Exception ex) { throw ex; } }