All pastes #283938 Raw Edit

inkedmn

public text v1 · immutable
#283938 ·published 2006-12-18 19:15 UTC
rendered paste body
        public void LoadTasks()
        {
            DirectoryInfo d = new DirectoryInfo(this.libdir);
            foreach (FileInfo f in d.GetFiles("*.dll"))
            {
                string fname = f.Name.Replace(f.Extension, "");
                Assembly a = Assembly.LoadFile(fname);
                Type[] types = a.GetTypes();
                foreach (Type t in types)
                {
                    if (this.ImplementsTaskInterface(t))
                    {
                        this.tasktemp.Add(t);
                    }
                }
            }
        }

        public bool ImplementsTaskInterface(Type t)
        {
            Type[] ifs = t.GetInterfaces();
            return ((IList<Type>)ifs).Contains(typeof(IMonitorTask));
        }