Commit 9aeb3781 authored by Vinicius Jarina's avatar Vinicius Jarina
Browse files

[WinRT] Added Type.GetMethods prototypes to GeneralExtensions.

parent 9160e3e8
......@@ -366,24 +366,67 @@ namespace NLua.Extensions
return GetAllDeclaredFieldsRecursively (t);
}
public static FieldInfo GetPublicField (this Type t, string name)
static IEnumerable<Type> GetTypes (this Assembly assembly)
{
return GetDeclaredFieldRecursively (t, name);
return assembly.ExportedTypes;
}
public static bool IsAssignableFrom (this Type t, Type t2)
{
return t.GetTypeInfo ().IsAssignableFrom (t2.GetTypeInfo ());
}
public static MethodInfo[] GetMethods (this Type t)
{
return null;
}
static IEnumerable<Type> GetTypes (this Assembly assembly)
public static MethodInfo [] GetMethods (this Type t, BindingFlags flags)
{
return assembly.ExportedTypes;
return null;
}
public static bool IsAssignableFrom (this Type t, Type t2)
public static MethodInfo GetMethod (this Type t, string name, BindingFlags flags)
{
return t.GetTypeInfo ().IsAssignableFrom (t2.GetTypeInfo ());
return null;
}
public static MethodInfo GetMethod (this Type t, string name)
{
return null;
}
public static MethodInfo GetMethod (this Type t, string name, BindingFlags bindingAttr, Type[] signature)
{
return null;
}
public static ConstructorInfo [] GetConstructors (this Type t)
{
return null;
}
public static ConstructorInfo GetConstructor (this Type t, Type [] signature)
{
return null;
}
public static FieldInfo GetField (this Type t, string name)
{
return null;
}
public static FieldInfo [] GetFields (this Type t, BindingFlags bindingAttr)
{
return null;
}
public static bool ImplementInterface (this Type t, string name)
{
return false;
}
static IEnumerable<MethodInfo> GetMethods (this Type t, BindingFlags flags)
public static PropertyInfo [] GetProperties (this Type t, BindingFlags bindingAttr)
{
return null;
}
......
......@@ -28,6 +28,9 @@ using System.Linq;
using System.Threading;
using System.Reflection;
using NLua.Extensions;
#if !MONOTOUCH
using System.Reflection.Emit;
#endif
......@@ -299,7 +302,7 @@ namespace NLua
int i = 0;
foreach (var method in classMethods) {
if (klass.IsInterface) {
if (klass.IsInterface ()) {
GetReturnTypesFromMethod (method, out returnTypes [i]);
i++;
} else {
......
......@@ -635,12 +635,12 @@ end
#endregion
#region Properties
foreach (var property in type.GetProperties(BindingFlags.Public | BindingFlags.Instance)) {
foreach (var property in type.GetProperties (BindingFlags.Public | BindingFlags.Instance)) {
if (
// Check that the LuaHideAttribute and LuaGlobalAttribute were not applied
(!property.GetCustomAttributes (typeof(LuaHideAttribute), false).Any ()) &&
(!property.GetCustomAttributes (typeof(LuaGlobalAttribute), false).Any ())
// Exclude some generic .NET properties that wouldn't be very usefull in Lua
// Exclude some generic .NET properties that wouldn't be very useful in Lua
&& property.Name != "Item") {
// Go into recursion for members
RegisterGlobal (path + "." + property.Name, property.PropertyType, recursionCounter + 1);
......
......@@ -33,7 +33,6 @@ using NLua.Method;
using NLua.Exceptions;
using NLua.Extensions;
namespace NLua
{
#if USE_KOPILUA
......@@ -914,7 +913,11 @@ namespace NLua
if (o is ILuaGeneratedType) {
// Make sure we are _really_ ILuaGenerated
var typ = o.GetType ();
#if NETFX_CORE
return typ.ImplementInterface ("ILuaGeneratedType");
#else
return typ.GetInterface ("ILuaGeneratedType", true) != null;
#endif
}
return false;
}
......
......@@ -27,6 +27,10 @@ using System;
using System.Globalization;
using System.Reflection;
#if NETFX_CORE
using NLua.Extensions;
#endif
namespace NLua
{
/// <summary>
......@@ -75,7 +79,11 @@ namespace NLua
public MethodInfo GetMethod (string name, BindingFlags bindingAttr, Type[] signature)
{
#if NETFX_CORE
return proxy.GetMethod (name, bindingAttr, signature);
#else
return proxy.GetMethod (name, bindingAttr, null, signature, null);
#endif
}
}
}
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment