PoEcoDB/PoEcoDB/Web/Stash.cs
2024-01-16 19:09:34 -05:00

35 lines
987 B
C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Text;
using System.Threading.Tasks;
namespace PoEcoDB.Web
{
internal class Stash
{
public static void DownloadStash(string token, string url, string path)
{
WebClient webClient = new WebClient();
webClient.Encoding = Encoding.UTF8;
webClient.Headers.Add("Authorization", "Bearer " + token);
ServicePointManager.ServerCertificateValidationCallback = delegate { return true; };
try
{
Uri address = new Uri(url);
webClient.DownloadFile(address, path);
}
catch (WebException ex)
{
Message.CMW(ex.Message, true, 3);
Message.CMW("URL: " + url, true, 3);
}
catch (Exception ex)
{
Message.CMW(ex.Message,true,3);
}
}
}
}