// Token: 0x06002491 RID: 9361 RVA: 0x000ACAB0 File Offset: 0x000AACB0
        internal SourceDatabasePerformanceCountersInstance(string instanceName, SourceDatabasePerformanceCountersInstance autoUpdateTotalInstance) : base(instanceName, "MSExchangeRepl Source Database")
        {
            bool flag = false;
            List <ExPerformanceCounter> list = new List <ExPerformanceCounter>();

            try
            {
                this.TotalBytesSent = new ExPerformanceCounter(base.CategoryName, "Total Bytes Sent", instanceName, (autoUpdateTotalInstance == null) ? null : autoUpdateTotalInstance.TotalBytesSent, new ExPerformanceCounter[0]);
                list.Add(this.TotalBytesSent);
                this.AverageWriteTime = new ExPerformanceCounter(base.CategoryName, "Avg. Network sec/Write", instanceName, (autoUpdateTotalInstance == null) ? null : autoUpdateTotalInstance.AverageWriteTime, new ExPerformanceCounter[0]);
                list.Add(this.AverageWriteTime);
                this.AverageWriteTimeBase = new ExPerformanceCounter(base.CategoryName, "AverageWriteTimeBase", instanceName, (autoUpdateTotalInstance == null) ? null : autoUpdateTotalInstance.AverageWriteTimeBase, new ExPerformanceCounter[0]);
                list.Add(this.AverageWriteTimeBase);
                this.AverageReadTime = new ExPerformanceCounter(base.CategoryName, "Avg. Disk sec/Read", instanceName, (autoUpdateTotalInstance == null) ? null : autoUpdateTotalInstance.AverageReadTime, new ExPerformanceCounter[0]);
                list.Add(this.AverageReadTime);
                this.AverageReadTimeBase = new ExPerformanceCounter(base.CategoryName, "AverageReadTimeBase", instanceName, (autoUpdateTotalInstance == null) ? null : autoUpdateTotalInstance.AverageReadTimeBase, new ExPerformanceCounter[0]);
                list.Add(this.AverageReadTimeBase);
                this.WriteThruput = new ExPerformanceCounter(base.CategoryName, "Network Write Bytes/sec", instanceName, (autoUpdateTotalInstance == null) ? null : autoUpdateTotalInstance.WriteThruput, new ExPerformanceCounter[0]);
                list.Add(this.WriteThruput);
                long num = this.TotalBytesSent.RawValue;
                num += 1L;
                flag = true;
            }
            finally
            {
                if (!flag)
                {
                    foreach (ExPerformanceCounter exPerformanceCounter in list)
                    {
                        exPerformanceCounter.Close();
                    }
                }
            }
            this.counters = list.ToArray();
        }
        internal void SendLog(long logGen, NetworkChannel channel, SourceDatabasePerformanceCountersInstance perfCounters)
        {
            ReplayStopwatch replayStopwatch = new ReplayStopwatch();

            replayStopwatch.Start();
            string    text = this.BuildLogFileName(logGen);
            Exception ex   = null;

            try
            {
                using (SafeFileHandle safeFileHandle = LogCopy.OpenLogForRead(text))
                {
                    try
                    {
                        JET_LOGINFOMISC jet_LOGINFOMISC;
                        UnpublishedApi.JetGetLogFileInfo(text, out jet_LOGINFOMISC, JET_LogInfo.Misc2);
                        if (logGen != 0L && (long)jet_LOGINFOMISC.ulGeneration != logGen)
                        {
                            FileCheckLogfileGenerationException ex2 = new FileCheckLogfileGenerationException(text, (long)jet_LOGINFOMISC.ulGeneration, logGen);
                            CorruptLogDetectedException         ex3 = new CorruptLogDetectedException(text, ex2.Message, ex2);
                            throw new FileIOonSourceException(Environment.MachineName, text, ex3.Message, ex3);
                        }
                        JET_SIGNATURE?jet_SIGNATURE = null;
                        lock (this.m_sigLock)
                        {
                            if (this.m_logfileSignature == null)
                            {
                                this.m_logfileSignature = new JET_SIGNATURE?(jet_LOGINFOMISC.signLog);
                            }
                            jet_SIGNATURE = this.m_logfileSignature;
                        }
                        if (!jet_LOGINFOMISC.signLog.Equals(jet_SIGNATURE))
                        {
                            FileCheckLogfileSignatureException ex4 = new FileCheckLogfileSignatureException(text, jet_LOGINFOMISC.signLog.ToString(), jet_SIGNATURE.Value.ToString());
                            CorruptLogDetectedException        ex5 = new CorruptLogDetectedException(text, ex4.Message, ex4);
                            throw new FileIOonSourceException(Environment.MachineName, text, ex5.Message, ex5);
                        }
                    }
                    catch (EsentLogFileCorruptException ex6)
                    {
                        CorruptLogDetectedException ex7 = new CorruptLogDetectedException(text, ex6.Message, ex6);
                        throw new FileIOonSourceException(Environment.MachineName, text, ex7.Message, ex7);
                    }
                    EndOfLog     currentEndOfLog = this.CurrentEndOfLog;
                    CopyLogReply copyLogReply    = new CopyLogReply(channel);
                    copyLogReply.ThisLogGeneration  = logGen;
                    copyLogReply.EndOfLogGeneration = currentEndOfLog.Generation;
                    copyLogReply.EndOfLogUtc        = currentEndOfLog.Utc;
                    CheckSummer summer = null;
                    if (channel.ChecksumDataTransfer)
                    {
                        summer = new CheckSummer();
                    }
                    channel.SetupLogChecksummer(this.Config.LogFilePrefix);
                    channel.SendLogFileTransferReply(copyLogReply, text, safeFileHandle, perfCounters, summer);
                    MonitoredDatabase.Tracer.TracePerformance <long>((long)this.GetHashCode(), "CopyLogFile finished streaming after {0}ms.", replayStopwatch.ElapsedMilliseconds);
                }
            }
            catch (IOException ex8)
            {
                ex = ex8;
            }
            catch (UnauthorizedAccessException ex9)
            {
                ex = ex9;
            }
            catch (EsentErrorException ex10)
            {
                ex = ex10;
            }
            if (ex != null)
            {
                ExTraceGlobals.MonitoredDatabaseTracer.TraceError <string, Exception>((long)this.GetHashCode(), "SendLog({0}) failed: {1}", text, ex);
                throw new FileIOonSourceException(Environment.MachineName, text, ex.Message, ex);
            }
        }