// Token: 0x06000038 RID: 56 RVA: 0x00003C00 File Offset: 0x00001E00
            protected override bool TryRunInternal(Action code, ref ExceptionHandler.ExceptionData args)
            {
                bool      retry     = false;
                bool      result    = false;
                Exception exception = null;

                try
                {
                    GrayException.MapAndReportGrayExceptions(delegate()
                    {
                        try
                        {
                            code();
                            result = true;
                        }
                        catch (TransientException exception2)
                        {
                            retry     = true;
                            exception = exception2;
                        }
                        catch (LocalizedException exception3)
                        {
                            exception = exception3;
                        }
                    });
                }
                catch (GrayException exception)
                {
                    GrayException exception4;
                    exception = exception4;
                }
                args.ShouldRetry = retry;
                args.Exception   = exception;
                return(result);
            }
            // Token: 0x0600003E RID: 62 RVA: 0x00003EC0 File Offset: 0x000020C0
            protected override bool TryRunInternal(Action code, ref ExceptionHandler.ExceptionData args)
            {
                bool      shouldRetry = false;
                bool      result      = false;
                Exception exception   = null;

                try
                {
                    GrayException.MapAndReportGrayExceptions(delegate()
                    {
                        code();
                        result = true;
                    });
                }
                catch (GrayException ex)
                {
                    exception = ex;
                }
                args.ShouldRetry = shouldRetry;
                args.Exception   = exception;
                return(result);
            }
            // Token: 0x0600003A RID: 58 RVA: 0x00003D24 File Offset: 0x00001F24
            protected override bool TryRunInternal(Action code, ref ExceptionHandler.ExceptionData args)
            {
                bool      retry     = false;
                bool      result    = false;
                Exception exception = null;

                try
                {
                    GrayException.MapAndReportGrayExceptions(delegate()
                    {
                        try
                        {
                            code();
                            result = true;
                        }
                        catch (TimeoutException exception2)
                        {
                            retry     = true;
                            exception = exception2;
                        }
                        catch (CommunicationException ex)
                        {
                            if (ex is ServerTooBusyException || ex is RetryException || ex is ChannelTerminatedException || ex is CommunicationObjectAbortedException || ex is CommunicationObjectFaultedException || ex is SecurityNegotiationException)
                            {
                                retry = true;
                            }
                            exception = ex;
                        }
                    });
                }
                catch (GrayException exception)
                {
                    GrayException exception3;
                    exception = exception3;
                }
                args.ShouldRetry = retry;
                args.Exception   = exception;
                return(result);
            }
 // Token: 0x0600002D RID: 45
 protected abstract bool TryRunInternal(Action code, ref ExceptionHandler.ExceptionData args);
        // Token: 0x0600002C RID: 44 RVA: 0x00003848 File Offset: 0x00001A48
        public virtual bool TryRun(Action code, TimeSpan duration, out FaultDefinition faultDefinition, ComplianceMessage context = null, Action <ExceptionHandler.ExceptionData> exceptionHandler = null, CancellationToken cancelToken = default(CancellationToken), double[] retrySchedule = null, [CallerMemberName] string callerMember = null, [CallerFilePath] string callerFilePath = null, [CallerLineNumber] int callerLineNumber = 0)
        {
            bool result2;

            try
            {
                if (retrySchedule == null)
                {
                    retrySchedule = new double[]
                    {
                        10.0,
                        20.0,
                        30.0
                    };
                }
                int  num = 0;
                long elapsedMilliseconds            = ExceptionHandler.watch.ElapsedMilliseconds;
                ExceptionHandler.ExceptionData args = new ExceptionHandler.ExceptionData
                {
                    Exception   = null,
                    RetryCount  = num,
                    ShouldRetry = false,
                    Context     = context
                };
                for (;;)
                {
                    args.RetryCount = num;
                    bool result = false;
                    ExWatson.SendReportOnUnhandledException(delegate()
                    {
                        result = this.TryRunInternal(code, ref args);
                    });
                    if (result)
                    {
                        break;
                    }
                    if (exceptionHandler != null)
                    {
                        exceptionHandler(args);
                    }
                    if (!args.ShouldRetry)
                    {
                        goto IL_17D;
                    }
                    int num2 = (int)(duration.TotalMilliseconds * (retrySchedule[(num >= retrySchedule.Length) ? (retrySchedule.Length - 1) : num] / 100.0));
                    if (num2 > 0)
                    {
                        faultDefinition = FaultDefinition.FromException(args.Exception, true, args.ShouldRetry, callerMember, callerFilePath, callerLineNumber);
                        ExceptionHandler.FaultMessage(context, faultDefinition, false);
                        if (cancelToken.WaitHandle.WaitOne(num2))
                        {
                            goto IL_17D;
                        }
                    }
                    num++;
                    if ((double)(ExceptionHandler.watch.ElapsedMilliseconds - elapsedMilliseconds) >= duration.TotalMilliseconds || elapsedMilliseconds == ExceptionHandler.watch.ElapsedMilliseconds)
                    {
                        goto IL_17D;
                    }
                }
                faultDefinition = null;
                return(true);

IL_17D:
                faultDefinition = new FaultDefinition();
                FaultRecord faultRecord = new FaultRecord();
                faultDefinition.Faults.TryAdd(faultRecord);
                faultRecord.Data["RC"]    = args.RetryCount.ToString();
                faultRecord.Data["TEX"]   = args.ShouldRetry.ToString();
                faultRecord.Data["EFILE"] = callerFilePath;
                faultRecord.Data["EFUNC"] = callerMember;
                faultRecord.Data["ELINE"] = callerLineNumber.ToString();
                if (args.Exception != null)
                {
                    faultRecord.Data["EX"] = args.Exception.ToString();
                    LocalizedException ex = args.Exception as LocalizedException;
                    if (ex != null)
                    {
                        faultRecord.Data["UM"] = ex.Message;
                    }
                }
                faultDefinition = FaultDefinition.FromException(args.Exception, true, args.ShouldRetry, callerMember, callerFilePath, callerLineNumber);
                ExceptionHandler.FaultMessage(context, faultDefinition, false);
                result2 = false;
            }
            catch (Exception error)
            {
                faultDefinition = FaultDefinition.FromException(error, true, false, callerMember, callerFilePath, callerLineNumber);
                ExceptionHandler.FaultMessage(context, faultDefinition, true);
                throw;
            }
            return(result2);
        }