Example #1
0
		internal static void load(MainWindow win){
			main=win;
			string path=Path.Combine(System.Environment.CurrentDirectory,"plugin");
			if(!Directory.Exists(path)){
				win.write("没有发现插件目录");
				return;
			}
			string[] pluginsName= Directory.GetFiles(path,"*.dll");
			Type myType=typeof(iBilibilidanPlugin);
			foreach(string pluginPath in pluginsName){
				Assembly ass=Assembly.LoadFile(pluginPath);
				Type[] type;
				try{
					type=ass.GetExportedTypes();
				}
				catch (Exception)
				{
					win.write("无法兼容模块(已抛弃,请检查插件是否过旧)"+pluginPath);
					continue;
				}
				foreach(Type cla in type){
					if(myType.IsAssignableFrom(cla)&&!cla.IsAbstract){
						iBilibilidanPlugin p=(iBilibilidanPlugin)Activator.CreateInstance(cla);
						plugins.Add(p);
					}
				}
			}
			win.write("共载入"+pluginsName.Length+"个模块,识别出"+plugins.Count+"个插件");
		}
        public MainWindow()
		{
            main = this;
			dm=new dmReader(this);
			InitializeComponent();
			write("欢迎使用由星星制作的弹幕姬");
			if(ini.load("./ini.ini")){
				write("成功读取ini文件");
			}else{
				write("没有找到ini文件");
			}
			pluginCenter.load(this);
        }
Example #3
0
        private Thread keeper = null;//维持连接并发送获取人数指令线程
		public dmReader(MainWindow win)
		{
            window = win;
		}