Beispiel #1
0
        public async Task <JSON_Uploadedfile> UploadRemotely(string ImgUrl, string DestinationFolderPath)
        {
            using (HtpClient localHtpClient = new HtpClient(new HCHandler {
            }))
            {
                using (HttpResponseMessage response = await localHtpClient.PostAsync(new pUri("fetch?" + string.Format("from={0}&target_path={1}", ImgUrl, DestinationFolderPath.Trim('/'))), null).ConfigureAwait(false))
                {
                    string result = await response.Content.ReadAsStringAsync();

                    return(response.StatusCode == HttpStatusCode.OK ? JsonConvert.DeserializeObject <JSON_Uploadedfile>(JObject.Parse(result).SelectToken("fetchedFile").ToString(), JSONhandler) : throw ShowError(result));
                }
            }
        }
Beispiel #2
0
        public async Task <JSON_Uploadedfile> FolderCreate(string FolderName, string DestinationFolderPath)
        {
            string folderPath = string.Concat(DestinationFolderPath.Trim('/'), "/", FolderName);

            using (HtpClient localHtpClient = new HtpClient(new HCHandler {
            }))
            {
                using (HttpResponseMessage response = await localHtpClient.PostAsync(new pUri("CreateFolder?" + string.Format("path={0}", folderPath)), null).ConfigureAwait(false))
                {
                    string result = await response.Content.ReadAsStringAsync();

                    return(response.StatusCode == HttpStatusCode.OK ? JsonConvert.DeserializeObject <JSON_Uploadedfile>(JObject.Parse(result).SelectToken("createdFolder").ToString(), JSONhandler) : throw ShowError(result));
                }
            }
        }