Exemple #1
0
        /// <summary>
        /// Main constructor of IsoGameInfo
        /// </summary>
        /// <param name="path">path to iso file</param>
        public IsoGameInfo(string path)
        {
            try
            {
                this.path = path;
                Iso iso = new Iso(path);

                this.xexHeader = ObjectCopier.Clone<XeXHeader>(iso.DefaultXeX.XeXHeader);
                this.defaultXexFile = new byte[iso.DefaultXeX.File.Length];
                iso.DefaultXeX.File.CopyTo(this.defaultXexFile, 0);
                this.isoType = iso.IsoType;
                //this.gameInfo = new GameInfo(this.xexHeader.TitleId);

                iso.Dispose();
                iso = null;
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Exemple #2
0
 public string GameTrailer(bool chkTrailers)
 {
     Log.Text = string.Concat(Log.Text, "Finding Trailler", Path, Environment.NewLine);
     if (!File.Exists(Path.Replace(IsoFile.Extension, ".wmv")))
     {
         if (chkTrailers)
         {
             try
             {
                 var isoGame = new Iso(IsoFile.FullName, true);
                 if (isoGame.DefaultXeX != null)
                 {
                     Log.Text = string.Concat(Log.Text, "Xbox.com", Path, Environment.NewLine);
                     var wc = new WbClient();
                     string page =
                         wc.DownloadString(wc.RedirectURL(this,
                                                          ("http://marketplace.xbox.com/en-US/games/media/66acd000-77fe-1000-9115-d802" +
                                                           isoGame.DefaultXeX.XeXHeader.TitleId.ToLower()) +
                                                          "?nosplash=1"));
                     var regexReplacer = new Regex("addVideo\\('[^,]*,");
                     Match regexmatchResult = regexReplacer.Match(page);
                     if (!regexmatchResult.Success)
                     {
                     }
                     else
                     {
                         string strVideoAsx =
                             wc.DownloadString(
                                 regexmatchResult.Value.Replace("\\x3a", ":").Replace("\\x2f", "/").Substring(10)
                                     .Replace(",", "").Trim());
                         regexReplacer = new Regex("href=\"[^\"]*\"");
                         regexmatchResult = regexReplacer.Match(strVideoAsx);
                         Log.Text = string.Concat(Log.Text, "Downloading", Path, Environment.NewLine);
                         string strVideoUrl = regexmatchResult.Value.Replace("href=\"", "").Replace("\"", "");
                         wc.DownloadFile(strVideoUrl, Path.Replace(IsoFile.Extension, ".wmv"), ProgressBar1);
                         string str = Path.Replace(IsoFile.Extension, ".wmv");
                         return str;
                     }
                 }
             }
             catch (Exception)
             {
                 ProgressBar1.Value = 0;
                 Log.Text = string.Concat(Log.Text, "Failed", Path, Environment.NewLine);
             }
         }
         Log.Text = string.Concat(Log.Text, "Not Found", Path, Environment.NewLine);
         return "media\\blank.mpg";
     }
     {
         Log.Text = string.Concat(Log.Text, "Local", Path, Environment.NewLine);
         return Path.Replace(IsoFile.Extension, ".wma");
     }
 }
Exemple #3
0
 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");
     }
 }
Exemple #4
0
 public string GameTitle(bool chkArtwork)
 {
     Log.Text = string.Concat(Log.Text, "Finding Title", Path, Environment.NewLine);
     var waffle = new WaffleXML(Path.Replace(IsoFile.Extension, ".xml"));
     if (waffle.Title == "")
     {
         if (chkArtwork)
         {
             try
             {
                 var iso = new Iso(IsoFile.FullName, true);
                 if (iso.DefaultXeX != null)
                 {
                     Log.Text = string.Concat(Log.Text, "Xbox.com search", Path, Environment.NewLine);
                     var wc = new WbClient();
                     string page =
                         wc.DownloadString(wc.RedirectURL(this,
                                                          "http://marketplace.xbox.com/en-US/games/media/66acd000-77fe-1000-9115-d802" +
                                                          iso.DefaultXeX.XeXHeader.TitleId.ToLower() +
                                                          "?nosplash=1"));
                     if (page.IndexOf("<title>", StringComparison.Ordinal) != 0)
                     {
                         int startIndex = page.IndexOf("<title>", StringComparison.Ordinal) + 7;
                         string title = page.Substring(startIndex);
                         title = title.Substring(0, title.IndexOf(" - Xbox.com", StringComparison.Ordinal));
                         title = title.Trim().Replace("\n", "");
                         title = HttpUtility.HtmlDecode(title);
                         if (title != null) title = title.Replace("&", "&amp;");
                         waffle.Title = title;
                         return title;
                     }
                 }
                 else
                 {
                     throw new Exception("Not a Game");
                 }
             }
             catch (Exception)
             {
                 return Gamename;
             }
         }
         Log.Text = string.Concat(Log.Text, "Using filename", Path, Environment.NewLine);
         return Gamename;
     }
     {
         Log.Text = string.Concat(Log.Text, "Found in XML", Path, Environment.NewLine);
         return waffle.Title;
     }
 }
