public Form1() { InitializeComponent(); defs = new List <GameDef>(); DirectoryInfo di = new DirectoryInfo("defs"); foreach (FileInfo inf in di.GetFiles("*.def")) { GameDef gameDef = new GameDef(); gameDef.Parse(File.ReadAllLines(inf.FullName)); defs.Add(gameDef); } comboBox1.Items.AddRange(defs.ToArray()); comboBox1.SelectedIndex = 0; }
static void Main() { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Form1 f1 = new Form1(); if (f1.ShowDialog() == DialogResult.Cancel) { Application.Exit(); return; } GameDef def = f1.Selected; AppDomain domain = AppDomain.CreateDomain("Timer"); ObjectHandle h = domain.CreateInstanceFrom(AppDomain.CurrentDomain.BaseDirectory + "Core.dll", "NFSLR.Core.TimerForm", true, BindingFlags.CreateInstance, null, new string[] { AppDomain.CurrentDomain.BaseDirectory + "plugins\\" + def.Dll, def.Classpath, def.Module }, null, null, null); TimerForm t = h.Unwrap() as TimerForm; t.ShowDialog(); AppDomain.Unload(domain); Application.Exit(); }
private void comboBox1_SelectedIndexChanged(object sender, EventArgs e) { def = defs[comboBox1.SelectedIndex]; }