private static System.Reflection.Assembly LoadPlugin(IKVM.Reflection.Assembly asm) { foreach (var name in asm.GetManifestResourceNames()) { if (name.EndsWith(".dll", StringComparison.OrdinalIgnoreCase)) { using (var strm = asm.GetManifestResourceStream(name)) using (var ms = new MemoryStream()) using (var uni = new IKVM.Reflection.Universe()) { strm.CopyTo(ms); ms.Position = 0; string referenceName = uni.LoadAssembly(uni.OpenRawModule(ms, name)).GetName().Name; var result = AppDomain.CurrentDomain.GetAssemblies().FirstOrDefault(a => a.GetName().Name == referenceName); if (result == null) result = System.Reflection.Assembly.Load(ms.ToArray()); return result; } } } return null; }