/////////////////////////////////////////////////////////////////////////////////////////////// private /* protected virtual */ void Dispose(bool disposing) { if (!disposed) { if (disposing) { //////////////////////////////////// // dispose managed resources here... //////////////////////////////////// CloseReadersAndWriters(true); /////////////////////////////////////////////////////////////////////////////////// if (stream != null) { stream.Dispose(); stream = null; } } ////////////////////////////////////// // release unmanaged resources here... ////////////////////////////////////// disposed = true; } }
/////////////////////////////////////////////////////////////////////////////////////////////// public void Close() { CheckDisposed(); CloseReadersAndWriters(true); if (stream != null) { stream.Close(); stream = null; } }
/////////////////////////////////////////////////////////////////////////////////////////////// #if NET_40 && CONSOLE private static Stream GetInnerStream( Stream stream ) { ChannelStream channelStream = stream as ChannelStream; if (channelStream == null) { return(null); } return(channelStream.GetStream()); }
/////////////////////////////////////////////////////////////////////////////////////////////// public Channel( ChannelStream stream, Encoding encoding, bool appendMode, bool autoFlush, IClientData clientData ) : this() { this.stream = stream; this.encoding = encoding; this.appendMode = appendMode; this.autoFlush = autoFlush; this.clientData = clientData; }
/////////////////////////////////////////////////////////////////////////////////////////////// #if NETWORK public Channel( TcpListener listener, ChannelType channelType, OptionDictionary options, StreamFlags flags, IClientData clientData ) : this() { this.stream = new ChannelStream( listener, channelType, options, flags); this.encoding = null; this.appendMode = false; this.autoFlush = false; this.clientData = clientData; }
/////////////////////////////////////////////////////////////////////////////////////////////// public Channel( Stream stream, ChannelType channelType, OptionDictionary options, StreamFlags flags, StreamTranslation inTranslation, StreamTranslation outTranslation, Encoding encoding, bool appendMode, bool autoFlush, IClientData clientData ) : this() { this.stream = new ChannelStream( stream, channelType, options, flags, inTranslation, outTranslation); this.encoding = encoding; this.appendMode = appendMode; this.autoFlush = autoFlush; this.clientData = clientData; }