public string GameBox(bool chkArtwork) { Log.Text = string.Concat(Log.Text, "Finding cover for:", Path, Environment.NewLine); if ( !(File.Exists(string.Concat(Path.Replace(IsoFile.Extension, ""), "-cover.jpg")) | File.Exists(string.Concat(Path.Replace(IsoFile.Extension, ""), "-cover.png")))) { var waffle = new WaffleXML(Path.Replace(IsoFile.Extension, ".xml")); if (waffle.BoxArt == null) { if (chkArtwork) { try { var iso = new Iso(IsoFile.FullName, true); if (iso.DefaultXeX != null) { Log.Text = string.Concat(Log.Text, "Searching Xbox.com for cover", Path, Environment.NewLine); var wc = new WbClient(); byte[] data = wc.DownloadData(string.Concat("http://tiles.xbox.com/consoleAssets/", iso.DefaultXeX.XeXHeader.TitleId.ToLower(), "/en-US/largeboxart.jpg")); if (data != null) { waffle.BoxArt = data; Log.Text = string.Concat(Log.Text, "Cover saved to XML", Path, Environment.NewLine); return(GameBox(true)); } { throw new Exception("Download Failed"); } } { throw new Exception("Not a Game"); } } catch (Exception) { Log.Text = string.Concat(Log.Text, "Download Failed", Path, Environment.NewLine); Log.Text = string.Concat(Log.Text, "No Cover found", Path, Environment.NewLine); return("media\\blank-cover.jpg"); } } Log.Text = string.Concat(Log.Text, "No Cover found", Path, Environment.NewLine); return("media\\blank-cover.jpg"); } { var binWritter = new StreamWriter( string.Concat(Application.StartupPath, "\\temp\\", Filename.Replace(IsoFile.Extension, "-cover.jpg")), false); binWritter.BaseStream.Write(waffle.BoxArt, 0, waffle.BoxArt.Length); binWritter.Flush(); binWritter.Close(); Log.Text = string.Concat(Log.Text, "Found in XML", Path, Environment.NewLine); return(string.Concat(Application.StartupPath, "\\temp\\", Filename.Replace(IsoFile.Extension, "-cover.jpg"))); } } { if (File.Exists(string.Concat(Path.Replace(IsoFile.Extension, ""), "-cover.png"))) { return(string.Concat(Path.Replace(IsoFile.Extension, ""), "-cover.png")); } Log.Text = string.Concat(Log.Text, "Local cover found", Path, Environment.NewLine); return(string.Concat(Path.Replace(IsoFile.Extension, ""), "-cover.jpg")); } }
public string GameBannerBasic(bool chkArtwork) { Log.Text = string.Concat(Log.Text, "Loading banner:", Path, Environment.NewLine); if (!File.Exists(string.Concat(Path.Replace(IsoFile.Extension, ""), "-banner.png"))) { var waffle = new WaffleXML(Path.Replace(IsoFile.Extension, ".xml")); if (waffle.Banner == null) { if (chkArtwork) { try { var iso = new Iso(IsoFile.FullName, true); if (iso.DefaultXeX != null) { Log.Text = string.Concat(Log.Text, "Searching Xbox.com for banner:", Path, Environment.NewLine); var wc = new WbClient(); byte[] data = wc.DownloadData( string.Concat( "http://download.xbox.com/content/images/66acd000-77fe-1000-9115-d802", iso.DefaultXeX.XeXHeader.TitleId.ToLower(), "/1033/banner.png")); if (data == null) { throw new Exception("Download Failed"); } { waffle.Banner = data; TextBox textBox1 = Log; textBox1.Text = string.Concat(textBox1.Text, "Banner saved to XML File", Path, Environment.NewLine); return(GameBanner(true)); } } { throw new Exception("Not a Game"); } } catch (Exception) { Log.Text = string.Concat(Log.Text, "Banner Download Failed:", Path, Environment.NewLine); Log.Text = string.Concat(Log.Text, "No banner found:", Path, Environment.NewLine); return("media\\blank-banner.png"); } } Log.Text = string.Concat(Log.Text, "No banner found:", Path, Environment.NewLine); return("media\\blank-banner.png"); } { var binWritter = new StreamWriter( string.Concat(Application.StartupPath, "\\temp\\", Filename.Replace(IsoFile.Extension, "-banner.png")), false); binWritter.BaseStream.Write(waffle.Banner, 0, waffle.Banner.Length); binWritter.Flush(); binWritter.Close(); Log.Text = string.Concat(Log.Text, "Banner found in XML:", Path, Environment.NewLine); return(string.Concat(Application.StartupPath, "\\temp\\", Filename.Replace(IsoFile.Extension, "-banner.png"))); } } { Log.Text = string.Concat(Log.Text, "Local Banner Found:", Path, Environment.NewLine); return(string.Concat(Path.Replace(IsoFile.Extension, ""), "-banner.png")); } }