예제 #1
0
파일: ISO.cs 프로젝트: rejdzu/xkey-brew
 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"));
     }
 }
예제 #2
0
파일: ISO.cs 프로젝트: rejdzu/xkey-brew
        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"));
            }
        }
예제 #3
0
파일: ISO.cs 프로젝트: rejdzu/xkey-brew
        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);
            }
        }
예제 #4
0
파일: ISO.cs 프로젝트: rejdzu/xkey-brew
        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);
            }
        }