コード例 #1
0
        public static AutoCatFlags LoadFromXmlElement(XmlElement xElement)
        {
            string        name   = XmlUtil.GetStringFromNode(xElement[XmlName_Name], TypeIdString);
            string        filter = XmlUtil.GetStringFromNode(xElement[XmlName_Filter], null);
            string        prefix = XmlUtil.GetStringFromNode(xElement[XmlName_Prefix], null);
            List <string> flags  = new List <string>();

            XmlElement flagListElement = xElement[XmlName_FlagList];

            if (flagListElement == null)
            {
                return(new AutoCatFlags(name, filter, prefix, flags));
            }

            XmlNodeList flagElements = flagListElement.SelectNodes(XmlName_Flag);

            foreach (XmlNode n in flagElements)
            {
                if (XmlUtil.TryGetStringFromNode(n, out string flag))
                {
                    flags.Add(flag);
                }
            }

            return(new AutoCatFlags(name, filter, prefix, flags));
        }
コード例 #2
0
        public static AutoCatGenre LoadFromXmlElement(XmlElement xElement)
        {
            string name        = XmlUtil.GetStringFromNode(xElement[XmlName_Name], TypeIdString);
            string filter      = XmlUtil.GetStringFromNode(xElement[XmlName_Filter], null);
            int    maxCats     = XmlUtil.GetIntFromNode(xElement[XmlName_MaxCats], 0);
            bool   remOther    = XmlUtil.GetBoolFromNode(xElement[XmlName_RemOther], false);
            bool   tagFallback = XmlUtil.GetBoolFromNode(xElement[XmlName_TagFallback], true);
            string prefix      = XmlUtil.GetStringFromNode(xElement[XmlName_Prefix], null);

            List <string> ignore = new List <string>();

            XmlElement ignoreListElement = xElement[XmlName_IgnoreList];

            if (ignoreListElement != null)
            {
                XmlNodeList ignoreNodes = ignoreListElement.SelectNodes(XmlName_IgnoreItem);
                foreach (XmlNode node in ignoreNodes)
                {
                    if (XmlUtil.TryGetStringFromNode(node, out string s))
                    {
                        ignore.Add(s);
                    }
                }
            }

            AutoCatGenre result = new AutoCatGenre(name, filter, prefix, maxCats, remOther, tagFallback, ignore);

            return(result);
        }
コード例 #3
0
        public static AutoCatLanguage LoadFromXmlElement(XmlElement xElement)
        {
            string        name              = XmlUtil.GetStringFromNode(xElement[XmlNameName], TypeIdString);
            string        filter            = XmlUtil.GetStringFromNode(xElement[XmlNameFilter], null);
            string        prefix            = XmlUtil.GetStringFromNode(xElement[XmlNamePrefix], null);
            bool          includeTypePrefix = XmlUtil.GetBoolFromNode(xElement[XmlNameIncludeTypePrefix], false);
            bool          typeFallback      = XmlUtil.GetBoolFromNode(xElement[XmlNameTypeFallback], false);
            List <string> interfaceList     = new List <string>();
            List <string> subtitlesList     = new List <string>();
            List <string> fullAudioList     = new List <string>();

            XmlElement interfaceLanguage = xElement[XmlNameInterfaceList];
            XmlElement subtitles         = xElement[XmlNameSubtitlesList];
            XmlElement fullAudio         = xElement[XmlNameFullAudioList];

            XmlNodeList interfaceElements = interfaceLanguage?.SelectNodes(XmlNameLanguage);

            if (interfaceElements != null)
            {
                for (int i = 0; i < interfaceElements.Count; i++)
                {
                    XmlNode n = interfaceElements[i];
                    if (XmlUtil.TryGetStringFromNode(n, out string language))
                    {
                        interfaceList.Add(language);
                    }
                }
            }

            XmlNodeList subtitlesElements = subtitles?.SelectNodes(XmlNameLanguage);

            if (subtitlesElements != null)
            {
                for (int i = 0; i < subtitlesElements.Count; i++)
                {
                    XmlNode n = subtitlesElements[i];
                    if (XmlUtil.TryGetStringFromNode(n, out string language))
                    {
                        subtitlesList.Add(language);
                    }
                }
            }

            XmlNodeList fullAudioElements = fullAudio?.SelectNodes(XmlNameLanguage);

            if (fullAudioElements != null)
            {
                for (int i = 0; i < fullAudioElements.Count; i++)
                {
                    XmlNode n = fullAudioElements[i];
                    if (XmlUtil.TryGetStringFromNode(n, out string language))
                    {
                        fullAudioList.Add(language);
                    }
                }
            }

            return(new AutoCatLanguage(name, filter, prefix, includeTypePrefix, typeFallback, interfaceList, subtitlesList, fullAudioList));
        }
