public static PnPInfo UnpackTemplate(this MemoryStream stream) { PnPInfo siteTemplate; using (PnPPackage package = PnPPackage.Open(stream, FileMode.Open, FileAccess.ReadWrite)) { siteTemplate = LoadPnPPackage(package); } return(siteTemplate); }
public static MemoryStream PackTemplateAsStream(this PnPInfo pnpInfo) { MemoryStream stream = new MemoryStream(); using (PnPPackage package = PnPPackage.Open(stream, FileMode.OpenOrCreate, FileAccess.ReadWrite)) { SavePnPPackage(pnpInfo, package); } stream.Position = 0; return(stream); }
public static PnPInfo UnpackTemplate(this Byte[] packageBytes) { PnPInfo siteTemplate; using (MemoryStream stream = new MemoryStream(packageBytes)) { using (PnPPackage package = PnPPackage.Open(stream, FileMode.Open, FileAccess.Read)) { siteTemplate = LoadPnPPackage(package); } } return(siteTemplate); }
public static Byte[] PackTemplate(this PnPInfo pnpInfo) { Byte[] fileBytes; using (MemoryStream stream = new MemoryStream()) { using (PnPPackage package = PnPPackage.Open(stream, FileMode.OpenOrCreate, FileAccess.ReadWrite)) { SavePnPPackage(pnpInfo, package); } fileBytes = stream.ToArray(); } return(fileBytes); }