public void Create(string location) { PlugInContainer plugIn = new PlugInContainer(); if (System.IO.File.Exists(location)) { Assembly assmbly = null; plugIn.Location = location; assmbly = Assembly.LoadFile(plugIn.Location); foreach (object obj in assmbly.GetTypes()) { plugIn.Id = Guid.NewGuid().ToString(); Instantiate(plugIn); _pluginList.Add(plugIn); } } }
private void Instantiate(PlugInContainer pg) { Assembly assmbly = null; if (pg.Location == null || pg.Location == "") { assmbly = Assembly.GetExecutingAssembly(); } else if (System.IO.File.Exists(pg.Location)) { assmbly = Assembly.LoadFile(pg.Location); } if (assmbly != null) pg.Instance = assmbly.CreateInstance(assmbly.GetName().Name + "." + pg.Class); }