clean up LoadModAssemblies nonsense a bit
This commit is contained in:
@@ -20,6 +20,8 @@
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Reflection;
|
||||
using System.Linq;
|
||||
|
||||
namespace OpenRA
|
||||
{
|
||||
@@ -35,5 +37,10 @@ namespace OpenRA
|
||||
foreach( var ee in e )
|
||||
fn( ee );
|
||||
}
|
||||
|
||||
public static IEnumerable<string> GetNamespaces(this Assembly a)
|
||||
{
|
||||
return a.GetTypes().Select(t => t.Namespace).Distinct().Where(n => n != null);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -71,11 +71,9 @@ namespace OpenRA
|
||||
internal static void LoadModAssemblies(Manifest m)
|
||||
{
|
||||
// All the core namespaces
|
||||
var asms = new List<Pair<Assembly, string>> (typeof(Game).Assembly.GetTypes()
|
||||
.Select(a => a.Namespace)
|
||||
.Distinct()
|
||||
.Where(b => b != null)
|
||||
.Select(c => Pair.New(typeof(Game).Assembly, c)));
|
||||
var asms = typeof(Game).Assembly.GetNamespaces()
|
||||
.Select(c => Pair.New(typeof(Game).Assembly, c))
|
||||
.ToList();
|
||||
|
||||
// Mod assemblies assumed to contain a single namespace
|
||||
foreach (var a in m.Assemblies)
|
||||
|
||||
Reference in New Issue
Block a user