Ejemplo n.º 1
0
 public static void DownloadPackage(NetWorkSetting ns, RequestTypeIdentifier packageIdentifier)
 {
     try
     {
         using (var web = new Lpp.Dns.DataMart.Client.Lib.DnsApiClient(ns, FindCert(ns)))
         {
             string filepath = System.IO.Path.Combine(Lpp.Dns.DataMart.Client.Utils.Configuration.PackagesFolderPath, packageIdentifier.PackageName());
             using (var stream = AsyncHelpers.RunSync <System.IO.Stream>(() => web.GetPackage(packageIdentifier)))
             {
                 using (var filestream = new System.IO.FileStream(filepath, System.IO.FileMode.Create))
                 {
                     stream.CopyTo(filestream);
                 }
             }
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Ejemplo n.º 2
0
 public static void DownloadPackage(NetWorkSetting ns, RequestTypeIdentifier packageIdentifier)
 {
     try
     {
         using (var web = new Lpp.Dns.DataMart.Client.Lib.DnsApiClient(ns, FindCert(ns)))
         {
             string filepath = System.IO.Path.Combine(Lpp.Dns.DataMart.Client.Utils.Configuration.PackagesFolderPath, packageIdentifier.PackageName());
             using (var stream = Task.Run(() => web.GetPackage(packageIdentifier)).Result)
             {
                 using (var filestream = new System.IO.FileStream(filepath, System.IO.FileMode.Create))
                 {
                     stream.CopyTo(filestream);
                 }
             }
         }
     }
     catch (Exception ex)
     {
         _log.Error(string.Format("Unable to download package {1} for Network: {0}.", ns.NetworkName, packageIdentifier), ex);
         throw ex;
     }
 }