コード例 #4
0
        public static AutoCatVrSupport LoadFromXmlElement(XmlElement xElement)
        {
            string        name         = XmlUtil.GetStringFromNode(xElement[XmlNameName], TypeIdString);
            string        filter       = XmlUtil.GetStringFromNode(xElement[XmlNameFilter], null);
            string        prefix       = XmlUtil.GetStringFromNode(xElement[XmlNamePrefix], null);
            List <string> headsetsList = new List <string>();
            List <string> inputList    = new List <string>();
            List <string> playAreaList = new List <string>();

            XmlElement headset  = xElement[XmlNameHeadsetsList];
            XmlElement input    = xElement[XmlNameInputList];
            XmlElement playArea = xElement[XmlNamePlayAreaList];

            XmlNodeList headsetElements = headset?.SelectNodes(XmlNameFlag);

            if (headsetElements != null)
            {
                for (int i = 0; i < headsetElements.Count; i++)
                {
                    XmlNode n = headsetElements[i];
                    if (XmlUtil.TryGetStringFromNode(n, out string flag))
                    {
                        headsetsList.Add(flag);
                    }
                }
            }

            XmlNodeList inputElements = input?.SelectNodes(XmlNameFlag);

            if (inputElements != null)
            {
                for (int i = 0; i < inputElements.Count; i++)
                {
                    XmlNode n = inputElements[i];
                    if (XmlUtil.TryGetStringFromNode(n, out string flag))
                    {
                        inputList.Add(flag);
                    }
                }
            }

            XmlNodeList playAreaElements = playArea?.SelectNodes(XmlNameFlag);

            if (playAreaElements != null)
            {
                for (int i = 0; i < playAreaElements.Count; i++)
                {
                    XmlNode n = playAreaElements[i];
                    if (XmlUtil.TryGetStringFromNode(n, out string flag))
                    {
                        playAreaList.Add(flag);
                    }
                }
            }

            return(new AutoCatVrSupport(name, filter, prefix, headsetsList, inputList, playAreaList));
        }
コード例 #5
0
        public static AutoCatTags LoadFromXmlElement(XmlElement xElement)
        {
            string name = XmlUtil.GetStringFromNode(xElement[XmlName_Name], TypeIdString);

            AutoCatTags result = new AutoCatTags(name)
            {
                Filter = XmlUtil.GetStringFromNode(xElement[XmlName_Filter], null)
            };

            if (XmlUtil.TryGetStringFromNode(xElement[XmlName_Prefix], out string prefix))
            {
                result.Prefix = prefix;
            }

            if (XmlUtil.TryGetIntFromNode(xElement[XmlName_MaxTags], out int maxTags))
            {
                result.MaxTags = maxTags;
            }

            if (XmlUtil.TryGetBoolFromNode(xElement[XmlName_ListOwnedOnly], out bool listOwnedOnly))
            {
                result.List_OwnedOnly = listOwnedOnly;
            }

            if (XmlUtil.TryGetFloatFromNode(xElement[XmlName_ListWeightFactor], out float listWeightFactor))
            {
                result.List_WeightFactor = listWeightFactor;
            }

            if (XmlUtil.TryGetIntFromNode(xElement[XmlName_ListMinScore], out int listMinScore))
            {
                result.List_MinScore = listMinScore;
            }

            if (XmlUtil.TryGetIntFromNode(xElement[XmlName_ListTagsPerGame], out int listTagsPerGame))
            {
                result.List_TagsPerGame = listTagsPerGame;
            }

            if (XmlUtil.TryGetBoolFromNode(xElement[XmlName_ListScoreSort], out bool listScoreSort))
            {
                result.List_ScoreSort = listScoreSort;
            }

            if (XmlUtil.TryGetBoolFromNode(xElement[XmlName_ListExcludeGenres], out bool listExcludeGenres))
            {
                result.List_ExcludeGenres = listExcludeGenres;
            }

            List <string> tagList = XmlUtil.GetStringsFromNodeList(xElement.SelectNodes(XmlName_TagList + "/" + XmlName_Tag));

            result.IncludedTags = tagList == null ? new HashSet <string>() : new HashSet <string>(tagList);

            return(result);
        }
