HttpRequest.cs 702 B

12345678910111213141516171819202122232425
  1. using LauncherUpdater.Function;
  2. using System.Net.Http;
  3. using System.Threading.Tasks;
  4. namespace LauncherUpdater.HTTP
  5. {
  6. public class HttpRequest
  7. {
  8. private readonly string _checkLauncherVersion =
  9. Configuration.Default.ServerIp + Configuration.Default.CheckLauncherVersion;
  10. public async Task<string> GetLauncherFileAsync()
  11. {
  12. string launcherFileAsync;
  13. using (var client = new HttpClient())
  14. {
  15. launcherFileAsync = await (await client.GetAsync(_checkLauncherVersion))
  16. .Content
  17. .ReadAsStringAsync();
  18. }
  19. return launcherFileAsync;
  20. }
  21. }
  22. }