示例#1
0
        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);
        }
示例#3
0
        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);
        }
示例#4
0
 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);
 }