示例#1
0
        public void LoadPlugin(string name)
        {
            Assembly assembly = Assembly.LoadFile(Path.GetFullPath(name));

            foreach (Type t in assembly.GetTypes())
            {
                try
                {
                    if (t.IsSubclassOf(typeof(ProxyPlugin)))
                    {
                        ConstructorInfo info   = t.GetConstructor(new Type[] { typeof(ProxyFrame) });
                        ProxyPlugin     plugin = (ProxyPlugin)info.Invoke(new object[] { this });
                        plugin.Init();
                    }
                }
                catch (Exception e)
                {
                    Logger.Log("LoadPlugin exception", Helpers.LogLevel.Error, e);
                }
            }
        }
示例#2
0
        public void LoadPlugin(string name)
        {
            Assembly assembly = Assembly.LoadFile(Path.GetFullPath(name));

            foreach (Type t in assembly.GetTypes())
            {
                try
                {
                    if (t.IsSubclassOf(typeof(ProxyPlugin)))
                    {
                        ConstructorInfo info   = t.GetConstructor(new Type[] { typeof(ProxyFrame) });
                        ProxyPlugin     plugin = (ProxyPlugin)info.Invoke(new object[] { this });
                        plugin.Init();
                    }
                }
                catch (Exception e)
                {
                    Console.WriteLine(e.ToString());
                }
            }
        }