Exemplo n.º 1
0
        ///////////////////////////////////////////////////////////////////////////////////////////////

        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;
            }
        }
Exemplo n.º 2
0
        ///////////////////////////////////////////////////////////////////////////////////////////////

        public void Close()
        {
            CheckDisposed();

            CloseReadersAndWriters(true);

            if (stream != null)
            {
                stream.Close();
                stream = null;
            }
        }
Exemplo n.º 3
0
        ///////////////////////////////////////////////////////////////////////////////////////////////

#if NET_40 && CONSOLE
        private static Stream GetInnerStream(
            Stream stream
            )
        {
            ChannelStream channelStream = stream as ChannelStream;

            if (channelStream == null)
            {
                return(null);
            }

            return(channelStream.GetStream());
        }
Exemplo n.º 4
0
        ///////////////////////////////////////////////////////////////////////////////////////////////

        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;
        }
Exemplo n.º 5
0
        ///////////////////////////////////////////////////////////////////////////////////////////////

#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;
        }
Exemplo n.º 6
0
        ///////////////////////////////////////////////////////////////////////////////////////////////

        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;
        }