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
ddebeaec
Commit
ddebeaec
authored
Sep 15, 2013
by
Vinicius Jarina
Browse files
Fixed load_assembly (using PublicKey, Version from mscorlib)
parent
2b34d005
Changes
1
Hide whitespace changes
Inline
Side-by-side
Core/NLua/ObjectTranslator.cs
View file @
ddebeaec
...
@@ -266,19 +266,42 @@ namespace NLua
...
@@ -266,19 +266,42 @@ namespace NLua
{
{
try
{
try
{
string
assemblyName
=
LuaLib
.
LuaToString
(
luaState
,
1
).
ToString
();
string
assemblyName
=
LuaLib
.
LuaToString
(
luaState
,
1
).
ToString
();
Assembly
assembly
=
null
;
Assembly
assembly
=
null
;
Exception
exception
=
null
;
try
{
try
{
assembly
=
Assembly
.
Load
(
assemblyName
);
assembly
=
Assembly
.
Load
(
assemblyName
);
}
catch
(
BadImageFormatException
)
{
}
catch
(
BadImageFormatException
)
{
// The assemblyName was invalid. It is most likely a path.
// The assemblyName was invalid. It is most likely a path.
}
catch
(
FileNotFoundException
e
)
{
exception
=
e
;
}
#if !SILVERLIGHT
if
(
assembly
==
null
)
{
try
{
assembly
=
Assembly
.
Load
(
AssemblyName
.
GetAssemblyName
(
assemblyName
));
}
catch
(
FileNotFoundException
e
)
{
exception
=
e
;
}
if
(
assembly
==
null
)
{
AssemblyName
mscor
=
assemblies
[
0
].
GetName
();
AssemblyName
name
=
new
AssemblyName
();
name
.
Name
=
assemblyName
;
name
.
CultureInfo
=
mscor
.
CultureInfo
;
name
.
Version
=
mscor
.
Version
;
name
.
SetPublicKeyToken
(
mscor
.
GetPublicKeyToken
());
name
.
SetPublicKey
(
mscor
.
GetPublicKey
());
assembly
=
Assembly
.
Load
(
name
);
if
(
assembly
!=
null
)
exception
=
null
;
}
if
(
exception
!=
null
)
ThrowError
(
luaState
,
exception
);
}
}
#if !SILVERLIGHT
if
(
assembly
==
null
)
assembly
=
Assembly
.
Load
(
AssemblyName
.
GetAssemblyName
(
assemblyName
));
#endif
#endif
if
(
assembly
!=
null
&&
!
assemblies
.
Contains
(
assembly
))
if
(
assembly
!=
null
&&
!
assemblies
.
Contains
(
assembly
))
assemblies
.
Add
(
assembly
);
assemblies
.
Add
(
assembly
);
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
...
...
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