コード例 #6
0
        private static void AddFilterFromXmlNode(XmlNode node, Profile profile)
        {
            if (!XmlUtil.TryGetStringFromNode(node[XmlName_FilterName], out string name))
            {
                return;
            }

            Filter filter = profile.GameData.AddFilter(name);

            if (XmlUtil.TryGetIntFromNode(node[XmlName_FilterUncategorized], out int uncategorized))
            {
                filter.Uncategorized = uncategorized;
            }

            if (XmlUtil.TryGetIntFromNode(node[XmlName_FilterHidden], out int hidden))
            {
                filter.Hidden = hidden;
            }

            if (XmlUtil.TryGetIntFromNode(node[XmlName_FilterVR], out int vr))
            {
                filter.VR = vr;
            }

            XmlNodeList filterNodes = node.SelectNodes(XmlName_FilterAllow);

            foreach (XmlNode fNode in filterNodes)
            {
                if (XmlUtil.TryGetStringFromNode(fNode, out string catName))
                {
                    filter.Allow.Add(profile.GameData.GetCategory(catName));
                }
            }

            filterNodes = node.SelectNodes(XmlName_FilterRequire);
            foreach (XmlNode fNode in filterNodes)
            {
                string catName;
                if (XmlUtil.TryGetStringFromNode(fNode, out catName))
                {
                    filter.Require.Add(profile.GameData.GetCategory(catName));
                }
            }

            filterNodes = node.SelectNodes(XmlName_FilterExclude);
            foreach (XmlNode fNode in filterNodes)
            {
                string catName;
                if (XmlUtil.TryGetStringFromNode(fNode, out catName))
                {
                    filter.Exclude.Add(profile.GameData.GetCategory(catName));
                }
            }
        }
コード例 #7
0
        private static void AddGameFromXmlNode(XmlNode node, Profile profile, int profileVersion)
        {
            int id;

            if (XmlUtil.TryGetIntFromNode(node[XmlName_Game_Id], out id))
            {
                GameListingSource source = XmlUtil.GetEnumFromNode(node[XmlName_Game_Source], GameListingSource.Unknown);

                if ((source < GameListingSource.Manual) && profile.IgnoreList.Contains(id))
                {
                    return;
                }

                string   name = XmlUtil.GetStringFromNode(node[XmlName_Game_Name], null);
                GameInfo game = new GameInfo(id, name, profile.GameData);
                game.Source = source;
                profile.GameData.Games.Add(id, game);

                game.Hidden     = XmlUtil.GetBoolFromNode(node[XmlName_Game_Hidden], false);
                game.Executable = XmlUtil.GetStringFromNode(node[XmlName_Game_Executable], null);
                game.LastPlayed = XmlUtil.GetIntFromNode(node[XmlName_Game_LastPlayed], 0);

                if (profileVersion < 1)
                {
                    string catName;
                    if (XmlUtil.TryGetStringFromNode(node[XmlName_Game_Category], out catName))
                    {
                        game.AddCategory(profile.GameData.GetCategory(catName));
                    }

                    if (node.SelectSingleNode(XmlName_Old_Game_Favorite) != null)
                    {
                        game.SetFavorite(true);
                    }
                }
                else
                {
                    XmlNode catListNode = node.SelectSingleNode(XmlName_Game_CategoryList);
                    if (catListNode != null)
                    {
                        XmlNodeList catNodes = catListNode.SelectNodes(XmlName_Game_Category);
                        foreach (XmlNode cNode in catNodes)
                        {
                            string cat;
                            if (XmlUtil.TryGetStringFromNode(cNode, out cat))
                            {
                                game.AddCategory(profile.GameData.GetCategory(cat));
                            }
                        }
                    }
                }
            }
        }
