Esempio n. 1
0
        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;
            }
        }
Esempio n. 2
0
        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;
        }
Esempio n. 3
0
        private void SetGameImages(List <Game> gamelist)
        {
            if (chkImagefield.Checked)
            {
                var imgDir = txtRomFolder.Text;
                imgDir = chkImgUseSubfolder.Checked ? Path.Combine(imgDir, txtImgSubfolder.Text) : imgDir;
                var piSubDir = chkImgUseSubfolder.Checked ? txtImgSubfolder.Text : "";

                var imageFiles = DirectoryScanner.FindImageFiles(imgDir);

                foreach (var imgFile in imageFiles)
                {
                    var game = gamelist.FirstOrDefault(g => g.Name == Path.GetFileNameWithoutExtension(imgFile.Name));

                    if (game != null)
                    {
                        game.Image = string.Format("./{0}/{1}", piSubDir, imgFile.Name);
                    }
                }
            }
        }
Esempio n. 4
0
 private void UpdateExtensionList()
 {
     extensions.Clear();
     extensions           = DirectoryScanner.GetFileExtensionsInDirectory(txtRomFolder.Text);
     cboRomExt.DataSource = new BindingSource(extensions, null);
 }