CK.Monitoring.CKMonWriterClient.IActivityMonitorBoundClient C# (CSharp) Method

IActivityMonitorBoundClient() private method

private IActivityMonitorBoundClient ( IActivityMonitorImpl source, bool forceBuggyRemove ) : void
source IActivityMonitorImpl
forceBuggyRemove bool
return void
        void IActivityMonitorBoundClient.SetMonitor( IActivityMonitorImpl source, bool forceBuggyRemove )
        {
            if( source != null && _source != null ) throw ActivityMonitorClient.CreateMultipleRegisterOnBoundClientException( this );
            // Silently ignore null => null or monitor => same monitor.
            if( source != _source )
            {
                _prevLogType = LogEntryType.None;
                _prevlogTime = DateTimeStamp.Unknown;
                Debug.Assert( (source == null) != (_source == null) );
                if( (_source = source) == null )
                {
                    if( _file != null ) _file.Close();
                    _file = null;
                }
                else
                {
                    // If initialization failed, we let the file null: this monitor will not
                    // work (the error will appear in the Critical errors) but this avoids
                    // an exception to be thrown here.
                    var f = new MonitorBinaryFileOutput( _path, ((IUniqueId)_source).UniqueId, _maxCountPerFile, _useGzipCompression );
                    if( f.Initialize( new SystemActivityMonitor( false, null ) ) )
                    {
                        var g = _source.CurrentGroup;
                        _currentGroupDepth = g != null ? g.Depth : 0;
                        _file = f;
                    }
                }
            }
        }
        /// <summary>