示例#1
0
        public object GetMetaInfo(RpcService service)
        {
            var type = service.Type;
            var sb   = new StringBuilder();

            sb.AppendFormat("<h1>{0}</h1>", type.Name);
            sb.AppendLine();
            sb.Append("<h3>Actions:</h3><p>");

            //			var typeInfo =
            //#if NETCORE
            //				type.GetTypeInfo();
            //#else
            //				type;
            //#endif

            var methods = type.GetMethods(BindingFlags.Public | BindingFlags.Static | BindingFlags.Instance);

            var methodString = GetActionString(methods);

            sb.Append(methodString);
            sb.Append("</p>");

            return(sb.ToString());
        }
示例#2
0
        ///// <summary>
        ///// 
        ///// </summary>
        //public ActionManager() { }
        //public ActionManager(RpcService service)
        //    : this(service, true)
        //{
        //}
        /// <summary>
        /// 
        /// </summary>
        /// <param name="service"></param>
        /// <param name="ignoreCase">ignore action name case</param>
        public ActionManager(RpcService service, bool ignoreCase)
        {
            if (service == null)
                throw new ArgumentNullException(nameof(service));

            _ignoreCase = ignoreCase;
            _service = service;
            _defaultServiceType = service.Type;
        }
示例#3
0
        ///// <summary>
        /////
        ///// </summary>
        //public ActionManager() { }

        //public ActionManager(RpcService service)
        //	: this(service, true)
        //{
        //}

        /// <summary>
        ///
        /// </summary>
        /// <param name="service"></param>
        /// <param name="ignoreCase">ignore action name case</param>
        public ActionManager(RpcService service, bool ignoreCase)
        {
            if (service == null)
            {
                throw new ArgumentNullException(nameof(service));
            }

            _ignoreCase         = ignoreCase;
            _service            = service;
            _defaultServiceType = service.Type;
        }
示例#4
0
        private object GetMetaInfo(RpcService service)
        {
            var type = service.Type;
            var sb = new StringBuilder();
            sb.AppendFormat("Service Name: {0}", type.Name);
            sb.AppendLine();
            sb.Append("Actions:");

            //			var typeInfo =
            //#if NETCORE
            //				type.GetTypeInfo();
            //#else
            //				type;
            //#endif

            var methods = type.GetMethods(BindingFlags.Public | BindingFlags.Static | BindingFlags.Instance);

            foreach (var method in methods)
            {
                if (method.DeclaringType == typeof(object))
                    continue;

                sb.AppendLine();
                sb.Append(method.ReturnType.Name);
                sb.Append(" ");
                sb.AppendFormat("{0}(", method.Name);

                var isFirstArgument = true;
                foreach (var arg in method.GetParameters())
                {
                    if (isFirstArgument)
                        isFirstArgument = false;
                    else
                        sb.Append(", ");

                    sb.Append(arg.ParameterType.Name);
                    sb.Append(" ");
                    sb.Append(arg.Name);
                }

                sb.AppendFormat(");");
            }

            return sb.ToString();
        }