コード例 #8
0
        private static void AddFilterFromXmlNode(XmlNode node, Profile profile)
        {
            string name;

            if (XmlUtil.TryGetStringFromNode(node[XmlName_FilterName], out name))
            {
                Filter f = profile.GameData.AddFilter(name);
                if (!XmlUtil.TryGetIntFromNode(node[XmlName_FilterUncategorized], out f.Uncategorized))
                {
                    f.Uncategorized = -1;
                }

                if (!XmlUtil.TryGetIntFromNode(node[XmlName_FilterHidden], out f.Hidden))
                {
                    f.Hidden = -1;
                }

                if (!XmlUtil.TryGetIntFromNode(node[XmlName_FilterVR], out f.VR))
                {
                    f.VR = -1;
                }

                XmlNodeList filterNodes = node.SelectNodes(XmlName_FilterAllow);
                foreach (XmlNode fNode in filterNodes)
                {
                    string catName;
                    if (XmlUtil.TryGetStringFromNode(fNode, out catName))
                    {
                        f.Allow.Add(profile.GameData.GetCategory(catName));
                    }
                }

                filterNodes = node.SelectNodes(XmlName_FilterRequire);
                foreach (XmlNode fNode in filterNodes)
                {
                    string catName;
                    if (XmlUtil.TryGetStringFromNode(fNode, out catName))
                    {
                        f.Require.Add(profile.GameData.GetCategory(catName));
                    }
                }

                filterNodes = node.SelectNodes(XmlName_FilterExclude);
                foreach (XmlNode fNode in filterNodes)
                {
                    string catName;
                    if (XmlUtil.TryGetStringFromNode(fNode, out catName))
                    {
                        f.Exclude.Add(profile.GameData.GetCategory(catName));
                    }
                }
            }
        }
コード例 #9
0
        public static AutoCatDevPub LoadFromXmlElement(XmlElement xElement)
        {
            string name          = XmlUtil.GetStringFromNode(xElement[XmlName_Name], TypeIdString);
            string filter        = XmlUtil.GetStringFromNode(xElement[XmlName_Filter], null);
            bool   AllDevelopers = XmlUtil.GetBoolFromNode(xElement[XmlName_AllDevelopers], false);
            bool   AllPublishers = XmlUtil.GetBoolFromNode(xElement[XmlName_AllPublishers], false);
            string prefix        = XmlUtil.GetStringFromNode(xElement[XmlName_Prefix], null);
            bool   owned         = XmlUtil.GetBoolFromNode(xElement[XmlName_OwnedOnly], false);
            int    count         = XmlUtil.GetIntFromNode(xElement[XmlName_MinCount], 0);

            List <string> devs = new List <string>();

            XmlElement devsListElement = xElement[XmlName_Developers];

            if (devsListElement != null)
            {
                XmlNodeList devNodes = devsListElement.SelectNodes(XmlName_Developer);
                foreach (XmlNode node in devNodes)
                {
                    string s;
                    if (XmlUtil.TryGetStringFromNode(node, out s))
                    {
                        devs.Add(s);
                    }
                }
            }

            List <string> pubs = new List <string>();

            XmlElement pubsListElement = xElement[XmlName_Publishers];

            if (pubsListElement != null)
            {
                XmlNodeList pubNodes = pubsListElement.SelectNodes(XmlName_Publisher);
                foreach (XmlNode node in pubNodes)
                {
                    string s;
                    if (XmlUtil.TryGetStringFromNode(node, out s))
                    {
                        pubs.Add(s);
                    }
                }
            }

            AutoCatDevPub result = new AutoCatDevPub(name, filter, prefix, owned, count, AllDevelopers, AllPublishers,
                                                     devs, pubs);

            return(result);
        }
