Esempio n. 1
0
        private void AddGame(GameInformation game, bool batch)
        {
            _games.Add(game);

            ListViewItem item = new ListViewItem();

            item.Tag = game;

            Image gameImage;

            if (_cache != null)
            {
                gameImage = _cache.GetImage(game);
            }
            else
            {
                gameImage = GameCache.BuildGameImage(game);
            }
            gamesImageList.Images.Add(gameImage);
            item.ImageIndex = gamesImageList.Images.Count - 1;
            _imageLookup.Add(game, item.ImageIndex);

            string regionName = string.Empty;

            if (game.GameType == GameType.UmdGame)
            {
                string regionChar = game.Parameters.DiscID.Substring(2, 1);
                switch (regionChar)
                {
                case "U":
                    regionName = "US";
                    break;

                case "E":
                    regionName = "UK";
                    break;

                case "J":
                    regionName = "JP";
                    break;

                case "K":
                    regionName = "KR";
                    break;

                case "A":
                    regionName = "CN";
                    break;

                default:
                    regionName = "??";
                    break;
                }
            }

            item.SubItems.AddRange(new ListViewItem.ListViewSubItem[] {
                new ListViewItem.ListViewSubItem(item, game.Parameters.Title),
                new ListViewItem.ListViewSubItem(item, regionName),
            });
            item.ToolTipText = Path.GetFileName(game.HostPath);

            _items.Add(game, item);
        }