Пример #1
0
        protected string FormatMethod(string prefix, TargetMethodInfo method,
                                      bool is_static, bool is_ctor, Hashtable hash)
        {
            StringBuilder sb = new StringBuilder();

            sb.Append(prefix);
            if (is_ctor)
            {
                if (is_static)
                {
                    sb.Append("   .cctor ");
                }
                else
                {
                    sb.Append("   .ctor ");
                }
            }
            else if (is_static)
            {
                sb.Append("   static ");
            }
            else
            {
                sb.Append("   ");
            }

            TargetFunctionType ftype = method.Type;

            if (!is_ctor)
            {
                if (ftype.HasReturnValue)
                {
                    sb.Append(ftype.ReturnType != null ?
                              ftype.ReturnType.Name : "<unknown type>");
                }
                else
                {
                    sb.Append("void");
                }
                sb.Append(" ");
                sb.Append(method.Name);
                sb.Append(" ");
            }
            sb.Append("(");
            bool first = true;

            foreach (TargetType ptype in ftype.ParameterTypes)
            {
                if (first)
                {
                    first = false;
                }
                else
                {
                    sb.Append(", ");
                }
                sb.Append(ptype != null ? ptype.Name : "<unknown type>");
            }
            sb.Append(");\n");
            return(sb.ToString());
        }
Пример #2
0
 IProxyInterceptor IHttpInterceptorFactory <T> .Create(ISerializer serializer, ServiceInformation <T> serviceInfo, TargetMethodInfo targetMethodInfo, Headers headers)
 {
     return(new RestInterceptor <T>
     {
         Headers = headers,
         Serializer = serializer,
         ServiceInformation = serviceInfo,
         _targetMethodInfo = targetMethodInfo
     });
 }