コード例 #10
0
        public static AutoCatManual LoadFromXmlElement(XmlElement xElement)
        {
            string name      = XmlUtil.GetStringFromNode(xElement[XmlName_Name], TypeIdString);
            string filter    = XmlUtil.GetStringFromNode(xElement[XmlName_Filter], null);
            bool   removeAll = XmlUtil.GetBoolFromNode(xElement[XmlName_RemoveAll], false);
            string prefix    = XmlUtil.GetStringFromNode(xElement[XmlName_Prefix], null);

            List <string> remove = new List <string>();

            XmlElement removeListElement = xElement[XmlName_RemoveList];

            if (removeListElement != null)
            {
                XmlNodeList removeNodes = removeListElement.SelectNodes(XmlName_RemoveItem);
                foreach (XmlNode node in removeNodes)
                {
                    string s;
                    if (XmlUtil.TryGetStringFromNode(node, out s))
                    {
                        remove.Add(s);
                    }
                }
            }

            List <string> add = new List <string>();

            XmlElement addListElement = xElement[XmlName_AddList];

            if (addListElement != null)
            {
                XmlNodeList addNodes = addListElement.SelectNodes(XmlName_AddItem);
                foreach (XmlNode node in addNodes)
                {
                    string s;
                    if (XmlUtil.TryGetStringFromNode(node, out s))
                    {
                        add.Add(s);
                    }
                }
            }

            AutoCatManual result = new AutoCatManual(name, filter, prefix, removeAll, remove, add);

            return(result);
        }
コード例 #11
0
        private static void AddGameFromNode(XmlNode node, Profile profile)
        {
            if (!XmlUtil.TryGetIntFromNode(node[XmlNameGameId], out int id))
            {
                return;
            }

            GameListingSource source = XmlUtil.GetEnumFromNode(node[XmlNameGameSource], GameListingSource.Unknown);

            if (source < GameListingSource.Manual && profile.IgnoreList.Contains(id))
            {
                return;
            }

            string   name = XmlUtil.GetStringFromNode(node[XmlNameGameName], null);
            GameInfo game = new GameInfo(id, name, profile.GameData)
            {
                Source = source
            };

            profile.GameData.Games.Add(id, game);

            game.IsHidden    = XmlUtil.GetBoolFromNode(node[XmlNameGameHidden], false);
            game.Executable  = XmlUtil.GetStringFromNode(node[XmlNameGameExecutable], null);
            game.LastPlayed  = XmlUtil.GetIntFromNode(node[XmlNameGameLastPlayed], 0);
            game.HoursPlayed = XmlUtil.GetDoubleFromNode(node[XmlNameGameHoursPlayed], 0);

            XmlNode     catListNode = node.SelectSingleNode(XmlNameGameCategoryList);
            XmlNodeList catNodes    = catListNode?.SelectNodes(XmlNameGameCategory);

            if (catNodes == null)
            {
                return;
            }

            foreach (XmlNode cNode in catNodes)
            {
                if (XmlUtil.TryGetStringFromNode(cNode, out string cat))
                {
                    game.AddCategory(profile.GameData.GetCategory(cat));
                }
            }
        }
コード例 #12
0
        private static void AddGameFromXmlNode(XmlNode node, Profile profile)
        {
            int id;

            if (XmlUtil.TryGetIntFromNode(node["id"], out id))
            {
                if (profile.IgnoreList.Contains(id) || (profile.IgnoreDlc && Program.GameDB.IsDlc(id)))
                {
                    return;
                }
                string name = XmlUtil.GetStringFromNode(node["name"], null);
                Game   game = new Game(id, name);
                profile.GameData.Games.Add(id, game);

                string catName;
                if (XmlUtil.TryGetStringFromNode(node["category"], out catName))
                {
                    game.Category = profile.GameData.GetCategory(catName);
                }

                game.Favorite = (node.SelectSingleNode("favorite") != null);
            }
        }
