internal static TReturn Execute <TReturn>(RSExecutionConnection connection, ProxyMethod <TReturn> initialMethod, ProxyMethod <TReturn> retryMethod)
 {
     using (MonitoredScope.NewConcat("ProxyMethodInvocation.Execute - Method : ", initialMethod.MethodName))
     {
         if (connection == null)
         {
             throw new ArgumentNullException("connection");
         }
         if (initialMethod == null)
         {
             throw new ArgumentNullException("initialMethod");
         }
         ProxyMethod <TReturn>[] array = (retryMethod != null && !connection.CanUseKatmaiMethods) ? new ProxyMethod <TReturn>[1]
         {
             retryMethod
         } : ((retryMethod != null) ? new ProxyMethod <TReturn>[2]
         {
             initialMethod,
             retryMethod
         } : new ProxyMethod <TReturn>[1]
         {
             initialMethod
         });
         for (int i = 0; i < array.Length; i++)
         {
             ProxyMethod <TReturn> proxyMethod = array[i];
             try
             {
                 if (!string.IsNullOrEmpty(proxyMethod.MethodName))
                 {
                     connection.SetConnectionSSLForMethod(proxyMethod.MethodName);
                 }
                 return(proxyMethod.Method());
             }
             catch (FaultException e)
             {
                 if (i < array.Length - 1 && connection.CheckForDownlevelRetry(e))
                 {
                     connection.MarkAsFailedUsingKatmai();
                     continue;
                 }
                 connection.OnSoapException(e);
                 throw;
             }
             catch (WebException e2)
             {
                 MissingEndpointException.ThrowIfEndpointMissing(e2);
                 throw;
             }
             catch (InvalidOperationException inner)
             {
                 throw new MissingEndpointException(inner);
             }
         }
         throw new InvalidOperationException("Failed to execute method");
     }
 }
 internal static TReturn Execute <TReturn>(RSExecutionConnection connection, ProxyMethod <TReturn> sql16Method, ProxyMethod <TReturn> katmaiMethod, ProxyMethod <TReturn> yukonMethod)
 {
     using (MonitoredScope.NewConcat("ProxyMethodInvocation.Execute - Method : ", katmaiMethod.MethodName))
     {
         if (connection == null)
         {
             throw new ArgumentNullException("connection");
         }
         if (katmaiMethod == null)
         {
             throw new ArgumentNullException("initialMethod");
         }
         bool flag  = yukonMethod != null;
         bool flag2 = katmaiMethod != null;
         ProxyMethod <TReturn>[] array = (flag && !connection.CanUseKatmaiMethods && !connection.CanUseSql16Methods) ? new ProxyMethod <TReturn>[1]
         {
             yukonMethod
         } : ((!(!flag && flag2) || connection.CanUseSql16Methods) ? new ProxyMethod <TReturn>[3]
         {
             sql16Method,
             katmaiMethod,
             yukonMethod
         } : new ProxyMethod <TReturn>[1]
         {
             katmaiMethod
         });
         for (int i = 0; i < array.Length; i++)
         {
             ProxyMethod <TReturn> proxyMethod = array[i];
             try
             {
                 if (!string.IsNullOrEmpty(proxyMethod.MethodName))
                 {
                     connection.SetConnectionSSLForMethod(proxyMethod.MethodName);
                 }
                 return(proxyMethod.Method());
             }
             catch (FaultException e)
             {
                 if (i < array.Length - 1 && connection.CheckForDownlevelRetry(e))
                 {
                     if (connection.m_endpointVersion == EndpointVersion.Katmai)
                     {
                         connection.MarkAsFailedUsingKatmai();
                     }
                     else if (connection.m_endpointVersion == EndpointVersion.Sql16)
                     {
                         connection.MarkAsFailedUsingSql16();
                     }
                     continue;
                 }
                 connection.OnSoapException(e);
                 throw;
             }
             catch (WebException e2)
             {
                 MissingEndpointException.ThrowIfEndpointMissing(e2);
                 throw;
             }
             catch (InvalidOperationException inner)
             {
                 throw new MissingEndpointException(inner);
             }
         }
         throw new InvalidOperationException("Failed to execute method");
     }
 }