Beispiel #1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="folder"></param>
        /// <param name="file"></param>
        /// <param name="xElement"></param>
        private void ReadMetaData(string folder, string file, XElement xElement)
        {
            var productCode = Xml.GetValue(xElement, "product_code");

            if (productCode != null)
            {
                var companyCode = Xml.GetValue(xElement, "company_code");
                if (companyCode != null)
                {
                    string key = productCode.Replace("WUP-P-", "").Replace("WUP-U-", "").Replace("WUP-N-", "") + companyCode;

                    GameInformation game;

                    if (!gameData.ContainsKey(key))
                    {
                        game = new GameInformation {
                            GameSetting = new GameSettings()
                        };
                        gameData.Add(key, game);
                        game.Name           = Xml.GetValue(xElement, "longname_en").Replace("\n", " ");
                        game.Region         = Nintendo.GetRegion(Xml.GetValue(xElement, "region"));
                        game.Publisher      = Xml.GetValue(xElement, "publisher_en");
                        game.ProductCode    = productCode;
                        game.CompanyCode    = companyCode;
                        game.TitleId        = Xml.GetValue(xElement, "title_id").ToUpper();
                        game.GroupId        = Xml.GetValue(xElement, "group_id").ToUpper();
                        game.Size           = (FolderScanner.GetDirectorySize(folder) / 1024 / 1024).ToString("N0") + " MB";
                        game.LaunchFile     = file;
                        game.LaunchFileName = Path.GetFileName(file);
                    }
                    else
                    {
                        game                = gameData[key];
                        game.Name           = Xml.GetValue(xElement, "longname_en").Replace("\n", " ");
                        game.Region         = Nintendo.GetRegion(Xml.GetValue(xElement, "region"));
                        game.Publisher      = Xml.GetValue(xElement, "publisher_en");
                        game.ProductCode    = productCode;
                        game.CompanyCode    = companyCode;
                        game.TitleId        = Xml.GetValue(xElement, "title_id").ToUpper();
                        game.GroupId        = Xml.GetValue(xElement, "group_id").ToUpper();
                        game.LaunchFile     = file;
                        game.LaunchFileName = Path.GetFileName(file);
                    }
                }
            }
        }
Beispiel #2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="gameData"></param>
        /// <param name="folder"></param>
        /// <param name="launchFile"></param>
        private static void AddGame(Dictionary <string, GameInformation> gameData, string folder, string launchFile)
        {
            if (File.Exists(Path.Combine(folder, "meta", "meta.xml")))
            {
                XElement xElement = XElement.Parse(XDocument.Load(Path.Combine(folder, "meta", "meta.xml")).ToString());

                var productCode = Xml.GetValue(xElement, "product_code");
                if (productCode != null)
                {
                    var companyCode = Xml.GetValue(xElement, "company_code");
                    if (companyCode != null)
                    {
                        string key = productCode.Replace("WUP-P-", "").Replace("WUP-U-", "").Replace("WUP-N-", "") + companyCode;

                        GameInformation game;

                        if (!gameData.TryGetValue(key, out game))
                        {
                            game = new GameInformation {
                                GameSetting = new GameSettings()
                            };
                            gameData.Add(key, game);
                        }

                        game.Name           = Xml.GetValue(xElement, "longname_en");
                        game.Region         = Nintendo.GetRegion(Xml.GetValue(xElement, "region"));
                        game.Publisher      = Xml.GetValue(xElement, "publisher_en");
                        game.ProductCode    = productCode;
                        game.CompanyCode    = companyCode;
                        game.TitleId        = Xml.GetValue(xElement, "title_id").ToUpper();
                        game.GroupId        = Xml.GetValue(xElement, "group_id").ToUpper();
                        game.Size           = (GetDirectorySize(folder) / 1024 / 1024).ToString("N0") + " MB";
                        game.LaunchFile     = launchFile;
                        game.LaunchFileName = Path.GetFileName(launchFile);
                    }
                }
            }
        }