Пример #1
0
 public FileDirs GetFileDirs()
 {
     try
     {
         var          request     = new RestRequest(ResourcePath + "/filedirs", Method.GET);
         RestResponse queryResult = (RestResponse)RestClient.Execute(request);
         FileDirs     value       = RestSharp.SimpleJson.DeserializeObject <FileDirs>(queryResult.Content);
         return(value);
     }
     catch (Exception e)
     {
         throw new BcephalException("Unable to get FileDirs.", e);
     }
 }
Пример #2
0
 public String downloadPresentation(String name)
 {
     try
     {
         var request = new RestRequest(ResourcePath + "/download-presentation/" + name, Method.GET);
         request.AddHeader("Content-Type", "application/octet-stream");
         request.RequestFormat = RestSharp.DataFormat.Json;
         byte[] data     = RestClient.DownloadData(request);
         string tempPath = FileDirs.getPresentationTempFolder();
         string filePath = tempPath + name;
         File.WriteAllBytes(filePath, data);
         return(tempPath);
     }
     catch (Exception e)
     {
         logger.Error("Unable to download file.", e);
     }
     return(null);
 }