Exemple #5
0
 public string GameGenre(bool chkArtwork)
 {
     Log.Text = string.Concat(Log.Text, "Finding Genre", Path, Environment.NewLine);
     var waffle = new WaffleXML(Path.Replace(IsoFile.Extension, ".xml"));
     if (waffle.InfoItem("Genre") == "")
     {
         if (chkArtwork)
         {
             try
             {
                 var iso = new Iso(IsoFile.FullName, true);
                 if (iso.DefaultXeX != null)
                 {
                     Log.Text = string.Concat(Log.Text, "Xbox.com Search", Path, Environment.NewLine);
                     var wc = new WbClient();
                     string page =
                         wc.DownloadString(wc.RedirectURL(this,
                                                          "http://marketplace.xbox.com/en-US/games/media/66acd000-77fe-1000-9115-d802" +
                                                          iso.DefaultXeX.XeXHeader.TitleId.ToLower() +
                                                          "?nosplash=1"));
                     if (page.IndexOf("Genre:", StringComparison.Ordinal) != 0)
                     {
                         int startIndex = page.IndexOf("Genre:", StringComparison.Ordinal) + 6;
                         string genre = page.Substring(startIndex);
                         genre = genre.Substring(0, genre.IndexOf("</li>", StringComparison.Ordinal));
                         string htmlDecode = HttpUtility.HtmlDecode(genre.Trim().Replace("\n", ""));
                         if (htmlDecode != null)
                             genre = htmlDecode.Replace("<li>", "").Replace("</label>", "");
                         waffle.InfoItem("Genre", genre);
                         Log.Text = string.Concat(Log.Text, "Found", Path, Environment.NewLine);
                         return genre;
                     }
                 }
                 else
                 {
                     throw new Exception("Not a Game");
                 }
             }
             catch (Exception)
             {
                 return "";
             }
         }
         Log.Text = string.Concat(Log.Text, "No Genre Found", Path, Environment.NewLine);
         return "";
     }
     {
         Log.Text = string.Concat(Log.Text, "Found in XML file", Path, Environment.NewLine);
         return waffle.InfoItem("Genre");
     }
 }
Exemple #6
0
 public string GameDesc(bool chkArtwork)
 {
     Log.Text = string.Concat(Log.Text, "Finding Desc", Path, Environment.NewLine);
     var waffleXMLFile = new WaffleXML(Path.Replace(IsoFile.Extension, ".xml"));
     if (waffleXMLFile.Summary == "")
     {
         if (chkArtwork)
         {
             try
             {
                 var iso = new Iso(IsoFile.FullName, true);
                 if (iso.DefaultXeX == null)
                 {
                 }
                 else
                 {
                     Log.Text = string.Concat(Log.Text, "Xbox.com Desc", Path, Environment.NewLine);
                     var wc = new WbClient();
                     string page =
                         wc.DownloadString(wc.RedirectURL(this,
                                                          "http://marketplace.xbox.com/en-US/games/media/66acd000-77fe-1000-9115-d802" +
                                                          iso.DefaultXeX.XeXHeader.TitleId.ToLower() +
                                                          "?nosplash=1"));
                     var replacer = new Regex("<meta name=\"description\" content=\".*\" />");
                     Match results = replacer.Match(page);
                     string desc = results.Value.Substring(34);
                     desc = desc.Substring(0, desc.Length - 5).Trim();
                     waffleXMLFile.Summary = desc;
                     Log.Text = string.Concat(Log.Text, "Found", Path, Environment.NewLine);
                     return desc;
                 }
             }
             catch (Exception)
             {
                 return "";
             }
         }
         Log.Text = string.Concat(Log.Text, "Not Found", Path, Environment.NewLine);
         return "";
     }
     {
         Log.Text = string.Concat(Log.Text, "In XML", Path, Environment.NewLine);
         return waffleXMLFile.Summary;
     }
 }
Exemple #7
0
 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");
     }
 }
Exemple #8
0
 public DefaultXeX(Iso iso)
 {
     this.iso = iso;
     ExtractInfo();
 }