Beispiel #1
0
        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);
                }
            }
        }
Beispiel #2
0
        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);
        }