Beispiel #1
0
        public async Task <bool> UnCompressTaskProgress(string JobID)
        {
            IClient clint    = new PClient(Username, Password, ConnectionSetting);
            var     TheDomin = (await clint.Account().GetCurrentServer()).hostname;

            using (HtpClient localHttpClient = new HtpClient(new HCHandler()))
            {
                using (HttpResponseMessage response = await localHttpClient.GetAsync(new Uri(string.Format("https://{0}/extractarchiveprogress", TheDomin) + AsQueryString(new AuthDictionary()
                {
                    { "progresshash", JobID }
                })), System.Net.Http.HttpCompletionOption.ResponseContentRead).ConfigureAwait(false))
                {
                    string result = await response.Content.ReadAsStringAsync();

                    if (response.StatusCode == HttpStatusCode.OK && JObject.Parse(result).Value <int>("result").Equals(0))
                    {
                        return(Convert.ToBoolean(JObject.Parse(result).SelectToken("finished").ToString()));
                    }
                    else
                    {
                        ShowError(result);
                        return(false);
                    }
                }
            }
        }
Beispiel #2
0
        public async Task <JSON_JobProgress> CompressTaskProgress(string JobID)
        {
            IClient client   = new PClient(Username, Password, ConnectionSetting);
            var     TheDomin = (await client.Account().GetCurrentServer()).hostname;

            using (HtpClient localHttpClient = new HtpClient(new HCHandler()))
            {
                using (HttpResponseMessage response = await localHttpClient.GetAsync(new Uri(string.Format("https://{0}/savezipprogress", TheDomin) + AsQueryString(new AuthDictionary()
                {
                    { "progresshash", JobID }
                })), HttpCompletionOption.ResponseContentRead).ConfigureAwait(false))
                {
                    string result = await response.Content.ReadAsStringAsync();

                    if (response.StatusCode == HttpStatusCode.OK && JObject.Parse(result).Value <int>("result").Equals(0))
                    {
                        return(JsonConvert.DeserializeObject <JSON_JobProgress>(result, JSONhandler));
                    }
                    else
                    {
                        ShowError(result);
                        return(null);
                    }
                }
            }
        }