public ModPickerForm() { InitializeComponent(); // load modinfos var stock = new Mod(); var loader = new ModInfoLoader(null); loader.Load(stock); modinfos.Add(stock.Info); if (Directory.Exists("Mods")) { foreach (var folder in Directory.GetDirectories("Mods")) { loader.ModPath = Path.GetFileName(folder); var mod = new Mod(); loader.Load(mod); modinfos.Add(mod.Info); } } // populate list lstMods.Initialize(32, 32); foreach (var info in modinfos) { Image img; if (info.Folder == null) { img = Pictures.GetCachedImage("MODICON"); } else { img = Pictures.GetCachedImage(Path.Combine(Path.GetDirectoryName(Assembly.GetEntryAssembly().Location), "Mods", info.Folder, "MODICON")); } lstMods.AddItemWithImage(null, info.Name, info, img); } try { this.Icon = new Icon(FrEee.WinForms.Properties.Resources.FrEeeIcon); } catch { } }
public ModPickerView() { InitializeComponent(); // load modinfos ModInfos = new ModPickerViewModel(); var stock = new Mod(); var loader = new ModInfoLoader(null); loader.Load(stock); ModInfos.Add(stock.Info); ModInfos.SelectedItem = stock.Info; if (Directory.Exists("Mods")) { foreach (var folder in Directory.GetDirectories("Mods")) { loader.ModPath = Path.GetFileName(folder); var mod = new Mod(); loader.Load(mod); ModInfos.Add(mod.Info); } } }