Esempio n. 1
0
        public override bool Equals(Object obj)
        {
            if (obj == null)
            {
                return(false);
            }

            WiiGame p = obj as WiiGame;

            if ((Object)p == null)
            {
                return(false);
            }

            if (this.id.Equals(p.id) &&
                this.title.Equals(p.title) &&
                this.customTitle.Equals(p.customTitle) &&
                this.iosRequired.Equals(p.iosRequired) &&
                this.region.Equals(p.region) &&
                this.size.Equals(p.size) &&
                this.gameType.Equals(p.gameType) &&
                this.gamePath.Equals(p.gamePath))
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Esempio n. 2
0
        public List <WiiGame> ListGames(string gamePath, string langCode)
        {
            List <WiiGame> result = new List <WiiGame>();

            char[]           separateur;
            ProcessStartInfo processInfo;

            if (!isStopRequired && !String.IsNullOrEmpty(gamePath))
            {
                processInfo = new ProcessStartInfo(witPath);
                if (!String.IsNullOrEmpty(langCode))
                {
                    processInfo.Arguments = @"list --real-path --sections --title titles-" + langCode + ".txt --recurse \"" + gamePath + "\"";
                }
                else
                {
                    processInfo.Arguments = @"list --real-path --sections --title titles.txt --recurse " + gamePath + "\"";
                }

                processInfo.UseShellExecute        = false;
                processInfo.CreateNoWindow         = true;
                processInfo.RedirectStandardOutput = true;
                processInfo.StandardOutputEncoding = System.Text.Encoding.UTF8;

                Process witProcess = new Process();
                witProcess.StartInfo = processInfo;

                witProcess.Start();

                string output = witProcess.StandardOutput.ReadToEnd();

                witProcess.WaitForExit();
                witProcess.Close();

                separateur = "\0".ToCharArray();

                string[] outputs = output.Replace("\r\n\r\n", "\0").Split(separateur, StringSplitOptions.RemoveEmptyEntries);

                foreach (string info in outputs)
                {
                    if (!String.IsNullOrEmpty(info) && !isStopRequired)
                    {
                        separateur = "\r\n".ToCharArray();

                        string[] infos = info.Split(separateur, StringSplitOptions.RemoveEmptyEntries);

                        if (infos.Length == 18)
                        {
                            WiiGame game = new WiiGame();

                            game.id          = infos[1].Replace("id=", "");
                            game.title       = infos[2].Replace("name=", "");
                            game.customTitle = infos[3].Replace("title=", "");
                            game.region      = infos[4].Replace("region=", "");

                            try
                            {
                                game.size = long.Parse(infos[5].Replace("size=", ""));
                            }
                            catch
                            {
                                game.size = -1;
                            }

                            try
                            {
                                game.gameType = (GameType)Enum.Parse(typeof(GameType), infos[11].Replace("container=", ""), true);
                            }
                            catch
                            {
                                game.gameType = GameType.unknown;
                            }

                            game.gamePath = infos[16].Replace("filename=", "");

                            game.gamePath = this.formatPath(game.gamePath);

                            game.iosRequired = this.GetRequiredIOS(game.gamePath);

                            result.Add(game);
                        }
                    }
                }
            }

            fireThreadFinish(isStopRequired);

            return(result);
        }
Esempio n. 3
0
        public List<WiiGame> ListGames(string gamePath, string langCode)
        {
            List<WiiGame> result = new List<WiiGame>();
            char[] separateur;
            ProcessStartInfo processInfo;

            if (!isStopRequired && !String.IsNullOrEmpty(gamePath))
            {
                processInfo = new ProcessStartInfo(witPath);
                if (!String.IsNullOrEmpty(langCode))
                {
                    processInfo.Arguments = @"list --real-path --sections --title titles-" + langCode + ".txt --recurse \"" + gamePath + "\"";
                }
                else
                {
                    processInfo.Arguments = @"list --real-path --sections --title titles.txt --recurse " + gamePath + "\"";
                }

                processInfo.UseShellExecute = false;
                processInfo.CreateNoWindow = true;
                processInfo.RedirectStandardOutput = true;
                processInfo.StandardOutputEncoding = System.Text.Encoding.UTF8;

                Process witProcess = new Process();
                witProcess.StartInfo = processInfo;

                witProcess.Start();

                string output = witProcess.StandardOutput.ReadToEnd();

                witProcess.WaitForExit();
                witProcess.Close();

                separateur = "\0".ToCharArray();

                string[] outputs = output.Replace("\r\n\r\n", "\0").Split(separateur, StringSplitOptions.RemoveEmptyEntries);

                foreach (string info in outputs)
                {
                    if (!String.IsNullOrEmpty(info) && !isStopRequired)
                    {

                        separateur = "\r\n".ToCharArray();

                        string[] infos = info.Split(separateur, StringSplitOptions.RemoveEmptyEntries);

                        if (infos.Length == 18)
                        {
                            WiiGame game = new WiiGame();

                            game.id = infos[1].Replace("id=", "");
                            game.title = infos[2].Replace("name=", "");
                            game.customTitle = infos[3].Replace("title=", "");
                            game.region = infos[4].Replace("region=", "");

                            try
                            {
                                game.size = long.Parse(infos[5].Replace("size=", ""));
                            }
                            catch
                            {
                                game.size = -1;
                            }

                            try
                            {
                                game.gameType = (GameType)Enum.Parse(typeof(GameType), infos[11].Replace("container=", ""), true);
                            }
                            catch
                            {
                                game.gameType = GameType.unknown;
                            }

                            game.gamePath = infos[16].Replace("filename=", "");

                            game.gamePath = this.formatPath(game.gamePath);

                            game.iosRequired = this.GetRequiredIOS(game.gamePath);

                            result.Add(game);
                        }
                    }
                }
            }

            fireThreadFinish(isStopRequired);

            return result;
        }