public void BuildPackage_ToFile() { var packageBuilder = new ClientNugetPackageBuilder(TypeMapper); using (var fileStream = File.Create(packageBuilder.PackageFileName)) { packageBuilder.BuildPackage(fileStream); } }
private void RegisterClientNugetPackageRoute() { var packageBuilder = new ClientNugetPackageBuilder(TypeMapper); var packageFileName = packageBuilder.PackageFileName; Get[PomonaRouteMetadataProvider.ClientNugetPackage, "/Client.nupkg"] = x => Response.AsRedirect(packageFileName); Get[PomonaRouteMetadataProvider.ClientNugetPackageVersioned, "/" + packageFileName] = x => GetClientNugetPackage(); }
public void BuildPackage_DoesNotThrowAnyExceptions() { var packageBuilder = new ClientNugetPackageBuilder(TypeMapper); byte[] fileData; using (var fileStream = new MemoryStream()) { packageBuilder.BuildPackage(fileStream); fileData = fileStream.ToArray(); } Console.WriteLine("Package size is " + fileData.Length/1024.0 + " KiB"); }
public void BuildPackage_DoesNotThrowAnyExceptions() { var packageBuilder = new ClientNugetPackageBuilder(TypeMapper); byte[] fileData; using (var fileStream = new MemoryStream()) { packageBuilder.BuildPackage(fileStream); fileData = fileStream.ToArray(); } Console.WriteLine("Package size is " + fileData.Length / 1024.0 + " KiB"); }
private Response GetClientNugetPackage() { var packageBuilder = new ClientNugetPackageBuilder(TypeMapper); byte[] bytes; using (var memstream = new MemoryStream()) { packageBuilder.BuildPackage(memstream); bytes = memstream.ToArray(); } var response = new Response { Contents = stream => stream.Write(bytes, 0, bytes.Length), ContentType = "application/zip", }; return(response); }
private void RegisterClientNugetPackageRoute() { var packageBuilder = new ClientNugetPackageBuilder(this.typeMapper); Get["/client.nupkg"] = x => Response.AsRedirect(packageBuilder.PackageFileName); Get["/" + packageBuilder.PackageFileName] = x => GetClientNugetPackage(); }
private Response GetClientNugetPackage() { var response = new Response(); var packageBuilder = new ClientNugetPackageBuilder(this.typeMapper); response.Contents = stream => { using (var memstream = new MemoryStream()) { packageBuilder.BuildPackage(memstream); var bytes = memstream.ToArray(); stream.Write(bytes, 0, bytes.Length); } }; response.ContentType = "binary/octet-stream"; return response; }