some improves and fixes:
1. should get the last loadded aseembly by checking its version instead of reversing. 2. fixed throw an exception when CsScriptRunner run the second time. 3. an argument carried by an UnregisterType called somewhere have had been accidentally removed.
This commit is contained in:
@@ -13,8 +13,14 @@ namespace Barotrauma
|
||||
{
|
||||
var type = Type.GetType(typeName);
|
||||
if (type != null) return type;
|
||||
foreach (var a in AppDomain.CurrentDomain.GetAssemblies().Reverse())
|
||||
foreach (var a in AppDomain.CurrentDomain.GetAssemblies())
|
||||
{
|
||||
if (CsScriptFilter.LoadedAssemblyName.Contains(a.GetName().Name))
|
||||
{
|
||||
var attrs = a.GetCustomAttributes<AssemblyMetadataAttribute>();
|
||||
var revision = attrs.FirstOrDefault(attr => attr.Key == "Revision")?.Value;
|
||||
if (revision != null && int.Parse(revision) != (int)CsScriptBase.Revision[a.GetName().Name]) { continue; }
|
||||
}
|
||||
type = a.GetType(typeName);
|
||||
if (type != null)
|
||||
return type;
|
||||
|
||||
Reference in New Issue
Block a user