// 初始化构造方法的入参
 private void AddConstructorDescription(Type classType, ClassInterfaceDescription classDescription, VariableType classKind)
 {
     if (classKind == VariableType.Struct)
     {
         AddStructDefaultConstructor(classType, classDescription);
     }
     ConstructorInfo[] constructors = classType.GetConstructors(BindingFlags.Instance | BindingFlags.Public);
     if (constructors.Length > 0)
     {
         int constructorIndex = 1;
         foreach (ConstructorInfo constructorInfo in constructors)
         {
             DescriptionAttribute descriptionAttribute = constructorInfo.GetCustomAttribute <DescriptionAttribute>();
             string descriptionStr = (null == descriptionAttribute)
                 ? string.Empty
                 : descriptionAttribute.Description;
             FunctionInterfaceDescription funcDescription = new FunctionInterfaceDescription()
             {
                 Category    = classDescription.ClassTypeDescription.Category,
                 Description = descriptionStr,
                 FuncType    = FunctionType.Constructor,
                 IsGeneric   = constructorInfo.IsGenericMethod,
                 Name        = $"{classType.Name}_Constructor{constructorIndex++}"
             };
             InitConstructorParamDescription(constructorInfo, funcDescription);
             funcDescription.Signature = ModuleUtils.GetSignature(classType.Name, funcDescription);
             classDescription.Functions.Add(funcDescription);
         }
     }
 }
        private void AddMethodDescription(Type classType, ClassInterfaceDescription classDescription)
        {
            MethodInfo[] methods  = classType.GetMethods(BindingFlags.Public | BindingFlags.Instance | BindingFlags.Static);
            bool         isStatic = methods.All(item => item.IsStatic || _ignoreMethod.Contains(item.Name));

            foreach (MethodInfo methodInfo in methods)
            {
                // 忽略object对象继承方法和实例类的getset方法
                if (_ignoreMethod.Contains(methodInfo.Name))
                {
                    continue;
                }
                if (!isStatic && (methodInfo.Name.StartsWith(Constants.GetPrefix) ||
                                  methodInfo.Name.StartsWith(Constants.SetPrefix)))
                {
                    continue;
                }
                DescriptionAttribute descriptionAttribute = methodInfo.GetCustomAttribute <DescriptionAttribute>();
                string descriptionStr = (null == descriptionAttribute)
                    ? string.Empty
                    : descriptionAttribute.Description;

                TestflowCategoryAttribute categoryAttribute = methodInfo.GetCustomAttribute <TestflowCategoryAttribute>();
                string categoryStr = null == categoryAttribute
                    ? classDescription.ClassTypeDescription.Category
                    : categoryAttribute.CategoryString;

                FunctionType       funcType          = FunctionType.InstanceFunction;
                CallBackAttribute  callBackAttribute = methodInfo.GetCustomAttribute <CallBackAttribute>();
                AssertionAttribute assertAttribute   = methodInfo.GetCustomAttribute <AssertionAttribute>();
                if (null != callBackAttribute)
                {
                    funcType = FunctionType.CallBack;
                }
                else if (null != assertAttribute)
                {
                    funcType = FunctionType.Assertion;
                }
                else if (methodInfo.IsStatic)
                {
                    funcType = FunctionType.StaticFunction;
                }

                FunctionInterfaceDescription funcDescription = new FunctionInterfaceDescription()
                {
                    Category    = categoryStr,
                    Description = descriptionStr,
                    FuncType    = funcType,
                    IsGeneric   = methodInfo.IsGenericMethod,
                    Name        = methodInfo.Name,
                };
                InitMethodParamDescription(methodInfo, funcDescription);
                funcDescription.Signature = ModuleUtils.GetSignature(classDescription.Name, funcDescription);

                classDescription.Functions.Add(funcDescription);
            }
        }
        // 添加Struct默认构造函数
        private static void AddStructDefaultConstructor(Type classType, ClassInterfaceDescription classDescription)
        {
            string descriptionStr = "Struct default constructor";
            FunctionInterfaceDescription funcDescription = new FunctionInterfaceDescription()
            {
                Category    = classDescription.ClassTypeDescription.Category,
                Description = descriptionStr,
                FuncType    = FunctionType.StructConstructor,
                IsGeneric   = false,
                Name        = $"{classType.Name}_Constructor"
            };

            funcDescription.Arguments = new List <IArgumentDescription>(1);
            funcDescription.Return    = null;
            funcDescription.Signature = ModuleUtils.GetSignature(classType.Name, funcDescription);
            classDescription.Functions.Add(funcDescription);
        }
        private void AddFieldSetterDescription(Type classType, ClassInterfaceDescription classDescription)
        {
            List <IArgumentDescription> staticProperties = GetFieldDescriptions(classType, BindingFlags.Static | BindingFlags.Public);

            if (null != staticProperties && staticProperties.Count > 0)
            {
                FunctionInterfaceDescription staticSetterDesp = new FunctionInterfaceDescription()
                {
                    Name           = CommonConst.SetStaticFieldFunc,
                    Arguments      = staticProperties,
                    ClassType      = classDescription.ClassType,
                    ComponentIndex = classDescription.ComponentIndex,
                    FuncType       = FunctionType.StaticFieldSetter,
                    Signature      = ModuleUtils.GetSignature(classType.Name, CommonConst.SetStaticFieldFunc),
                    Return         = null,
                    IsGeneric      = false
                };
                classDescription.Functions.Add(staticSetterDesp);
            }

            List <IArgumentDescription> instanceProperties = GetFieldDescriptions(classType, BindingFlags.Instance | BindingFlags.Public);

            if (null != instanceProperties && instanceProperties.Count > 0)
            {
                FunctionInterfaceDescription instanceSetterDesp = new FunctionInterfaceDescription()
                {
                    Name           = CommonConst.SetInstanceFieldFunc,
                    Arguments      = instanceProperties,
                    ClassType      = classDescription.ClassType,
                    ComponentIndex = classDescription.ComponentIndex,
                    FuncType       = FunctionType.InstanceFieldSetter,
                    Signature      = ModuleUtils.GetSignature(classType.Name, CommonConst.SetInstanceFieldFunc),
                    Return         = null,
                    IsGeneric      = false
                };
                classDescription.Functions.Add(instanceSetterDesp);
            }
        }