 |
建站必读 |
 |
|
|
 |
|
 |
|
| |
| 当前位置:首页 -> 建站必读 -> .NET技术 |
|
michael_wp原创:用.net实现zip----1 |
//ZipEntry.cs
using System;
using System.IO;
namespace OrganicBit.Zip {
/// <summary>Specifies how the the zip entry should be compressed.</summary>
public enum CompressionMethod {
/// <summary>No compression.</summary>
Stored = 0,
/// <summary>Default and only supported compression method.</summary>
Deflated = 8
}
/// <summary>Specifies the amount of compression to apply to compressed zip entires.</summary>
public enum CompressionLevel : int {
/// <summary>Default compression level. A good choice for speed and size.</summary>
Default = -1,
/// <summary>Do not perfrom compression.</summary>
None = 0,
/// <summary>Compress the entry as fast as possible size trading size for time.</summary>
Fastest = 1,
/// <summary>Compress the entry using a balance of size and time.</summary>
Average = 5,
/// <summary>Compress the entry to smallest possible size trading time for size.</summary>
Smallest = 9
}
/// <summary>Represents a entry in a zip file.</summary>
public class ZipEntry {
string _name = String.Empty;
uint _crc = 0;
long _compressedLength = -1;
long _uncompressedLength = -1;
byte[] _extraField = null;
string _comment = String.Empty;
DateTime _modifiedTime = DateTime.Now;
CompressionMethod _method = CompressionMethod.Deflated;
int _level = (int) CompressionLevel.Default;
/// <summary>Initializes a instance of the <see cref="ZipEntry"/> class with the given name.</summary>
/// <param name="name">The name of entry that will be stored in the directory of the zip file.</param>
public ZipEntry(string name) {
Name = name;
}
/// <summary>Creates a new Zip file entry reading values from a zip file.</summary>
internal ZipEntry(IntPtr handle) {
ZipEntryInfo entryInfo;
&n |
| |
|
| |
本站关键词: |
|
|
|
|
 |
|
 |
|