예제 #1
0
        private void populateList()
        {
            //set the label
            this.label1.Text = String.Format("Success! File system path chosen is: {0}", root);

            //populate the list view
            DirectoryInfo rootDir  = new DirectoryInfo(root);
            var           gameDirs = rootDir.GetDirectories("*", SearchOption.TopDirectoryOnly);

            foreach (var gameDir in gameDirs)
            {
                var exeFiles = gameDir.GetFiles("*.exe", SearchOption.TopDirectoryOnly);
                foreach (var item in exeFiles)
                {
                    if (isGame(item.Name))
                    {
                        //get the properties of the exe file
                        FileVersionInfo att      = FileVersionInfo.GetVersionInfo(item.FullName);
                        string          comments = att.FileDescription;

                        //add to list of games
                        ListViewItem newItem = new ListViewItem(comments);
                        newItem.SubItems.Add(item.FullName);
                        gamesListView.Items.Add(newItem);

                        //add to internal list, for information loading
                        GamesHubFile file = new GamesHubFile(item, att);
                        games.Add(item.FullName, file);
                    }
                }
            }
        }
예제 #2
0
        private void gamesListView_ItemActivate(object sender, EventArgs e)
        {
            ListViewItem selectedItem = (sender as ListView).FocusedItem;
            string       key          = selectedItem.SubItems[1].Text;
            GamesHubFile game         = games[key];

            gameInfoPanelLocationTextLabel.Text = game.file.FullName;
            gameInfoPanelNameTextLabel.Text     = game.versionInfo.FileDescription;
            gameInfoPanelIcon.Image             = Icon.ExtractAssociatedIcon(game.file.FullName).ToBitmap();
        }