Пример #1
0
 public static NativeMethodDescription GetNativeMethodFrom(ProgrammingPlatform programmingPlatform, MethodInfo methodInfo, NativeCallableAttribute nativeAttribute)
 {
     // Passed through GetNativeType twice, once for hte native typecoversion in C# and another for the destination type (e.g. ruby, python)
     return(new NativeMethodDescription {
         Name = nativeAttribute.EntryPoint,
         ReturnType = NativeTypeDescription.FromString(GetNativeType(programmingPlatform, GetNativeType(methodInfo.ReturnType.FullName))),
         IntendedReturnType = NativeTypeDescription.FromString(GetNativeType(programmingPlatform, GetNativeType(methodInfo.ReturnTypeCustomAttributes.GetCustomAttributes(true).Where(c => c is IntendedTypeAttribute).Select(c => c as IntendedTypeAttribute).FirstOrDefault()?.Type.FullName))),
         Parameters = GetNativeParametersFrom(programmingPlatform, methodInfo)
     });
 }
Пример #2
0
        public static List <NativeParameterDescription> GetNativeParametersFrom(ProgrammingPlatform programmingPlatform, MethodInfo methodInfo)
        {
            var parameters = new List <NativeParameterDescription> ();

            foreach (var parameter in methodInfo.GetParameters())
            {
                // Passed through GetNativeType twice, once for hte native typecoversion in C# and another for the destination type (e.g. ruby, python)
                parameters.Add(new NativeParameterDescription(parameter.Name, NativeTypeDescription.FromString(GetNativeType(programmingPlatform, GetNativeType(parameter.ParameterType.FullName))), NativeTypeDescription.FromString(GetNativeType(programmingPlatform, GetNativeType(parameter.GetCustomAttribute <IntendedTypeAttribute> (true)?.Type.FullName)))));
            }

            return(parameters);
        }
Пример #3
0
 public NativeParameterDescription(string name, Type type)
 {
     Name = name;
     Type = new NativeTypeDescription(type);
 }