Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
ruanhaishen
NLua
Commits
9aeb3781
Commit
9aeb3781
authored
Oct 10, 2014
by
Vinicius Jarina
Browse files
[WinRT] Added Type.GetMethods prototypes to GeneralExtensions.
parent
9160e3e8
Changes
6
Show whitespace changes
Inline
Side-by-side
Core/NLua/Extensions/GeneralExtensions.cs
View file @
9aeb3781
...
...
@@ -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
<
Method
Info
>
Get
Method
s
(
this
Type
t
,
BindingFlags
flags
)
public
static
Property
Info
[]
Get
Propertie
s
(
this
Type
t
,
BindingFlags
bindingAttr
)
{
return
null
;
}
...
...
Core/NLua/GenerateEventAssembly/CodeGeneration.cs
View file @
9aeb3781
...
...
@@ -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
{
...
...
Core/NLua/Lua.cs
View file @
9aeb3781
...
...
@@ -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 useful
l
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
);
...
...
Core/NLua/ObjectTranslator.cs
View file @
9aeb3781
...
...
@@ -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
;
}
...
...
Core/NLua/ProxyType.cs
View file @
9aeb3781
...
...
@@ -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
NLua.WP8.sln
View file @
9aeb3781
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment