예제 #1
0
 /// <summary>
 /// Executes the download list.
 /// </summary>
 /// <typeparam name="T"></typeparam>
 /// <param name="redmineManager">The redmine manager.</param>
 /// <param name="address">The address.</param>
 /// <param name="methodName">Name of the method.</param>
 /// <param name="parameters">The parameters.</param>
 /// <returns></returns>
 public static PaginatedObjects <T> ExecuteDownloadList <T>(RedmineManager redmineManager
                                                            , string address
                                                            , string methodName
                                                            , System.Collections.Specialized.NameValueCollection parameters = null
                                                            )
     where T : class, new()
 {
     using (RedmineWebClient wc = redmineManager.CreateWebClient(parameters))
     {
         try
         {
             string response = wc.DownloadString(address);
             return(RedmineSerializer.DeserializeList <T>(response, redmineManager.MimeFormat));
         }
         catch (System.Net.WebException webException)
         {
             webException.HandleWebException(methodName, redmineManager.MimeFormat);
         }
         return(null);
     }
 }
예제 #2
0
 /// <summary>
 /// Executes the download.
 /// </summary>
 /// <typeparam name="T"></typeparam>
 /// <param name="redmineManager">The redmine manager.</param>
 /// <param name="address">The address.</param>
 /// <param name="methodName">Name of the method.</param>
 /// <param name="parameters">The parameters.</param>
 /// <returns></returns>
 public static T ExecuteDownload <T>(RedmineManager redmineManager
                                     , string address
                                     , string methodName
                                     , System.Collections.Specialized.NameValueCollection parameters = null)
     where T : class, new()
 {
     using (RedmineWebClient wc = redmineManager.CreateWebClient(parameters))
     {
         try
         {
             string response = wc.DownloadString(address);
             if (!string.IsNullOrEmpty(response))
             {
                 return(RedmineSerializer.Deserialize <T>(response, redmineManager.MimeFormat));
             }
         }
         catch (System.Net.WebException webException)
         {
             webException.HandleWebException(methodName, redmineManager.MimeFormat);
         }
         return(default(T));
     }
 }