Example #1
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);
            }
        }
Example #2
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"));
            }
        }
Example #3
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);
            }
        }
Example #4
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");
     }
 }
Example #5
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;
     }
 }
Example #6
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");
     }
 }
Example #7
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;
     }
 }
Example #8
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");
     }
 }
Example #9
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"));
     }
 }
Example #10
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"));
     }
 }