diff --git a/NX_Game_Info/Common.cs b/NX_Game_Info/Common.cs index 1a0e47e..478d183 100644 --- a/NX_Game_Info/Common.cs +++ b/NX_Game_Info/Common.cs @@ -39,8 +39,8 @@ public class Common public static readonly string TITLE_KEYS = "title.keys"; public static readonly string CONSOLE_KEYS = "console.keys"; public static readonly string HAC_VERSIONLIST = "hac_versionlist.json"; - public static readonly string TITLE_KEYS_URI = "https://pastebin.com/raw/XGfpTfb7"; - public static readonly string HAC_VERSIONLIST_URI = "https://pastebin.com/raw/imV40MSg"; + public static readonly string TITLE_KEYS_URI = "https://gist.githubusercontent.com/gneurshkgau/81bcaa7064bd8f98d7dffd1a1f1781a7/raw/title.keys"; + public static readonly string HAC_VERSIONLIST_URI = "https://gist.githubusercontent.com/gneurshkgau/81bcaa7064bd8f98d7dffd1a1f1781a7/raw/hac_versionlist.json"; #if WINDOWS [DllImport("Shlwapi.dll", CharSet = CharSet.Auto)] diff --git a/NX_Game_Info/Process.cs b/NX_Game_Info/Process.cs index 450082b..b774ef1 100644 --- a/NX_Game_Info/Process.cs +++ b/NX_Game_Info/Process.cs @@ -126,14 +126,8 @@ public static bool initialize(out List messages) titleID = titleID.Substring(0, Math.Min(titleID.Length, 13)) + "000"; } - if (versionList.ContainsKey(titleID.ToUpper())) - { - versionList[titleID.ToUpper()] = Math.Max(versionList[titleID.ToUpper()], title.version); - } - else - { - versionList.Add(titleID.ToUpper(), title.version); - } + versionList.TryGetValue(titleID.ToUpper(), out uint version); + versionList[titleID.ToUpper()] = Math.Max(version, title.version); } log?.WriteLine("Found {0} titles, last modified at {1}", versionList.Count, versionlist.last_modified); @@ -228,8 +222,8 @@ public static bool updateTitleKeys() log?.WriteLine("Found {0} title keys", keyset?.TitleKeys?.Count); - titleNames = keyset.TitleNames.ToDictionary(p => BitConverter.ToString(p.Key.Take(8).ToArray()).Replace("-", "").ToUpper(), p => p.Value); - titleVersions = keyset.TitleVersions.ToDictionary(p => BitConverter.ToString(p.Key.Take(8).ToArray()).Replace("-", "").ToUpper(), p => p.Value); + titleNames = keyset.TitleNames.GroupBy(p => BitConverter.ToString(p.Key.Take(8).ToArray()).Replace("-", "").ToUpper()).ToDictionary(p => p.Key, p => p.Last().Value); + titleVersions = keyset.TitleVersions.GroupBy(p => BitConverter.ToString(p.Key.Take(8).ToArray()).Replace("-", "").ToUpper()).ToDictionary(p => p.Key, p => p.Last().Value); return true; } @@ -270,14 +264,8 @@ public static bool updateVersionList() titleID = titleID.Substring(0, Math.Min(titleID.Length, 13)) + "000"; } - if (versionList.ContainsKey(titleID.ToUpper())) - { - versionList[titleID.ToUpper()] = Math.Max(versionList[titleID.ToUpper()], title.version); - } - else - { - versionList.Add(titleID.ToUpper(), title.version); - } + versionList.TryGetValue(titleID.ToUpper(), out uint version); + versionList[titleID.ToUpper()] = Math.Max(version, title.version); } log?.WriteLine("Found {0} titles, last modified at {1}", versionList.Count, versionlist.last_modified);