コード例 #13
0
        public void Load(string path, bool compress)
        {
            Program.Logger.Write(LoggerLevel.Info, GlobalStrings.GameDB_LoadingGameDBFrom, path);
            XmlDocument doc = new XmlDocument();

            Stream stream = null;

            try {
                stream = new FileStream(path, FileMode.Open);
                if (compress)
                {
                    stream = new GZipStream(stream, CompressionMode.Decompress);
                }

                doc.Load(stream);

                Program.Logger.Write(LoggerLevel.Info, GlobalStrings.GameDB_GameDBXMLParsed);
                Games.Clear();
                ClearAggregates();

                XmlNode gameListNode = doc.SelectSingleNode("/" + XmlName_GameList);

                int fileVersion = XmlUtil.GetIntFromNode(gameListNode[XmlName_Version], 0);

                foreach (XmlNode gameNode in gameListNode.SelectNodes(XmlName_Game))
                {
                    int id;
                    if (!XmlUtil.TryGetIntFromNode(gameNode[XmlName_Game_Id], out id) || Games.ContainsKey(id))
                    {
                        continue;
                    }
                    GameDBEntry g = new GameDBEntry();
                    g.Id = id;

                    g.Name = XmlUtil.GetStringFromNode(gameNode[XmlName_Game_Name], null);

                    if (fileVersion < 1)
                    {
                        g.AppType = AppTypes.Unknown;
                        string typeString;
                        if (XmlUtil.TryGetStringFromNode(gameNode[XmlName_Game_Type], out typeString))
                        {
                            if (typeString == "DLC")
                            {
                                g.AppType = AppTypes.DLC;
                            }
                            else if (typeString == "Game")
                            {
                                g.AppType = AppTypes.Game;
                            }
                            else if (typeString == "NonApp")
                            {
                                g.AppType = AppTypes.Other;
                            }
                        }
                    }
                    else
                    {
                        g.AppType = XmlUtil.GetEnumFromNode <AppTypes>(gameNode[XmlName_Game_Type], AppTypes.Unknown);
                    }

                    g.Platforms = XmlUtil.GetEnumFromNode <AppPlatforms>(gameNode[XmlName_Game_Platforms], AppPlatforms.All);

                    g.ParentId = XmlUtil.GetIntFromNode(gameNode[XmlName_Game_Parent], -1);

                    if (fileVersion < 1)
                    {
                        List <string> genreList   = new List <string>();
                        string        genreString = XmlUtil.GetStringFromNode(gameNode["genre"], null);
                        if (genreString != null)
                        {
                            string[] genStrList = genreString.Split(',');
                            foreach (string s in genStrList)
                            {
                                genreList.Add(s.Trim());
                            }
                        }
                        g.Genres = genreList;
                    }
                    else
                    {
                        g.Genres = XmlUtil.GetStringsFromNodeList(gameNode.SelectNodes(XmlName_Game_Genre));
                    }

                    g.Tags = XmlUtil.GetStringsFromNodeList(gameNode.SelectNodes(XmlName_Game_Tag));

                    g.Developers = XmlUtil.GetStringsFromNodeList(gameNode.SelectNodes(XmlName_Game_Developer));

                    if (fileVersion < 1)
                    {
                        List <string> pubList   = new List <string>();
                        string        pubString = XmlUtil.GetStringFromNode(gameNode["publisher"], null);
                        if (pubString != null)
                        {
                            string[] pubStrList = pubString.Split(',');
                            foreach (string s in pubStrList)
                            {
                                pubList.Add(s.Trim());
                            }
                        }
                        g.Publishers = pubList;
                    }
                    else
                    {
                        g.Publishers = XmlUtil.GetStringsFromNodeList(gameNode.SelectNodes(XmlName_Game_Publisher));
                    }

                    if (fileVersion < 1)
                    {
                        int steamDate = XmlUtil.GetIntFromNode(gameNode["steamDate"], 0);
                        if (steamDate > 0)
                        {
                            g.SteamReleaseDate = DateTime.FromOADate(steamDate).ToString("MMM d, yyyy");
                        }
                        else
                        {
                            g.SteamReleaseDate = null;
                        }
                    }
                    else
                    {
                        g.SteamReleaseDate = XmlUtil.GetStringFromNode(gameNode[XmlName_Game_Date], null);
                    }

                    g.Flags = XmlUtil.GetStringsFromNodeList(gameNode.SelectNodes(XmlName_Game_Flag));

                    g.ReviewTotal = XmlUtil.GetIntFromNode(gameNode[XmlName_Game_ReviewTotal], 0);
                    g.ReviewPositivePercentage = XmlUtil.GetIntFromNode(gameNode[XmlName_Game_ReviewPositivePercent], 0);

                    g.MC_Url = XmlUtil.GetStringFromNode(gameNode[XmlName_Game_MCUrl], null);

                    g.LastAppInfoUpdate = XmlUtil.GetIntFromNode(gameNode[XmlName_Game_LastAppInfoUpdate], 0);
                    g.LastStoreScrape   = XmlUtil.GetIntFromNode(gameNode[XmlName_Game_LastStoreUpdate], 0);

                    Games.Add(id, g);
                }
                Program.Logger.Write(LoggerLevel.Info, GlobalStrings.GameDB_GameDBXMLProcessed);
            } catch (Exception e) {
                throw e;
            } finally {
                if (stream != null)
                {
                    stream.Close();
                }
            }
        }
