Esempio n. 1
0
        public static LauncherRemoteConfig DownloadConfigFile()
        {
            //Download the file
            LauncherRemoteConfig config;
            string platform = ReleaseUpdater.GetReleaseBinaryName();

            try
            {
                using (HttpClient hc = new HttpClient())
                {
                    string config_content = hc.GetStringAsync($"https://config.deltamap.net/{Program.LAUNCHER_CHANNEL}/games/0/launcher_config.json?p={platform}&v={Program.LAUNCHER_VERSION}").GetAwaiter().GetResult();
                    config = JsonConvert.DeserializeObject <LauncherRemoteConfig>(config_content);
                }
            }
            catch (Exception ex)
            {
                //Failed
                Program.WriteLineColor("Sorry, could not download the configuration file. Try again later. (Are you offline?)", ConsoleColor.Red);
                throw new Exception();
            }
            return(config);
        }