diff options
| author | Michael VanOverbeek <[email protected]> | 2017-06-11 11:57:31 +0000 |
|---|---|---|
| committer | GitHub <[email protected]> | 2017-06-11 11:57:31 +0000 |
| commit | 997a81457ebb6d6523c36ca552cee143e0d92244 (patch) | |
| tree | da98985ced112b6d238811f3ca770014d67e34fc /ShiftOS_TheReturn/ServerManager.cs | |
| parent | 0d75f701778a0900a58343c4c80c124279bc231f (diff) | |
| parent | 107a98686a105468b5f200ebcbd27343c1210ce4 (diff) | |
| download | shiftos_thereturn-997a81457ebb6d6523c36ca552cee143e0d92244.tar.gz shiftos_thereturn-997a81457ebb6d6523c36ca552cee143e0d92244.tar.bz2 shiftos_thereturn-997a81457ebb6d6523c36ca552cee143e0d92244.zip | |
Merge pull request #129 from RogueAI42/master
ReflectMan Saves The Day..............
Diffstat (limited to 'ShiftOS_TheReturn/ServerManager.cs')
| -rw-r--r-- | ShiftOS_TheReturn/ServerManager.cs | 27 |
1 files changed, 7 insertions, 20 deletions
diff --git a/ShiftOS_TheReturn/ServerManager.cs b/ShiftOS_TheReturn/ServerManager.cs index 00f9653..df3e463 100644 --- a/ShiftOS_TheReturn/ServerManager.cs +++ b/ShiftOS_TheReturn/ServerManager.cs @@ -134,32 +134,19 @@ Ping: {ServerManager.DigitalSocietyPing} ms { string[] split = msg.GUID.Split('|'); bool finished = false; - foreach (var exec in Directory.GetFiles(Environment.CurrentDirectory)) - { - if(exec.ToLower().EndsWith(".exe") || exec.ToLower().EndsWith(".dll")) + if (split[0] == SaveSystem.CurrentSave.SystemName) + foreach(var type in Array.FindAll(ReflectMan.Types, x => x.GetInterfaces().Contains(typeof(Server)) && Shiftorium.UpgradeAttributesUnlocked(x))) { - try + var attrib = type.GetCustomAttributes().FirstOrDefault(x => x is ServerAttribute) as ServerAttribute; + if(attrib != null) { - var asm = Assembly.LoadFile(exec); - foreach(var type in asm.GetTypes().Where(x => x.GetInterfaces().Contains(typeof(Server)))) + if(split[1] == attrib.Port.ToString()) { - var attrib = type.GetCustomAttributes().FirstOrDefault(x => x is ServerAttribute) as ServerAttribute; - if(attrib != null) - { - if(split[0] == SaveSystem.CurrentSave.SystemName && split[1] == attrib.Port.ToString()) - { - if (Shiftorium.UpgradeAttributesUnlocked(type)) - { - type.GetMethods(BindingFlags.Public | BindingFlags.Instance).FirstOrDefault(x => x.Name == "MessageReceived")?.Invoke(Activator.CreateInstance(type), null); - finished = true; - } - } - } + type.GetMethods(BindingFlags.Public | BindingFlags.Instance).FirstOrDefault(x => x.Name == "MessageReceived")?.Invoke(Activator.CreateInstance(type), null); + finished = true; } } - catch { } } - } if (finished == false) { Forward(split[2], "Error", $"{split[0]}:{split[1]}: connection refused"); |
