ICSharpCode.SharpZipLib.Zip.ZipOutputStream.SetLevel C# (CSharp) Méthode

SetLevel() public méthode

Sets the compression level. The new level will be activated immediately.
/// Level specified is not supported. ///
public SetLevel ( int level ) : void
level int The new compression level (1 to 9).
Résultat void
        public void SetLevel(int level)
        {
            deflater_.SetLevel(level);
            defaultCompressionLevel = level;
        }

Usage Example

Exemple #1
0
        public static void ZipFiles(string InputFolderPath, string outputPathAndFile, string password)
        {
            string outPath = outputPathAndFile;
            ZipOutputStream oZipStream = new ZipOutputStream(File.Create(outPath));


            int TrimLength = 0;
            if (Directory.GetParent(InputFolderPath) != null)
            {
                TrimLength = (Directory.GetParent(InputFolderPath)).ToString().Length;
                TrimLength += 1; //remove '\'
            }


            string DirPath = outPath.Remove(outPath.LastIndexOf(@"\"));
            if (!Directory.Exists(DirPath))
                Directory.CreateDirectory(DirPath);


            DirectoryInfo dinf = new DirectoryInfo(InputFolderPath);

            if (dinf.Exists)
            {

                if (!string.IsNullOrEmpty(password))
                    oZipStream.Password = password;
                oZipStream.SetLevel(9); // maximum compression


                ArrayList ar = GenerateFileList(InputFolderPath); // generate file list

                foreach (object t in ar)
                {
                    string Fil = t.ToString();
                    ZipFile(TrimLength, oZipStream, Fil);
                }
            }
            else
            {
                FileInfo finf = new FileInfo(InputFolderPath);
                if (!string.IsNullOrEmpty(password))
                    oZipStream.Password = password;
                oZipStream.SetLevel(9); // maximum compression
                ZipFile(TrimLength, oZipStream, finf.FullName);
            }

            oZipStream.Finish();
            oZipStream.Close();
        }
All Usage Examples Of ICSharpCode.SharpZipLib.Zip.ZipOutputStream::SetLevel