how to avoid [Content_Types].xml in .net's ZipPackage class

前端 未结 6 956
星月不相逢
星月不相逢 2021-01-07 19:09

I wish to know if there is any way to avoid to have a [Content_Types].xml file inside the zip file while using .net\'s ZipPackage

6条回答
  •  有刺的猬
    2021-01-07 20:06

    Man, this helped me a lot! You rock! I had to use this because my old framework (3.5). Only to complement, see below the implementation of the CopyStream function:

        private void CopyStream(Stream source, Stream target)
        {
            const int bufSize = 0x1000;
            byte[] buf = new byte[bufSize];
            int bytesRead = 0;
            while ((bytesRead = source.Read(buf, 0, bufSize)) > 0)
                target.Write(buf, 0, bytesRead);
        }
    

提交回复
热议问题