private RestOperation(string name, RestMethodAttribute attribute, Type returnType, IList<ParameterInfo> parameters)
 {
     this._name = name;
     this._attribute = attribute;
     this._returnType = returnType;
     this._parameterList = parameters;
     if (parameters != null)
     {
         this._parameters = new Dictionary<string, ParameterInfo>();
         foreach (ParameterInfo info in parameters)
         {
             this._parameters[info.Name] = info;
         }
     }
 }
 private static RestOperation CreateAsyncOperation(Type endPointType, MethodInfo beginMethodInfo, RestMethodAttribute attribute)
 {
     MethodInfo endMethodInfo = null;
     if (beginMethodInfo.Name.StartsWith("Begin"))
     {
         string name = "End" + beginMethodInfo.Name.Substring(5);
         BindingFlags bindingAttr = BindingFlags.FlattenHierarchy | BindingFlags.Public | BindingFlags.Instance;
         endMethodInfo = endPointType.GetMethod(name, bindingAttr);
     }
     if (endMethodInfo == null)
     {
         throw new RestException("Invalid RPC method '" + beginMethodInfo.Name + "'. RPC methods in an AsyncRestHandler must be implemented as a pair of Begin/End methods.");
     }
     Type returnType = endMethodInfo.ReturnType;
     ParameterInfo[] parameters = beginMethodInfo.GetParameters();
     bool flag = false;
     if (((beginMethodInfo.ReturnType == typeof(IAsyncResult)) && (parameters != null)) && (parameters.Length >= 2))
     {
         int length = parameters.Length;
         if ((parameters[length - 1].ParameterType == typeof(object)) && (parameters[length - 2].ParameterType == typeof(AsyncCallback)))
         {
             flag = true;
         }
     }
     if (!flag)
     {
         throw new RestException("Invalid RPC method '" + beginMethodInfo.Name + "'. Begin RPC methods in an AsyncHandler must accept an AsyncCallback and an Object as the last two parameters, and return an IAsyncResult.");
     }
     bool flag2 = false;
     if (returnType != typeof(void))
     {
         ParameterInfo[] infoArray2 = endMethodInfo.GetParameters();
         if (((infoArray2 != null) && (infoArray2.Length == 1)) && (infoArray2[0].ParameterType == typeof(IAsyncResult)))
         {
             flag2 = true;
         }
     }
     if (!flag2)
     {
         throw new RestException("Invalid RPC method '" + endMethodInfo.Name + "'. End RPC methods in an AsyncHandler must accept an IAsyncResult and return a value.");
     }
     List<ParameterInfo> list = null;
     int num2 = parameters.Length - 2;
     if (num2 != 0)
     {
         list = new List<ParameterInfo>();
         foreach (ParameterInfo info2 in parameters)
         {
             if (info2.IsOut)
             {
                 throw new RestException("Invalid RPC method '" + beginMethodInfo.Name + "'. RPC parameters cannot be marked as out or ref.");
             }
             list.Add(info2);
             if (list.Count == num2)
             {
                 break;
             }
         }
     }
     return new RestOperation(beginMethodInfo, endMethodInfo, attribute, returnType, list);
 }
 private static RestOperation CreateOperation(Type endPointType, MethodInfo methodInfo, RestMethodAttribute attribute)
 {
     Type returnType = methodInfo.ReturnType;
     ParameterInfo[] parameters = methodInfo.GetParameters();
     if (returnType == typeof(void))
     {
         throw new RestException("Invalid RPC method '" + methodInfo.Name + "'. RPC methods must return a value.");
     }
     return new RestOperation(methodInfo, attribute, returnType, parameters);
 }
 public RestOperation(MethodInfo beginMethodInfo, MethodInfo endMethodInfo, RestMethodAttribute attribute, Type returnType, IList<ParameterInfo> parameters)
     : this(beginMethodInfo.Name.Substring(5), attribute, returnType, parameters)
 {
     this._beginMethodInfo = beginMethodInfo;
     this._endMethodInfo = endMethodInfo;
 }
 // Methods
 public RestOperation(MethodInfo methodInfo, RestMethodAttribute attribute, Type returnType, IList<ParameterInfo> parameters)
     : this(methodInfo.Name, attribute, returnType, parameters)
 {
     this._methodInfo = methodInfo;
 }