public void FillLanguageLists()
        {
            lstInterface.Items.Clear();
            lstSubtitles.Items.Clear();
            lstFullAudio.Items.Clear();

            if (Program.GameDB != null)
            {
                LanguageSupport language = Program.GameDB.GetAllLanguages();

                foreach (string s in language.Interface)
                {
                    lstInterface.Items.Add(s);
                }

                foreach (string s in language.Subtitles)
                {
                    lstSubtitles.Items.Add(s);
                }

                foreach (string s in language.FullAudio)
                {
                    lstFullAudio.Items.Add(s);
                }
            }
        }
Beispiel #2
0
        public LanguageSupport GetAllLanguages()
        {
            LanguageSupport allLanguages = new LanguageSupport();

            SortedSet <string> Interface = new SortedSet <string>(StringComparer.OrdinalIgnoreCase);
            SortedSet <string> subtitles = new SortedSet <string>(StringComparer.OrdinalIgnoreCase);
            SortedSet <string> fullAudio = new SortedSet <string>(StringComparer.OrdinalIgnoreCase);

            foreach (DatabaseEntry entry in GetAll())
            {
                if (entry.LanguageSupport.Interface != null)
                {
                    Interface.UnionWith(entry.LanguageSupport.Interface);
                }

                if (entry.LanguageSupport.Subtitles != null)
                {
                    subtitles.UnionWith(entry.LanguageSupport.Subtitles);
                }

                if (entry.LanguageSupport.FullAudio != null)
                {
                    fullAudio.UnionWith(entry.LanguageSupport.FullAudio);
                }
            }

            allLanguages.Interface = Interface.ToList();
            allLanguages.Subtitles = subtitles.ToList();
            allLanguages.FullAudio = fullAudio.ToList();

            return(allLanguages);
        }
        public override AutoCatResult CategorizeGame(GameInfo game, Filter filter)
        {
            if (games == null)
            {
                Program.Logger.Error(GlobalStrings.Log_AutoCat_GamelistNull);
                throw new ApplicationException(GlobalStrings.AutoCatGenre_Exception_NoGameList);
            }

            if (db == null)
            {
                Program.Logger.Error(GlobalStrings.Log_AutoCat_DBNull);
                throw new ApplicationException(GlobalStrings.AutoCatGenre_Exception_NoGameDB);
            }

            if (game == null)
            {
                Program.Logger.Error(GlobalStrings.Log_AutoCat_GameNull);
                return(AutoCatResult.Failure);
            }

            if (!db.Contains(game.Id) || db.Games[game.Id].LastStoreScrape == 0)
            {
                return(AutoCatResult.NotInDatabase);
            }

            if (!game.IncludeGame(filter))
            {
                return(AutoCatResult.Filtered);
            }

            LanguageSupport languageSupport = db.Games[game.Id].LanguageSupport;

            IEnumerable <string> interfaceLanguage = languageSupport.Interface.Intersect(IncludedLanguages.Interface);

            foreach (string catString in interfaceLanguage)
            {
                Category c = games.GetCategory(GetProcessedString(catString, "Interface"));
                game.AddCategory(c);
            }

            foreach (string catString in IncludedLanguages.Subtitles)
            {
                if (languageSupport.Subtitles.Contains(catString) || languageSupport.Subtitles.Count == 0 && languageSupport.FullAudio.Contains(catString) || languageSupport.FullAudio.Count == 0 && languageSupport.Interface.Contains(catString))
                {
                    game.AddCategory(games.GetCategory(GetProcessedString(catString, "Subtitles")));
                }
            }

            foreach (string catString in IncludedLanguages.FullAudio)
            {
                if (languageSupport.FullAudio.Contains(catString) || languageSupport.FullAudio.Count == 0 && languageSupport.Subtitles.Contains(catString) || languageSupport.Subtitles.Count == 0 && languageSupport.Interface.Contains(catString))
                {
                    game.AddCategory(games.GetCategory(GetProcessedString(catString, "Full Audio")));
                }
            }

            return(AutoCatResult.Success);
        }
 protected AutoCatLanguage(AutoCatLanguage other) : base(other)
 {
     Filter            = other.Filter;
     Prefix            = other.Prefix;
     IncludeTypePrefix = other.IncludeTypePrefix;
     TypeFallback      = other.TypeFallback;
     IncludedLanguages = other.IncludedLanguages;
     Selected          = other.Selected;
 }
Beispiel #5
0
        public LanguageSupport AllLanguageSupport()
        {
            LanguageSupport languageSupport;

            lock (Games)
            {
                SortedSet <string> sortedFullAudio  = new SortedSet <string>(StringComparer.OrdinalIgnoreCase);
                SortedSet <string> sortedInterfaces = new SortedSet <string>(StringComparer.OrdinalIgnoreCase);
                SortedSet <string> sortedSubtitles  = new SortedSet <string>(StringComparer.OrdinalIgnoreCase);

                foreach (DatabaseEntry entry in Games.Values)
                {
                    if (entry.LanguageSupport.FullAudio != null)
                    {
                        sortedFullAudio.UnionWith(entry.LanguageSupport.FullAudio);
                    }

                    if (entry.LanguageSupport.Interface != null)
                    {
                        sortedInterfaces.UnionWith(entry.LanguageSupport.Interface);
                    }

                    if (entry.LanguageSupport.Subtitles != null)
                    {
                        sortedSubtitles.UnionWith(entry.LanguageSupport.Subtitles);
                    }
                }

                languageSupport = new LanguageSupport
                {
                    FullAudio = sortedFullAudio.ToList(),
                    Interface = sortedInterfaces.ToList(),
                    Subtitles = sortedSubtitles.ToList()
                };
            }

            return(languageSupport);
        }
        public void FillLanguageLists()
        {
            lstInterface.Items.Clear();
            lstSubtitles.Items.Clear();
            lstFullAudio.Items.Clear();

            LanguageSupport language = Database.AllLanguages;

            foreach (string s in language.Interface)
            {
                lstInterface.Items.Add(s);
            }

            foreach (string s in language.Subtitles)
            {
                lstSubtitles.Items.Add(s);
            }

            foreach (string s in language.FullAudio)
            {
                lstFullAudio.Items.Add(s);
            }
        }