mirror of
https://github.com/simtactics/mysimulation.git
synced 2025-03-15 14:51:21 +00:00
- NioTSO client isn't needed because we're using RayLib - Added FreeSO's API server to handle most backend operations
32 lines
1.1 KiB
C#
Executable file
32 lines
1.1 KiB
C#
Executable file
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Reflection;
|
|
|
|
namespace FSO.Common.Utils
|
|
{
|
|
public class AssemblyUtils
|
|
{
|
|
public static Assembly Entry;
|
|
public static List<Assembly> GetFreeSOLibs()
|
|
{
|
|
var map = new Dictionary<string, Assembly>();
|
|
if (Entry == null) Entry = Assembly.GetEntryAssembly();
|
|
RecurseAssembly(Entry, map);
|
|
return map.Values.ToList();
|
|
}
|
|
|
|
private static void RecurseAssembly(Assembly assembly, Dictionary<string, Assembly> map)
|
|
{
|
|
var refs = assembly.GetReferencedAssemblies();
|
|
foreach (var refAsm in refs)
|
|
{
|
|
if ((refAsm.Name.StartsWith("FSO.") || refAsm.Name.Equals("FreeSO") || refAsm.Name.Equals("server")) && !map.ContainsKey(refAsm.Name))
|
|
{
|
|
var loadedAssembly = Assembly.Load(refAsm);
|
|
map.Add(refAsm.Name, loadedAssembly);
|
|
RecurseAssembly(loadedAssembly, map);
|
|
}
|
|
};
|
|
}
|
|
}
|
|
}
|