CompressionLevel Sabit listesi
Tanım
Bir sıkıştırma işleminin hız veya sıkıştırma boyutunu vurgulamadığını gösteren değerleri belirtir.Specifies values that indicate whether a compression operation emphasizes speed or compression size.
public enum class CompressionLevel
public enum CompressionLevel
type CompressionLevel =
Public Enum CompressionLevel
- Devralma
Alanlar
| Fastest | 1 | Elde edilen dosya en iyi şekilde sıkıştırılmasa bile, sıkıştırma işleminin mümkün olduğunca hızlı bir şekilde tamamlanmalıdır.The compression operation should complete as quickly as possible, even if the resulting file is not optimally compressed. |
| NoCompression | 2 | Dosyada sıkıştırma gerçekleştirilmemelidir.No compression should be performed on the file. |
| Optimal | 0 | İşlemin tamamlanmasını daha uzun sürse bile sıkıştırma işleminin en iyi şekilde sıkıştırılması gerekir.The compression operation should be optimally compressed, even if the operation takes a longer time to complete. |
Açıklamalar
Sıkıştırma işlemleri genellikle sıkıştırma hızı ve sıkıştırma verimliliği arasında bir zorunluluğunu getirir içerir.Compression operations usually involve a tradeoff between the speed and the effectiveness of compression. CompressionLevelHangi faktörün geliştirme senaryonuzda ne kadar önemli olduğunu göstermek için numaralandırmayı kullanın: sıkıştırma işleminin tamamlanma süresi veya sıkıştırılan dosyanın boyutu.You use the CompressionLevel enumeration to indicate which factor is more important in your development scenario: the time to complete the compression operation or the size of the compressed file. Bu değerler, belirli sıkıştırma düzeylerine karşılık gelmez; sıkıştırmayı uygulayan nesne bunların nasıl işleneceğini belirler.These values do not correspond to specific compression levels; the object that implements compression determines how to handle them.
,,, Ve sınıflarının aşağıdaki yöntemleri, DeflateStream GZipStream ZipArchive ZipFile ZipFileExtensions compressionLevel sıkıştırma düzeyini belirtmenize imkan tanıyan adlı bir parametre içerir:The following methods of the DeflateStream, GZipStream, ZipArchive, ZipFile, and ZipFileExtensions classes include a parameter named compressionLevel that lets you specify the compression level:
DeflateStream.DeflateStream(Stream, CompressionLevel, Boolean)
ZipFile.CreateFromDirectory(String, String, CompressionLevel, Boolean)
ZipFileExtensions.CreateEntryFromFile(ZipArchive, String, String, CompressionLevel)
ÖrneklerExamples
Aşağıdaki örnek, sınıfını kullanarak bir ZIP arşivi oluştururken sıkıştırma düzeyinin nasıl ayarlanacağını gösterir ZipFile .The following example shows how to set the compression level when creating a zip archive by using the ZipFile class.
using System;
using System.IO;
using System.IO.Compression;
namespace ConsoleApplication
{
class Program
{
static void Main(string[] args)
{
string startPath = @"c:\example\start";
string zipPath = @"c:\example\result.zip";
ZipFile.CreateFromDirectory(startPath, zipPath, CompressionLevel.Fastest, true);
}
}
}
Imports System.IO
Imports System.IO.Compression
Module Module1
Sub Main()
Dim startPath As String = "c:\example\start"
Dim zipPath As String = "c:\example\result.zip"
ZipFile.CreateFromDirectory(startPath, zipPath, CompressionLevel.Fastest, True)
End Sub
End Module