private void btnGenerate_Click(object sender, EventArgs e) { Cursor = Cursors.WaitCursor; try { var files = DirectoryScanner.FindFilesMatching(txtRomFolder.Text, cboRomExt.SelectedText); var games = files.Select(f => new Game { Name = Path.GetFileNameWithoutExtension(f.Name), Path = string.Format("./{0}", f.Name) }).ToList(); SetGameImages(games); var gameList = new GameList { Game = games }; var xml = ProcessXML.SaveModelToXML(gameList); System.IO.File.WriteAllText(Path.Combine(txtRomFolder.Text, "gamelist.xml"), xml); } finally { Cursor = Cursors.Default; } }
private void GeneratePreviewXML() { var files = DirectoryScanner.FindFilesMatching(txtRomFolder.Text, cboRomExt.SelectedText); var games = files.Select(f => new Game { Name = Path.GetFileNameWithoutExtension(f.Name), Path = string.Format("./{0}", f.Name) }).ToList(); var shortList = games.Take(1).ToList(); SetGameImages(shortList); var gameList = new GameList { Game = shortList }; var xml = ProcessXML.SaveModelToXML(gameList); txtXmlPreview.Text = xml; }