public PollResponse Poll()
        {
            //Catch any errors
            return(Debug.Try(() =>
            {
                //Get the credentials
                var creds = CredentialsManager.GetCredentials();

                //Get a HttpClient
                using (var http = new HttpClient())
                {
                    //Prepare our payload
                    var content = default(StringContent);
                    if (this.lastid != 0)
                    {
                        content = new StringContent
                                  (
                            "last_id=" + this.lastid,
                            Encoding.UTF8,
                            "application/x-www-form-urlencoded"
                                  );
                    }

                    //Prepare our request message
                    var requestMessage = new HttpRequestMessage(HttpMethod.Post, POLL_URI)
                    {
                        Version = HttpVersion.Version10,
                        Content = content
                    };

                    //Modify the headers we want to send
                    requestMessage.Headers.Add("Accept", "application/json");
                    requestMessage.Headers.Add("Origin", "https://www.gw2raidar.com");
                    requestMessage.Headers.Add("Referer", "https://www.gw2raidar.com/uploads");
                    requestMessage.Headers.Add("Cookie", $"csrftoken={creds.csrftoken};sessionid={creds.sessionid}");
                    requestMessage.Headers.Add("X-CSRFToken", creds.csrftoken);

                    //Send our request
                    var response = "";
                    using (var ret = http.SendAsync(requestMessage).GetAwaiter().GetResult())
                    {
                        //Check if it was successful
                        ret.EnsureSuccessStatusCode();

                        //Save the response
                        response = ret.Content.ReadAsStringAsync().GetAwaiter().GetResult();
                    }

                    //Parse JSON as a PollResponse object
                    var obj = JsonConvert.DeserializeObject <PollResponse>(response);

                    //Store the last_id value
                    this.lastid = obj.last_id ?? 0;

                    //Return the parsed object
                    return obj;
                }
            }, null));
        }
        public UploadResponse Upload(Stream stream, string name)
        {
            //Catch any errors
            return(Debug.Try(() =>
            {
                //Get the credentials
                var creds = CredentialsManager.GetCredentials();

                //Get a HttpClient
                using (var http = new HttpClient())
                {
                    //Use the stream as our content and mark with appropriate content type
                    var file = new StreamContent(stream);
                    file.Headers.ContentType = new MediaTypeHeaderValue("application/octet-stream");

                    //Prepare our payload
                    var content = new MultipartFormDataContent();
                    content.Add(file, "file", name);

                    //Prepare our request message
                    var requestMessage = new HttpRequestMessage(HttpMethod.Post, UPLOAD_URI)
                    {
                        Version = HttpVersion.Version10,
                        Content = content
                    };

                    //Modify the headers we want to send
                    requestMessage.Headers.Add("Accept", "application/json");
                    requestMessage.Headers.Add("Origin", "https://www.gw2raidar.com");
                    requestMessage.Headers.Add("Referer", "https://www.gw2raidar.com/uploads");
                    requestMessage.Headers.Add("Cookie", $"csrftoken={creds.csrftoken};sessionid={creds.sessionid}");
                    requestMessage.Headers.Add("X-CSRFToken", creds.csrftoken);

                    //Send our request
                    var response = "";
                    using (var ret = http.SendAsync(requestMessage).GetAwaiter().GetResult())
                    {
                        //Check if it was successful
                        ret.EnsureSuccessStatusCode();

                        //Save the response
                        response = ret.Content.ReadAsStringAsync().GetAwaiter().GetResult();
                    }

                    //Parse JSON and return the UploadResponse object
                    return JsonConvert.DeserializeObject <UploadResponse>(response);
                }
            }, null));
        }