Class ArchiveFactory
ชื่อพื้นที่: Aspose.Zip การประกอบ: Aspose.Zip.dll (25.5.0)
การตรวจจับรูปแบบไฟล์และสร้างวัตถุ Aspose.Zip.IArchive ที่เหมาะสมตามประเภทของไฟล์
public static class ArchiveFactory
Inheritance
อนุญาโตตุลาการ
object.GetType() , object.MemberwiseClone() , object.ToString() , object.Equals(object?) , object.Equals(object?, object?) , object.ReferenceEquals(object?, object?) , object.GetHashCode()
Methods
CompressDirectory(รั้ว, รั้ว, ArchiveFormat)
การบีบอัดไดเรกทอรีที่ระบุลงในไฟล์เอกสารโดยใช้รูปแบบเอกสารที่ให้
public static void CompressDirectory(string path, string outputFileName, ArchiveFormat archiveFormat)
Parameters
path
string
เส้นทางไปยังไดเรกทอรีที่จะถูกบีบอัด
outputFileName
string
ชื่อไฟล์ปลายทาง
archiveFormat
ArchiveFormat
รูปแบบของไฟล์ที่จะสร้าง (เช่น zip, rar, tar, ฯลฯ )
Examples
นี่คือตัวอย่างเกี่ยวกับวิธีการใช้วิธีการ CompressDirectory:
string directoryPath = @"C:\path\to\your\directory";
ArchiveInfo.ArchiveFormat format = ArchiveInfo.ArchiveFormat.Zip;
ArchiveFactory.CompressDirectory(directoryPath, "result", format);
// This will create a zip file with the contents of the directory at the specified path.
Remarks
วิธีการนี้จะสร้างไฟล์ไฟล์ในตําแหน่งที่ระบุโดยพารามิเตอร์ path" ชื่อไฟล์ไฟล์จะเป็นชื่อไดเรกทอรีตามที่ยืดไฟล์ที่เหมาะสมขึ้นอยู่กับ
archiveFormat".
Exceptions
ผ่านถ้าไดเรกทอรีที่ระบุโดย path’ ไม่มี
ผ่านถ้า path" เป็น null หรือแถวที่ว่างเปล่า
ผ่านถ้า archiveFormat" ที่ระบุไม่ได้รับการสนับสนุนหรือได้รับการยอมรับ
GetArchive(รั้ว)
Detect the archive format and creates the appropriate Aspose.Zip.IArchive object according to the type of archive specified by the given path
public static IArchive GetArchive(string path)
Parameters
path
string
เส้นทางไปยังเอกสารที่จะได้รับการวิเคราะห์
Returns
A Aspose.Zip.IArchive วัตถุที่แสดงให้เห็นถึงเอกสาร
GetArchive(Stream)
Detect the archive format and creates the appropriate Aspose.Zip.IArchive object according to the type of archive specified by the given stream
public static IArchive GetArchive(Stream stream)
Parameters
stream
Stream
กระแสที่มีข้อมูลออฟฟิล์ม มันจะต้องสามารถค้นหาได้
Returns
A Aspose.Zip.IArchive วัตถุที่แสดงให้เห็นถึงเอกสาร
GetArchive(กระแส, string)
Detect the archive format and creates the appropriate Aspose.Zip.IArchive object according to the type of encrypted archive specified by the given stream
public static IArchive GetArchive(Stream stream, string password)
Parameters
stream
Stream
กระแสที่มีข้อมูลออฟฟิล์ม มันจะต้องสามารถค้นหาได้
password
string
รหัสผ่านเพื่อ decrypt a encrypted archive
Returns
A Aspose.Zip.IArchive วัตถุที่แสดงให้เห็นถึงเอกสาร