示例#1
0
        /// <summary>
        /// Opens a Zip file with the given name.
        /// </summary>
        /// <param name="name"> Zip name</param>
        public ZipFile(string name)
        {
            zipName = name;
            baseStream = new FileStream(zipName, FileMode.Open);
            thisWriter = new ZipWriter(baseStream);

            int index1 = zipName.IndexOf(ZipConstants.Dot);
            int index2 = zipName.LastIndexOf(ZipConstants.BackSlash);
            thisReader = new ZipReader(baseStream, zipName.Substring(index2,
                    index1 - index2));

            zipEntries = thisReader.GetAllEntries();
            thisWriter.Method = thisReader.Method;
        }
示例#2
0
        /// <summary>
        /// Created a new Zip file with the given name.
        /// </summary>
        /// <param name="method"> Gzip or deflate</param>
        /// <param name="name"> Zip name</param>
        public ZipFile(string name, byte method, FileMode mode)
        {
            zipName = name;

            baseStream = new FileStream(zipName, mode);
            thisWriter = new ZipWriter(baseStream);
            thisWriter.Method = method;

            //New File
            thisWriter.WriteSuperHeader(0, method);

            int index1 = zipName.IndexOf(ZipConstants.Dot);
            int index2 = zipName.LastIndexOf(ZipConstants.BackSlash);
            thisReader = new ZipReader(baseStream, zipName.Substring(index2,
                    index1 - index2));

            zipEntries = thisReader.GetAllEntries();
        }