Created
February 23, 2018 22:43
-
-
Save NimbusFox/973420c592080cb9a3fbe79861fb123e to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
static Static() { | |
var dir = Assembly.GetExecutingAssembly().Location; | |
foreach (var file in new DirectoryInfo(dir).GetFiles("*.mod")) { | |
var data = JsonConvert.DeserializeObject<Dictionary<string, object>>(File.ReadAllText(file.FullName)); | |
if (data.Any(x => x.Key.ToLower() == "landclaim")) { | |
var current = data[data.First(x => x.Key.ToLower() == "landclaim").Key]; | |
if (current is bool b) { | |
if (b) { | |
var item = Assembly.LoadFile(file.FullName.Replace(".mod", ".dll")); | |
foreach (var module in item.GetModules()) { | |
if (module.GetType() is ILandClaim) { | |
LandClaim = (ILandClaim) Activator.CreateInstance(module.GetType()); | |
} | |
} | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment