-
Notifications
You must be signed in to change notification settings - Fork 0
/
ModLoader.cs
33 lines (31 loc) · 884 Bytes
/
ModLoader.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
using System;
using System.Linq;
using System.Reflection;
using System.Collections.Generic;
using RobOne.Inventory.Mods;
namespace RobOne.Inventory;
internal class ModLoader
{
private readonly List<ModBase> mods = new List<ModBase>();
public void LoadMods()
{
foreach (Type type in
Assembly.GetAssembly(typeof(ModBase)).GetTypes()
.Where(myType => myType.IsClass && !myType.IsAbstract && myType.IsSubclassOf(typeof(Mods.ModBase))))
{
mods.Add((ModBase)Activator.CreateInstance(type));
}
foreach (var mod in mods)
{
Log.Message("Rob.One.Inventory.SubModule " + mod.ModName + " loaded");
}
}
public void UnloadMods()
{
foreach (var mod in mods)
{
mod.Dispose();
}
mods.Clear();
}
}