public static bool ShowContext(ExtendedGUIListItem item, GUIPresenter presenter) { if (item == null || item.AssociatedGame == null) return showSimpleContext(presenter); else return ShowGameDialog(item.AssociatedGame, presenter); }
public ExtendedGUIListItem createEmulatorFacadeItem(Emulator item) { ExtendedGUIListItem listItem = new ExtendedGUIListItem(item.Title); listItem.AssociatedEmulator = item; setThumbnail(listItem, thumb_emulators + @"\" + item.Title + @"\Logo"); return(listItem); }
public ExtendedGUIListItem createSubDir(String path) { ExtendedGUIListItem dir = new ExtendedGUIListItem(path.Substring(path.LastIndexOf("\\") + 1)); dir.AssociatedDirectory = path; dir.ThumbnailImage = GUIGraphicsContext.Skin + @"\Media\DefaultFolderBig.png"; setThumbnail(dir, path + @"\folder"); dir.IconImage = GUIGraphicsContext.Skin + @"\Media\DefaultFolder.png"; return(dir); }
public ExtendedGUIListItem createBackDots(string PrevSelected) { ExtendedGUIListItem dots = new ExtendedGUIListItem(".."); dots.IsBackDots = true; dots.PrevSelected = PrevSelected; dots.ThumbnailImage = GUIGraphicsContext.Skin + @"\Media\DefaultFolderBackBig.png"; dots.IconImage = GUIGraphicsContext.Skin + @"\Media\defaultFolderBack.png"; return(dots); }
private void setThumbnail(ExtendedGUIListItem item, String thumbpath) { if (File.Exists(thumbpath + ".png")) { item.ThumbnailImage = thumbpath + ".png"; } else if (File.Exists(thumbpath + ".jpg")) { item.ThumbnailImage = thumbpath + ".jpg"; } else if (File.Exists(thumbpath + ".gif")) { item.ThumbnailImage = thumbpath + ".gif"; } else { item.ThumbnailImage = GUIGraphicsContext.Skin + "\\media\\defaultMyEmulators.png"; } }
public ExtendedGUIListItem createGameRomFacadeItem(Game item) { ExtendedGUIListItem listItem = new ExtendedGUIListItem(item.LaunchFile); listItem.AssociatedGame = item; setThumbnail(listItem, thumb_games + @"\" + item.ParentEmulator.Title + @"\" + item.GameID.ToString() + @"\BoxFront"); if (listItem.ThumbnailImage.Trim() == "") { String artfile = createGameArt(item, "TitleScreenshot", true); if (artfile != "") { listItem.ThumbnailImage = artfile; } else { setThumbnail(listItem, thumb_emulators + @"\" + item.ParentEmulator.Title + @"\Logo"); } } return(listItem); }
private void comboBox1_SelectedIndexChanged(object sender, EventArgs e) { if (comboBox1.SelectedItem.GetType() == typeof(Emulator)) { pathText.Enabled = true; browse.Enabled = true; apply.Enabled = true; txt_FanArt.Enabled = true; btnBrowseFanart.Enabled = true; btnTitleScreen.Enabled = true; btnIngameScreenshot.Enabled = true; btnBrowseBack.Enabled = true; txt_TitleScreen.Enabled = true; txt_IngameScreenshot.Enabled = true; txt_BoxBack.Enabled = true; ExtendedGUIListItem item = ThumbsHandler.Instance.createEmulatorFacadeItem((Emulator)comboBox1.SelectedItem); if (item.ThumbnailImage != null) { pictureBox1.ImageLocation = item.ThumbnailImage; } else { pictureBox1.Image = null; } String FanartPath = ThumbsHandler.Instance.createEmulatorArt((Emulator)comboBox1.SelectedItem, "fanart"); if (FanartPath != "") { pbFanart.ImageLocation = FanartPath; } else { pbFanart.Image = null; } String BackCoverPath = ThumbsHandler.Instance.createEmulatorArt((Emulator)comboBox1.SelectedItem, "backcover"); if (BackCoverPath != "") { pictureBoxBack.ImageLocation = BackCoverPath; } else { pictureBoxBack.Image = null; } String TitleScreenPath = ThumbsHandler.Instance.createEmulatorArt((Emulator)comboBox1.SelectedItem, "titlescreen"); if (TitleScreenPath != "") { pictureTitleScreen.ImageLocation = TitleScreenPath; } else { pictureTitleScreen.Image = null; } String IngameScreenPath = ThumbsHandler.Instance.createEmulatorArt((Emulator)comboBox1.SelectedItem, "ingamescreen"); if (IngameScreenPath != "") { pictureIngameScreenshot.ImageLocation = IngameScreenPath; } else { pictureIngameScreenshot.Image = null; } btnNewManual.Enabled = false; btnManual.Enabled = false; } else if (comboBox1.SelectedItem.GetType() == typeof(Game)) { pathText.Enabled = true; browse.Enabled = true; apply.Enabled = true; txt_FanArt.Enabled = true; btnBrowseFanart.Enabled = true; btnTitleScreen.Enabled = true; btnIngameScreenshot.Enabled = true; btnBrowseBack.Enabled = true; txt_TitleScreen.Enabled = true; txt_IngameScreenshot.Enabled = true; txt_BoxBack.Enabled = true; btnNewManual.Enabled = true; txt_Manual.Enabled = true; String BoxFront = ThumbsHandler.Instance.createGameArt((Game)comboBox1.SelectedItem, "BoxFront", false); if (BoxFront != "") { pictureBox1.ImageLocation = BoxFront; } else { pictureBox1.Image = null; } String FanartPath = ThumbsHandler.Instance.createGameArt((Game)comboBox1.SelectedItem, "Fanart", false); if (FanartPath != "") { pbFanart.ImageLocation = FanartPath; } else { pbFanart.Image = null; } String BackCoverPath = ThumbsHandler.Instance.createGameArt((Game)comboBox1.SelectedItem, "BoxBack", false); if (BackCoverPath != "") { pictureBoxBack.ImageLocation = BackCoverPath; } else { pictureBoxBack.Image = null; } String TitleScreenPath = ThumbsHandler.Instance.createGameArt((Game)comboBox1.SelectedItem, "TitleScreenshot", false); if (TitleScreenPath != "") { pictureTitleScreen.ImageLocation = TitleScreenPath; } else { pictureTitleScreen.Image = null; } String IngameScreenPath = ThumbsHandler.Instance.createGameArt((Game)comboBox1.SelectedItem, "IngameScreenshot", false); if (IngameScreenPath != "") { pictureIngameScreenshot.ImageLocation = IngameScreenPath; } else { pictureIngameScreenshot.Image = null; } String ManualPath = ThumbsHandler.Instance.createGameArt((Game)comboBox1.SelectedItem, "manual", false); if (ManualPath != "") { btnManual.Enabled = true; } else { btnManual.Enabled = false; } } else { pathText.Enabled = false; txt_FanArt.Enabled = false; browse.Enabled = false; btnBrowseFanart.Enabled = false; apply.Enabled = false; btnTitleScreen.Enabled = false; btnIngameScreenshot.Enabled = false; btnBrowseBack.Enabled = false; txt_TitleScreen.Enabled = false; txt_Manual.Enabled = false; txt_IngameScreenshot.Enabled = false; txt_BoxBack.Enabled = false; btnNewManual.Enabled = false; btnManual.Enabled = false; pictureBox1.Image = null; pbFanart.Image = null; pictureTitleScreen.Image = null; pictureIngameScreenshot.Image = null; pictureBoxBack.Image = null; } pathText.Text = ""; txt_IngameScreenshot.Text = ""; txt_FanArt.Text = ""; txt_BoxBack.Text = ""; txt_TitleScreen.Text = ""; }
public void fillSomeGames(String sqlTail, gameProperty secondLabel) { if (currentEmulator == null) { currentEmulator = new Emulator(EmulatorType.manyemulators); } currentSqlTail = sqlTail; currentGameProperty = secondLabel; setView(0); facade.Clear(); facade.Add(ThumbsHandler.Instance.createBackDots("")); List <GUIListItem> firstPart = new List <GUIListItem>(); List <GUIListItem> secondPart = new List <GUIListItem>(); foreach (Game game in DB.getSomeGames(sqlTail)) { ExtendedGUIListItem item = ThumbsHandler.Instance.createGameFacadeItem(game); switch (secondLabel) { case gameProperty.grade: { item.Label2 = "(" + game.Grade + "/10)"; break; } case gameProperty.latestplay: { item.Label2 = "(" + game.Latestplay.ToShortDateString() + ")"; break; } case gameProperty.playcount: { item.Label2 = "(" + game.Playcount + ")"; break; } case gameProperty.year: { item.Label2 = "(" + game.Yearmade + ")"; break; } case gameProperty.genre: { item.Label2 = "(" + game.Genre + ")"; break; } case gameProperty.company: { item.Label2 = "(" + game.Company + ")"; break; } } if (item.Label2.Equals("(0)") || item.Label2.Equals("(0/10)") || item.Label2.Equals("(" + DateTime.MinValue.ToShortDateString() + ")") || item.Label2.Equals("()")) { item.Label2 = "n/a"; } if (Options.getBoolOption("hidelabeldecorations")) { item.Label2 = item.Label2.Replace("(", "").Replace(")", ""); } if (currentEmulator.isManyEmulators() || (!currentEmulator.isManyEmulators() && game.ParentEmulator.UID == currentEmulator.UID)) { if (!item.Label2.Equals("n/a")) { firstPart.Add(item); } else { secondPart.Add(item); } } } //Put all the ones with empty Label2 in the end foreach (GUIListItem item in firstPart) { facade.Add(item); } foreach (GUIListItem item in secondPart) { facade.Add(item); } }
public void onFacadeClicked(MediaPortal.GUI.Library.Action.ActionType ButtonPressed) { ExtendedGUIListItem currentItem = (ExtendedGUIListItem)facade.SelectedListItem; //Show games for selected emulator if (currentEmulator == null && ButtonPressed != MediaPortal.GUI.Library.Action.ActionType.ACTION_PREVIOUS_MENU) { if (ButtonPressed == MediaPortal.GUI.Library.Action.ActionType.ACTION_NEXT_ITEM) { Executor.launchDocument(currentItem.AssociatedEmulator); } else { currentEmulator = currentItem.AssociatedEmulator; if (currentEmulator.isPc()) { fillPCGames(); } else { currentFolder = currentEmulator.PathToRoms; fillGames(); facade.SelectedListItemIndex = 1; onFacadeAction(); } } } //Dive into subdir else if (currentItem.AssociatedDirectory != null && ButtonPressed != MediaPortal.GUI.Library.Action.ActionType.ACTION_PREVIOUS_MENU) { currentFolder = currentItem.AssociatedDirectory; fillGames(); facade.SelectedListItemIndex = 1; onFacadeAction(); } //Execute game else if (currentItem.AssociatedGame != null && ButtonPressed != MediaPortal.GUI.Library.Action.ActionType.ACTION_PREVIOUS_MENU) { if (ButtonPressed == MediaPortal.GUI.Library.Action.ActionType.ACTION_NEXT_ITEM) { Executor.launchDocument(currentItem.AssociatedGame); } else { if (currentItem.AssociatedGame.ParentEmulator.EnableGoodmerge) { if (ButtonPressed == MediaPortal.GUI.Library.Action.ActionType.ACTION_MUSIC_PLAY) { currentItem.AssociatedGame.LaunchFile = ""; Executor.launchGame(currentItem.AssociatedGame); } else { if (ButtonPressed == MediaPortal.GUI.Library.Action.ActionType.ACTION_PAUSE) { currentItem.AssociatedGame.LaunchFile = ""; } if (currentItem.AssociatedGame.LaunchFile.Trim() != "") { Executor.launchGame(currentItem.AssociatedGame); fillGames(); for (int i = 0; i < facade.Count; i++) { try { if (((ExtendedGUIListItem)facade[i]).AssociatedGame.Path == currentItem.AssociatedGame.Path) { facade.SelectedListItemIndex = i; onFacadeAction(); } } catch { } } } else { SevenZipCompressor.SetLibraryPath(Options.getStringOption("7zdllpath")); using (SevenZipExtractor tmp = new SevenZipExtractor(currentItem.AssociatedGame.Path)) { string GoodmergeTempPath = ""; if (currentItem.AssociatedGame.ParentEmulator.GoodmergeTempPath.EndsWith("\\")) { GoodmergeTempPath = currentItem.AssociatedGame.ParentEmulator.GoodmergeTempPath; } else { GoodmergeTempPath = currentItem.AssociatedGame.ParentEmulator.GoodmergeTempPath + "\\"; } if (tmp.ArchiveFileNames.Count == 1) { Executor.launchGame(currentItem.AssociatedGame); } else { setView(0); facade.Clear(); //prev selected facade.Add(ThumbsHandler.Instance.createBackDots(currentItem.AssociatedGame.Path)); for (int i = 0; i < tmp.ArchiveFileNames.Count; i++) { Game RomListGame = DB.getGame(currentItem.AssociatedGame.Path, currentItem.AssociatedGame.ParentEmulator); RomListGame.LaunchFile = tmp.ArchiveFileNames[i]; facade.Add(ThumbsHandler.Instance.createGameRomFacadeItem(RomListGame)); Log.Error(new Exception("launch" + RomListGame.LaunchFile)); } facade.SelectedListItemIndex = 1; onFacadeAction(); } } } } } else { Executor.launchGame(currentItem.AssociatedGame); } } } else if ((currentItem.IsBackDots || ButtonPressed == MediaPortal.GUI.Library.Action.ActionType.ACTION_PREVIOUS_MENU) && !string.IsNullOrEmpty(currentItem.PrevSelected)) { fillGames(); for (int i = 0; i < facade.Count; i++) { try { if (((ExtendedGUIListItem)facade[i]).AssociatedGame.Path == currentItem.PrevSelected) { facade.SelectedListItemIndex = i; onFacadeAction(); } } catch { } } } //Go up one level else if ((currentItem.IsBackDots || ButtonPressed == MediaPortal.GUI.Library.Action.ActionType.ACTION_PREVIOUS_MENU)) { //Go back to all emulators if (currentEmulator.isManyEmulators() || currentEmulator.isPc() || currentFolder.Equals(currentEmulator.PathToRoms)) { currentEmulator = null; currentFolder = null; currentSqlTail = null; currentGameProperty = gameProperty.none; fillEmulators(); facade.SelectedListItemIndex = 0; onFacadeAction(); } //Go back to parent directory else { currentFolder = currentFolder.Remove(currentFolder.LastIndexOf("\\")); fillGames(); facade.SelectedListItemIndex = 1; } } }