示例#1
0
        public static bool updateTitleKeys()
        {
            string title_keys = path_prefix + Common.TITLE_KEYS;

            try
            {
                log?.WriteLine("\nDownloading title keys");

                using (var httpClient = new HttpClient())
                {
                    var response = httpClient.GetAsync(Common.TITLE_KEYS_URI).Result;

                    if (response.IsSuccessStatusCode)
                    {
                        var content = response.Content.ReadAsStringAsync().Result;
                        if (!String.IsNullOrEmpty(content))
                        {
                            File.WriteAllText(title_keys, content);

                            ExternalKeys.ReadTitleKeys(keyset, title_keys);

                            log?.WriteLine("Found {0} title keys", keyset?.TitleKeys?.Count);

                            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);
                        }
                    }
                }
            }
            catch { }

            return(false);
        }