Example #1
0
        protected virtual void Dispose(DisposeReason reason)
        {
            if (!_isDisposed)
            {
                _isDisposed = true;

                if (reason == DisposeReason.Dispose)
                {
                    foreach (var elem in _match)
                    {
                        elem.Value.Dispose();
                    }

                    if (_default != null)
                    {
                        _default.Dispose();
                    }
                }
                else if (reason == DisposeReason.Close)
                {
                    foreach (var elem in _match)
                    {
                        elem.Value.Close();
                    }

                    if (_default != null)
                    {
                        _default.Close();
                    }
                }
            }
        }
Example #2
0
        /// <summary>
        /// Main clean-up code
        /// </summary>
        /// <param name="reason">Disposing reason</param>
        protected virtual void Dispose(DisposeReason reason)
        {
            if (!_isDisposed)
            {
                _isDisposed = true;

                _tokenSource.Cancel();

                if (_readerThread != null)
                {
                    if (reason != DisposeReason.Finalize)
                    {
                        _readerThread.Join();
                    }
                }

                if (reason == DisposeReason.Dispose)
                {
                    _logger.Dispose();
                }
                else if (reason == DisposeReason.Close)
                {
                    _logger.Close();
                }

                _tempStoreLock.Dispose();
            }
        }
Example #3
0
        protected void Dispose(DisposeReason reason)
        {
            if (!_isDisposed)
            {
                _isDisposed = true;

                if (reason == DisposeReason.Dispose)
                {
                    _logger.Dispose();
                }
                else if (reason == DisposeReason.Close)
                {
                    _logger.Close();
                }
            }
        }
Example #4
0
        /// <summary>
        /// Main clean-up code
        /// </summary>
        /// <param name="isUserCall">Is called by user</param>
        /// <param name="isClose">Is called from Close method</param>
        private void Dispose(bool isUserCall, bool isClose)
        {
            if (!_isDisposed)
            {
                _isDisposed = true;

                if (isUserCall)
                {
                    if (_logger != null)
                    {
                        if (isClose)
                        {
                            _logger.Close();
                        }
                        else
                        {
                            _logger.Dispose();
                        }
                    }
                }
            }
        }