示例#1
0
        public Plugin(String Path)
        {
            string[] files = Directory.GetFiles(Path, "*.dll");

            foreach (string f in files)
            {
                try
                {
                    Assembly a = null;
                    a = Assembly.LoadFile(f);
                    System.Type[] types = a.GetTypes();
                    foreach (System.Type type in types)
                    {
                        if (type.BaseType.Name == "IReferee")
                        {
                            Console.WriteLine("Loading Referee : " + f);
                            IReferee ins = (IReferee)Activator.CreateInstance(type);
                            Console.WriteLine("Referee : " + ins.GetName());
                            m_referees.Add(ins);
                        }
                    }
                }
                catch (Exception e)
                {
                    //MessageBox.Show(e.Message);
                }
            }
        }