コード例 #14
0
        public void Load(string path, bool compress)
        {
            Program.Logger.Write(LoggerLevel.Info, GlobalStrings.GameDB_LoadingGameDBFrom, path);
            XmlDocument doc = new XmlDocument();

            Stream stream = null;

            try {
                stream = new FileStream(path, FileMode.Open);
                if (compress)
                {
                    stream = new GZipStream(stream, CompressionMode.Decompress);
                }

                doc.Load(stream);

                Program.Logger.Write(LoggerLevel.Info, GlobalStrings.GameDB_GameDBXMLParsed);
                Games.Clear();

                foreach (XmlNode gameNode in doc.SelectNodes("/gamelist/game"))
                {
                    int id;
                    if (!XmlUtil.TryGetIntFromNode(gameNode["id"], out id) || Games.ContainsKey(id))
                    {
                        continue;
                    }
                    GameDBEntry g = new GameDBEntry();
                    g.Id = id;
                    XmlUtil.TryGetStringFromNode(gameNode["name"], out g.Name);
                    string typeString;
                    if (!XmlUtil.TryGetStringFromNode(gameNode["type"], out typeString) || !Enum.TryParse <AppType>(typeString, out g.Type))
                    {
                        g.Type = AppType.New;
                    }

                    g.Genre = XmlUtil.GetStringFromNode(gameNode["genre"], null);

                    g.Developer = XmlUtil.GetStringFromNode(gameNode["developer"], null);
                    g.Publisher = XmlUtil.GetStringFromNode(gameNode["publisher"], null);

                    int steamDate = XmlUtil.GetIntFromNode(gameNode["steamDate"], 0);
                    if (steamDate > 0)
                    {
                        g.SteamRelease = DateTime.FromOADate(steamDate);
                    }

                    foreach (XmlNode n in gameNode.SelectNodes("flag"))
                    {
                        string fName = XmlUtil.GetStringFromNode(n, null);
                        if (!string.IsNullOrEmpty(fName))
                        {
                            g.Flags.Add(fName);
                        }
                    }

                    g.MC_Url = XmlUtil.GetStringFromNode(gameNode["mcUrl"], null);


                    // TODO: Load MC extras

                    Games.Add(id, g);
                }
                Program.Logger.Write(LoggerLevel.Info, GlobalStrings.GameDB_GameDBXMLProcessed);
            } catch (Exception e) {
                throw e;
            } finally {
                if (stream != null)
                {
                    stream.Close();
                }
            }
        }