/// <summary> /// Finds the slide count of the specified PowerPoint document from a third party storage /// </summary> /// <param name="storageType"></param> /// <param name="storageName">Name of the storage</param> /// <param name="folderName">In case of Amazon S3 storage the folder's path starts with Amazon S3 Bucket name.</param> /// <returns>slide count</returns> public int GetSlideCount(StorageType storageType, string storageName, string folderName) { //build URI to get slide count StringBuilder strURI = new StringBuilder(Product.BaseProductUri + "/slides/" + FileName + "/slides" + (string.IsNullOrEmpty(folderName) ? "" : "?folder=" + folderName)); switch (storageType) { case StorageType.AmazonS3: strURI.Append("&storage=" + storageName); break; } string signedURI = Utils.Sign(strURI.ToString()); Stream responseStream = Utils.ProcessCommand(signedURI, "GET"); StreamReader reader = new StreamReader(responseStream); string strJSON = reader.ReadToEnd(); //Parse the json string to JObject JObject parsedJSON = JObject.Parse(strJSON); //Deserializes the JSON to a object. SlidesResponse slidesResponse = JsonConvert.DeserializeObject <SlidesResponse>(parsedJSON.ToString()); int count = slidesResponse.Slides.SlideList.Count; return(count); }
/// <summary> /// Finds the slide count of the specified PowerPoint document /// </summary> /// <returns>slide count</returns> public int GetSlideCount() { //build URI to get slide count string strURI = Product.BaseProductUri + "/slides/" + FileName + "/slides"; string signedURI = Utils.Sign(strURI); Stream responseStream = Utils.ProcessCommand(signedURI, "GET"); StreamReader reader = new StreamReader(responseStream); string strJSON = reader.ReadToEnd(); //Parse the json string to JObject JObject parsedJSON = JObject.Parse(strJSON); //Deserializes the JSON to a object. SlidesResponse slidesResponse = JsonConvert.DeserializeObject <SlidesResponse>(parsedJSON.ToString()); int count = slidesResponse.Slides.SlideList.Count; return(count); }